:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --app: #0d0d0d;
  --sidebar: #171717;
  --panel: rgba(23, 23, 23, 0.94);
  --hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(255, 255, 255, 0.12);
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #3b82f6;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.6);
  --shadow-float: 0 8px 24px -4px rgba(0, 0, 0, 0.6), 0 20px 48px rgba(0, 0, 0, 0.8);
  --ease-apple-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-apple-pop: cubic-bezier(0.34, 1.28, 0.64, 1);
  --ease-spring-soft: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-spring-snap: cubic-bezier(0.2, 0.8, 0.2, 1);
  --motion-instant: 120ms;
  --motion-fast: 160ms;
  --motion-medium: 240ms;
  --motion-panel: 300ms;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: #0d0d0d;
}

body {
  background: #0d0d0d;
  color: #f4f4f5;
  font-size: 14px;
  letter-spacing: -0.011em;
  margin: 0;
  overflow-x: hidden;
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.motion-ready button,
.motion-ready .workspace-row,
.motion-ready .composer,
.motion-ready .picker-popover,
.motion-ready .side-panel,
.motion-ready .browser-dock,
.motion-ready .browser-viewport-frame iframe {
  transition-duration: var(--motion-fast);
  transition-property: background-color, border-color, box-shadow, color, opacity, transform;
  transition-timing-function: var(--ease-apple-spring);
}

.motion-ready button.is-pressing,
.motion-ready button:active {
  transform: scale(0.972) translate3d(0, 0, 0);
  transition-duration: var(--motion-instant);
}

.motion-ready .send-button.is-pressing,
.motion-ready .send-button:active {
  transform: scale(0.93) translate3d(0, 0, 0);
  transition-duration: var(--motion-instant);
}

.motion-ready .message,
.motion-ready .workspace-surface,
.motion-ready .picker-popover,
.motion-ready .browser-dock {
  backface-visibility: hidden;
  will-change: opacity, transform;
}

.icon-sprite {
  height: 0;
  overflow: hidden;
  position: absolute;
  width: 0;
}

.ui-icon {
  display: block;
  fill: none;
  flex: 0 0 auto;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  transition: grid-template-columns 0.25s var(--ease-apple-spring);
  width: 100vw;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 0px minmax(0, 1fr);
}

/* ── Sidebar Layout ── */
.sidebar {
  background: var(--sidebar, #f9f9f9);
  border-right: 1px solid var(--line, #e5e5e5);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 260px;
  min-width: 260px;
  overflow: hidden;
  padding: 0;
  position: sticky;
  top: 0;
  transition: transform 0.25s var(--ease-apple-spring), opacity 0.2s ease, width 0.25s var(--ease-apple-spring);
  width: 260px;
  z-index: 10;
}

body.sidebar-collapsed .sidebar {
  border-right-color: transparent;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-100%);
  width: 0;
}

/* ══════════════════════
   ZONE 1: Brand Row
   ══════════════════════ */
.sidebar-brand-zone {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  max-width: 100%;
  min-height: 56px;
  overflow: hidden;
  padding: 0 10px 0 14px;
  width: 100%;
}


.sidebar-brand-zone .brand {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  color: inherit;
  min-width: 0;
  overflow: hidden;
  text-decoration: none;
}

.brand-logo-img {
  width: 26px;
  height: 31px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.brand strong {
  color: #ffffff;
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand small,
.user-pill small {
  color: #9ca3af;
  display: block;
  font-size: 0.72rem;
}

.brand strong,
.brand small,
.user-pill strong,
.user-pill small {
  display: block;
}

/* Auth Modal B4 Logo */
.auth-modal-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 22px;
}

.auth-modal-logo-img {
  width: 56px;
  height: 67px;
  object-fit: contain;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 16px rgba(255, 255, 255, 0.15));
}

.auth-2fa-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #34d399;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 9999px;
  margin: 0 auto 16px;
  text-align: center;
}

/* Welcome Panel Central B4 Logo */
.welcome-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.welcome-logo-img {
  width: 64px;
  height: 76px;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.1));
}

.sidebar-brand-actions {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 2px;
}

.sidebar-icon-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #9ca3af;
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: 32px;
  justify-content: center;
  padding: 0;
  transition: background 0.12s ease, color 0.12s ease;
  width: 32px;
}

.sidebar-icon-btn .ui-icon {
  height: 16px;
  width: 16px;
}

.sidebar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* ══════════════════════
   ZONE 2: Nav Links
   ══════════════════════ */
.sidebar-nav-zone {
  box-sizing: border-box;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 2px 8px 8px;
  width: 100%;
}

.nav-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  box-sizing: border-box;
  color: #ececec;
  cursor: pointer;
  display: flex;
  font-size: 0.9rem;
  font-weight: 400;
  gap: 12px;
  height: 38px;
  max-width: 100%;
  min-height: 38px;
  min-width: 0;
  overflow: hidden;
  padding: 0 10px;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
  width: 100%;
}

.nav-item .nav-icon {
  color: #d1d5db;
  display: block;
  fill: none;
  flex: 0 0 auto;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 16px;
}

.nav-item .nav-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item:hover .nav-icon {
  color: #ffffff;
}

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 500;
}

.nav-item.is-active .nav-icon {
  color: #ffffff;
}

.nav-item--subtle {
  color: #9ca3af;
  font-weight: 400;
}

.nav-item--subtle:hover {
  color: #ffffff;
}

/* ══════════════════════
   ZONE 3: Content — Pinned / Projects / Chats
   ══════════════════════ */
.sidebar-content-zone {
  box-sizing: border-box;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 8px 4px;
  scrollbar-width: thin;
  width: 100%;
}

.sidebar-content-zone::-webkit-scrollbar {
  width: 3px;
}

.sidebar-content-zone::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
  border-radius: 3px;
}

/* Section wrapper */
.nav-section {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
  max-width: 100%;
  width: 100%;
}

/* Section header — "Pinned >", "Projects ∨", "Chats ∨" */
.nav-section-header {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  box-sizing: border-box;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  font-size: 0.78rem;
  font-weight: 500;
  gap: 4px;
  height: 28px;
  justify-content: space-between;
  letter-spacing: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 0 6px;
  text-transform: none;
  transition: color 0.1s ease;
  user-select: none;
  width: 100%;
}

.nav-section-header:hover {
  color: #ffffff;
}

.nav-section-title-wrap {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  flex: 1 1 auto;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.nav-section-title {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-section-actions {
  align-items: center;
  display: none;
  flex: 0 0 auto;
  flex-shrink: 0;
  gap: 2px;
}

.nav-section-header:hover .nav-section-actions {
  display: flex;
}

.nav-section-action-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: #9ca3af;
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: 22px;
  justify-content: center;
  padding: 0;
  transition: background 0.1s ease, color 0.1s ease;
  width: 22px;
}

.nav-section-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-section-action-btn .ui-icon {
  height: 13px;
  width: 13px;
}

.nav-section-chevron {
  flex: 0 0 auto;
  height: 12px;
  opacity: 0.7;
  transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  width: 12px;
}

.nav-section-header[aria-expanded="false"] .nav-section-chevron {
  transform: rotate(-90deg);
}

.nav-section-body {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  width: 100%;
}

/* "Show more" link */
.nav-show-more {
  background: transparent;
  border: 0;
  box-sizing: border-box;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.82rem;
  max-width: 100%;
  padding: 4px 8px 8px;
  text-align: left;
  transition: color 0.1s ease;
  width: 100%;
}

.nav-show-more:hover {
  color: #ffffff;
}

/* ── Project items (folder icon + project name) ── */
.nav-project-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  box-sizing: border-box;
  color: #ececec;
  cursor: pointer;
  display: flex;
  font-size: 0.88rem;
  gap: 8px;
  height: 34px;
  max-width: 100%;
  min-height: 34px;
  min-width: 0;
  overflow: hidden;
  padding: 0 8px;
  position: relative;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
  width: 100%;
}

.nav-project-item .proj-icon {
  color: #9ca3af;
  display: block;
  fill: none;
  flex: 0 0 auto;
  flex-shrink: 0;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 15px;
}

.nav-project-item .proj-name {
  color: #ececec;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-project-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-project-item:hover .proj-name,
.nav-project-item:hover .proj-icon {
  color: #ffffff;
}

.nav-project-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Project item hover-reveal actions */
.nav-project-item .item-actions {
  align-items: center;
  display: none;
  flex: 0 0 auto;
  flex-shrink: 0;
  gap: 1px;
  margin-left: auto;
}

.nav-project-item:hover .item-actions,
.nav-project-item.is-active .item-actions {
  display: inline-flex;
}

/* Fade-out title mask on hover */
.nav-project-item:hover .proj-name,
.nav-project-item.is-active .proj-name {
  -webkit-mask-image: linear-gradient(to right, black 55%, transparent 100%);
  mask-image: linear-gradient(to right, black 55%, transparent 100%);
}

/* ── Chat items (text only, no icon by default) ── */
.sidebar-chat-wrapper {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.sidebar-nav-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  box-sizing: border-box;
  color: #ececec;
  cursor: pointer;
  display: flex;
  font-size: 0.88rem;
  font-weight: 400;
  height: 34px;
  max-width: 100%;
  min-height: 34px;
  min-width: 0;
  overflow: hidden;
  padding: 0 8px;
  position: relative;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
  width: 100%;
}

.sidebar-nav-item .sidebar-item-title {
  color: #ececec;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-nav-item:hover .sidebar-item-title {
  color: #ffffff;
}

.sidebar-nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.sidebar-nav-item.is-active .sidebar-item-title {
  color: #ffffff;
}

/* Branch items */
.sidebar-nav-item.is-branch-item {
  color: #ececec;
}

.branch-pill-icon {
  color: #10a37f;
  flex: 0 0 14px;
  flex-shrink: 0;
  height: 14px;
  margin-right: 6px;
  width: 14px;
}

.sidebar-branch-children {
  border-left: 1.5px dashed rgba(16, 163, 127, 0.35);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 14px;
  max-width: calc(100% - 14px);
  overflow: hidden;
  padding-left: 2px;
}

/* Hover-reveal actions (branch + pin + ...) */
.sidebar-nav-item .item-actions {
  align-items: center;
  display: none;
  flex: 0 0 auto;
  flex-shrink: 0;
  gap: 1px;
  margin-left: auto;
}

.sidebar-nav-item:hover .item-actions,
.sidebar-nav-item.is-active .item-actions {
  display: inline-flex;
}

/* Fade-out title mask when actions are visible */
.sidebar-nav-item:hover .sidebar-item-title,
.sidebar-nav-item.is-active .sidebar-item-title {
  -webkit-mask-image: linear-gradient(to right, black 55%, transparent 100%);
  mask-image: linear-gradient(to right, black 55%, transparent 100%);
}

.item-action-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: #6e6e80;
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: 22px;
  justify-content: center;
  padding: 0;
  transition: background 0.1s ease, color 0.1s ease;
  width: 22px;
}

.item-action-btn.branch-action-btn:hover {
  background: rgba(16, 163, 127, 0.12);
  color: #10a37f;
}



.item-action-btn .ui-icon {
  height: 13px;
  width: 13px;
}

.item-action-btn:hover {
  background: rgba(0,0,0,0.08);
  color: var(--ink);
}

/* Notification dot */
.item-dot {
  background: #10a37f;
  border-radius: 50%;
  flex: 0 0 6px;
  height: 6px;
  margin-left: 4px;
  width: 6px;
}

/* ── Context Menu (Share / Rename / Pin / Archive / Delete / Move) ── */
.sidebar-context-menu {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  min-width: 180px;
  overflow: hidden;
  padding: 4px;
  position: fixed;
  z-index: 9999;
}

.sidebar-context-header {
  color: #6e6e80;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 6px 10px 4px;
  user-select: none;
}

.sidebar-context-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #0d0d0d;
  cursor: pointer;
  display: flex;
  font-size: 0.88rem;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  position: relative;
  transition: background 0.1s ease;
  width: 100%;
}

.sidebar-context-item:hover {
  background: rgba(0,0,0,0.05);
}

.sidebar-context-item .ctx-icon {
  color: #6e6e80;
  flex: 0 0 auto;
  height: 15px;
  width: 15px;
}

.sidebar-context-item .ctx-check {
  color: #0d0d0d;
  flex: 0 0 auto;
  height: 14px;
  margin-left: auto;
  width: 14px;
}

.sidebar-context-item.is-danger { color: #ef4444; }
.sidebar-context-item.is-danger .ctx-icon { color: #ef4444; }

.sidebar-context-divider {
  border: 0;
  border-top: 1px solid rgba(0,0,0,0.07);
  margin: 3px 0;
}


/* ══════════════════════
   ZONE 4: Footer
   ══════════════════════ */
.sidebar-footer-zone {
  border-top: 1px solid var(--line, #e5e5e5);
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 0;
  padding: 6px 8px 10px;
}

.user-pill {
  align-items: center;
  border-radius: 10px;
  cursor: default;
  display: flex;
  gap: 10px;
  min-height: 46px;
  padding: 6px 8px;
  transition: background 0.12s ease;
}

.user-pill:hover {
  background: var(--hover);
}

.user-pill > span {
  align-items: center;
  background: #10a37f;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.64rem;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.user-pill-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.user-pill strong {
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill small {
  color: #9ca3af;
  font-size: 0.72rem;
}

.user-pill-actions {
  align-items: center;
  display: flex;
  gap: 2px;
  margin-left: auto;
}



/* ── Global layout flex helpers (non-sidebar) ── */
.topbar,
.first-page-actions,
.first-page-actions button,
.composer-tools,
.picker-button,
.context-picker-button,
.composer-leading,
.composer-trailing,
.recent-prompts button,
.message-actions,
.panel-header,
.workflow-step,
.settings-row,
.check-row,
.panel-actions {
  align-items: center;
  display: flex;
}

.ghost-icon,
.icon-button,
.send-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 650;
  height: 34px;
  justify-content: center;
  min-height: 34px;
  min-width: 34px;
  width: 34px;
}

.ghost-icon:hover,
.icon-button:hover,
.first-page-actions button:hover,
.secondary-action:hover {
  background: var(--hover);
}

.sidebar-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-app {
  background: var(--app);
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  height: 100vh;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.topbar {
  align-items: center;
  display: flex;
  height: 48px;
  justify-content: space-between;
  padding: 0 16px;
  position: relative;
  width: 100%;
}

.topbar.project-tree-topbar {
  background: var(--app);
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
  z-index: 20;
}

.topbar > .ghost-icon {
  position: static;
}

.temporary-toggle[aria-pressed="true"] {
  background: #eef4ff;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(38, 103, 240, 0.22);
}

.temporary-toggle .ui-icon {
  height: 19px;
  width: 19px;
}

body.temporary-chat .composer {
  border-color: rgba(38, 103, 240, 0.28);
}

body.temporary-chat .composer:focus-within {
  box-shadow: 0 14px 38px rgba(38, 103, 240, 0.12);
}

.work-tabs button {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #555a57;
  flex: 1;
  font-weight: 620;
  height: 38px;
  min-width: 76px;
  padding: 0 12px;
}

.work-tabs button.is-active {
  background: transparent;
  box-shadow: none;
  color: var(--ink);
}

.browser-tabs button.is-active,
.browser-viewport-tools button.is-active {
  background: transparent;
  box-shadow: none;
  color: var(--ink);
}

.motion-ready .work-tabs button {
  transition-duration: var(--motion-medium);
}

.conversation {
  align-content: center;
  display: grid;
  overflow: auto;
  padding: 20px clamp(20px, 8vw, 120px) 96px;
}

.welcome-panel {
  margin: 0 auto;
  max-width: 860px;
  width: 100%;
}

.welcome-panel h1 {
  font-size: 1.72rem;
  font-weight: 430;
  line-height: 1.2;
  margin: 0 0 24px;
  text-align: center;
}

.first-page-actions {
  gap: 8px;
  justify-content: center;
  margin: -10px auto 16px;
}

.first-page-actions button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #464c48;
  gap: 8px;
  height: 34px;
  padding: 0 13px;
}

.first-page-actions .ui-icon {
  height: 16px;
  width: 16px;
}

.composer-tools {
  gap: 8px;
  justify-content: center;
  margin: 0 auto 10px;
  max-width: 760px;
  min-width: 0;
}

.native-picker {
  display: none !important;
}

.picker-button,
.context-picker-button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #565c58;
  gap: 7px;
  height: 34px;
  justify-content: center;
  min-width: 104px;
  padding: 0 12px;
}

.picker-button:hover,
.context-picker-button:hover,
.picker-button[aria-expanded="true"],
.context-picker-button[aria-expanded="true"] {
  background: #f7f7f7;
  border-color: var(--line-strong);
  color: var(--ink);
}

.picker-button.has-selection,
.context-picker-button.has-selection {
  color: #252927;
}

.picker-button .ui-icon,
.context-picker-button .ui-icon {
  height: 14px;
  stroke-width: 2.2;
  width: 14px;
}

.context-picker-button {
  border-color: transparent;
  max-width: 124px;
  min-width: 0;
  padding: 0 10px;
}

/* macOS-style composer: fixed icon rails + flexible text, glassmorphic vibrancy */
.composer {
  --composer-max: min(760px, 100%);
  background: var(--panel);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 760px;
  padding: 8px 10px;
  position: relative;
  transform: translate3d(0, 0, 0);
  transition:
    border-color var(--motion-fast) var(--ease-apple-spring),
    box-shadow var(--motion-medium) var(--ease-apple-spring),
    transform var(--motion-instant) var(--ease-apple-spring);
  width: var(--composer-max);
}

.composer:focus-within {
  border-color: rgba(38, 103, 240, 0.45);
  box-shadow: 0 0 0 3px rgba(38, 103, 240, 0.12), var(--shadow-float);
}

.composer.is-thinking {
  border-color: rgba(38, 103, 240, 0.35);
  box-shadow: 0 0 0 3px rgba(38, 103, 240, 0.18), 0 16px 42px rgba(20, 22, 21, 0.11);
}

.composer-row {
  align-items: flex-end;
  display: grid;
  gap: 6px;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  min-height: 44px;
  width: 100%;
}

.composer-leading,
.composer-trailing {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  min-width: 0;
}

.composer-leading {
  justify-content: center;
  padding-bottom: 3px;
}

.composer-trailing {
  justify-content: flex-end;
  padding-bottom: 3px;
}

.icon-button {
  color: #262a27;
  border-radius: 999px;
  height: 36px;
  min-height: 36px;
  min-width: 36px;
  width: 36px;
}

.icon-button .ui-icon {
  height: 20px;
  stroke-width: 1.9;
  width: 20px;
}

.composer textarea {
  align-self: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 0.98rem;
  grid-column: 2;
  line-height: 1.4;
  max-height: 160px;
  min-height: 28px;
  min-width: 0;
  outline: 0;
  overflow-y: auto;
  padding: 10px 4px;
  resize: none;
  width: 100%;
}

.composer textarea::placeholder {
  color: #989d9a;
}

/* ── LIVING INTELLIGENCE ROUTING INSPECTOR ── */
.routing-summary {
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4a4e4b;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.76rem;
  gap: 6px;
  justify-content: center;
  line-height: 1.3;
  margin: 10px auto 0;
  max-width: 720px;
  padding: 4px 12px;
  transition: all var(--motion-fast) var(--ease-spring-soft);
}

.routing-summary[hidden] {
  display: none;
}

.routing-pill-mode {
  background: #10a37f;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 650;
  padding: 2px 8px;
}

.routing-pill-model {
  color: var(--ink);
  font-weight: 600;
}

.routing-pill-metric {
  background: #f1f3f2;
  border-radius: 4px;
  color: #555b57;
  font-family: 'Fira Code', monospace;
  font-size: 0.7rem;
  padding: 1px 5px;
}

.routing-why-btn {
  background: transparent;
  border: 0;
  color: #10a37f;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.routing-why-btn:hover {
  color: #0e9270;
}

.routing-breakdown-popover {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  padding: 12px 14px;
  position: absolute;
  text-align: left;
  z-index: 50;
}

.routing-breakdown-title {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0;
}

.routing-breakdown-item {
  color: #4a4e4b;
  font-size: 0.76rem;
  line-height: 1.4;
}


.picker-popover {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(20, 22, 21, 0.16);
  padding: 7px;
  position: fixed;
  transform-origin: top left;
  z-index: 70;
}

.picker-popover[hidden] {
  display: none;
}

.picker-menu {
  display: grid;
  gap: 2px;
}

.picker-menu-title {
  color: #8a908c;
  font-size: 0.74rem;
  font-weight: 660;
  padding: 7px 9px 5px;
}

.picker-option {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 52px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.picker-option:hover,
.picker-option.is-selected {
  background: #f3f3f3;
}

.picker-option span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.picker-option strong {
  font-size: 0.9rem;
  font-weight: 620;
  line-height: 1.15;
}

.picker-option small {
  color: #777d79;
  font-size: 0.76rem;
  line-height: 1.25;
}

.picker-option .ui-icon {
  color: var(--accent);
  height: 16px;
  width: 16px;
}

select {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #696e6b;
  font-size: 0.82rem;
  font-weight: 560;
  height: 34px;
  max-width: 94px;
  min-width: 64px;
  outline: 0;
  padding: 0 8px;
}

select:hover {
  background: var(--hover);
}

.send-button {
  background: var(--accent);
  border-radius: 999px;
  color: #ffffff;
  height: 36px;
  min-height: 36px;
  min-width: 36px;
  position: relative;
  width: 36px;
}

.send-button .ui-icon {
  height: 18px;
  stroke-width: 2.35;
  width: 18px;
}

.send-button:hover:not(:disabled) {
  background: #1559df;
}

.send-button:disabled {
  cursor: default;
  opacity: 0.72;
}

.send-button.is-loading .ui-icon {
  opacity: 0;
}

.send-button.is-loading::after {
  animation: spin 0.75s linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  content: "";
  height: 15px;
  position: absolute;
  width: 15px;
}

.mic-button {
  color: #4c5350;
}

.mic-button .ui-icon {
  height: 18px;
  width: 18px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.recent-prompts {
  display: grid;
  gap: 6px;
  margin: 32px auto 0;
  max-width: 560px;
  width: 100%;
}

.recent-prompts button {
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: #7e8581;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  text-align: left;
  width: 100%;
}

.recent-prompts button:hover {
  background: #f5f5f5;
  color: #303431;
}

.recent-prompts .prompt-icon {
  color: #1f2321;
  height: 16px;
  stroke-width: 1.95;
  width: 16px;
}

.recent-prompts .prompt-label {
  color: inherit;
  font-size: 0.9rem;
  line-height: 1.2;
  min-width: 0;
}

.message {
  align-items: flex-start;
  display: flex;
  margin: 0 auto 24px;
  max-width: 48rem;
  width: 100%;
}

.avatar {
  display: none !important;
}

.bubble {
  color: #ececec;
  font-size: 1rem;
  line-height: 1.7;
  min-width: 0;
  width: 100%;
}

.user-message {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto 24px;
}

.user-message .bubble {
  background: #2f2f2f !important;
  border: none !important;
  border-radius: 24px !important;
  color: #ececec !important;
  font-size: 0.98rem !important;
  line-height: 1.5 !important;
  max-width: 70% !important;
  padding: 10px 20px !important;
  margin-left: auto !important;
  width: auto !important;
}

.assistant-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto 28px;
}

.assistant-message .bubble {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  width: 100% !important;
  color: #ececec !important;
  font-size: 1rem !important;
  line-height: 1.75 !important;
}

.bubble strong,
.bubble b {
  color: var(--ink);
  font-weight: 600;
}

/* GitHub-Flavored Markdown & Rich Output */
.bubble .md-p {
  margin: 0 0 12px 0;
}
.bubble .md-p:last-child {
  margin-bottom: 0;
}

.bubble .md-heading {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 16px 0 6px 0;
}
.bubble h2.md-heading { font-size: 1.12rem; font-weight: 600; }
.bubble h3.md-heading { font-size: 1.05rem; font-weight: 600; }
.bubble h4.md-heading { font-size: 0.98rem; font-weight: 600; }
.bubble h5.md-heading { font-size: 0.92rem; font-weight: 600; }

.bubble .md-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 14px 0;
  padding-left: 20px;
}
.bubble .md-list li {
  line-height: 1.68;
}
.bubble .md-list li strong {
  font-weight: 600;
}

.bubble .md-quote {
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
  font-style: italic;
  margin: 12px 0;
  padding: 6px 14px;
}

.bubble .md-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.bubble .md-inline-code {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  padding: 2px 5px;
}
.dark-theme .bubble .md-inline-code {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.bubble .md-link {
  color: #10a37f;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Glassmorphic Markdown Tables */
.table-container {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 14px 0;
  overflow-x: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.markdown-table {
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 0;
  min-width: 100%;
  text-align: left;
  width: 100%;
}

.markdown-table th {
  background: var(--hover);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 650;
  padding: 10px 14px;
  white-space: nowrap;
}

.markdown-table td {
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  padding: 9px 14px;
  vertical-align: top;
}

.markdown-table tbody tr:last-child td {
  border-bottom: 0;
}

.markdown-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}
.dark-theme .markdown-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Code Block Cards with Copy Button */
.code-block-wrapper {
  background: #181a19;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  color: #f2f3f2;
  margin: 14px 0;
  overflow: hidden;
}

.code-header {
  align-items: center;
  background: #202422;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  padding: 7px 14px;
}

.code-lang {
  color: #9aa19d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
}

.copy-code-btn {
  align-items: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #cfd4d0;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.74rem;
  gap: 5px;
  padding: 4px 8px;
  transition: all 0.15s ease;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.copy-code-btn.is-copied {
  background: #10a37f;
  border-color: #10a37f;
  color: #ffffff;
}

.code-block-wrapper pre {
  margin: 0;
  overflow-x: auto;
  padding: 14px 16px;
}

.code-block-wrapper code {
  color: #e6e8e7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.6;
}

/* Live Visual / SVG Artifact Cards */
.visual-artifact-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  margin: 16px 0;
  overflow: hidden;
}

.visual-artifact-header {
  align-items: center;
  background: var(--hover);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
}

.visual-badge {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.visual-artifact-canvas {
  align-items: center;
  background: #ffffff;
  display: flex;
  justify-content: center;
  min-height: 200px;
  overflow: auto;
  padding: 20px;
}
.dark-theme .visual-artifact-canvas {
  background: #151716;
}

.visual-artifact-canvas svg {
  border-radius: 8px;
  height: auto;
  max-width: 100%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.capability-strip {
  display: none !important;
}

.typing-message {
  margin-bottom: 18px;
}

.typing-dots {
  align-items: center;
  display: inline-flex;
  gap: 5px;
  height: 30px;
}

.typing-dots span {
  animation: typingPulse 1.05s ease-in-out infinite;
  background: #858b87;
  border-radius: 50%;
  display: block;
  height: 6px;
  width: 6px;
}

.typing-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.typing-dots span:nth-child(3) {
  animation-delay: 240ms;
}

.message-actions {
  align-items: center;
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 4px;
}

.message-actions button.action-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #8e8e8e;
  cursor: pointer;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  transition: all 0.15s ease;
  width: 30px;
  padding: 0;
}

.message-actions button.action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.message-actions button.action-btn:active {
  transform: scale(0.92);
}

.message-actions button.action-btn.is-success {
  background: rgba(16, 163, 127, 0.12);
  color: #10a37f;
}

.message-actions .ui-icon {
  height: 16px;
  stroke-width: 1.8;
  width: 16px;
}

/* Real-time Streaming Caret & Smooth Flow */
.streaming-caret {
  animation: streamingBlink 0.85s cubic-bezier(0.32, 0.72, 0, 1) infinite;
  background: var(--ink);
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  margin-left: 5px;
  vertical-align: 1px;
  width: 8px;
}

@keyframes streamingBlink {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.15;
    transform: scale(0.7);
  }
}

.stream-content {
  color: var(--ink);
  line-height: 1.68;
  word-break: break-word;
}

.workspace-surface {
  display: grid;
  gap: 18px;
  margin: 4px auto 0;
  max-width: 760px;
  width: 100%;
}

.workspace-surface-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding-bottom: 14px;
}

.workspace-surface-header h1 {
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.2;
  margin: 0;
}

.workspace-surface-header p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  margin: 5px 0 0;
  max-width: 560px;
}

.workspace-surface-grid {
  display: grid;
  gap: 18px;
}

.workspace-section {
  display: grid;
  gap: 8px;
}

.workspace-section h2 {
  color: #565c58;
  font-size: 0.78rem;
  font-weight: 680;
  margin: 0;
}

.workspace-list {
  display: grid;
  gap: 2px;
}

.workspace-row {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 46px;
  padding: 7px 10px;
  text-align: left;
  width: 100%;
}

button.workspace-row:hover {
  background: #f5f5f5;
}

div.workspace-row {
  cursor: default;
}

.workspace-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.workspace-row strong {
  font-size: 0.9rem;
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-row small,
.workspace-row em,
.workspace-empty {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.workspace-row em {
  flex: 0 0 auto;
}

.workspace-empty {
  min-height: 34px;
  padding: 8px 10px;
}

/* Active chat: thread from the top, composer docked at the bottom (not under home hero). */
body.has-chat .conversation {
  align-content: stretch;
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 18px;
  padding-top: 10px;
}

body.has-chat .welcome-panel {
  align-self: center;
  background: linear-gradient(180deg, transparent 0%, var(--app) 22%);
  margin: auto 0 0;
  max-width: 860px;
  order: 2;
  padding: 14px 0 6px;
  position: sticky;
  bottom: 0;
  width: min(860px, 100%);
  z-index: 3;
}

body.has-chat .welcome-header,
body.has-chat .welcome-panel h1,
body.has-chat .welcome-subtitle,
body.has-chat .welcome-badge,
body.has-chat .first-page-actions,
body.has-chat .recent-prompts,
body.has-chat .starter-command-grid,
body.has-chat .chatgpt-suggestions-wrap {
  display: none !important;
}

body.has-chat .composer-tools {
  margin-bottom: 8px;
}

body.browser-open .conversation {
  padding-right: clamp(480px, 48vw, 780px);
}

.browser-dock.studio-dock {
  background: var(--panel, #ffffff);
  border-left: 1px solid var(--line, #e5e5e5);
  box-shadow: -18px 0 44px rgba(20, 22, 21, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: calc(100vh - 60px);
  height: calc(100dvh - 60px);
  max-width: min(760px, calc(100vw - 280px));
  padding: 10px 12px;
  position: fixed;
  right: 0;
  top: 60px;
  transform: translateX(calc(100% + 20px));
  transition: transform var(--motion-panel) var(--ease-spring-soft), opacity var(--motion-panel) var(--ease-spring-soft);
  width: clamp(520px, 48vw, 760px);
  z-index: 30;
}

.browser-dock[hidden] {
  display: none;
}

.browser-dock.is-open {
  transform: translateX(0);
}

/* Studio Header & Navigation */
.studio-header {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.studio-tabs {
  background: #f1f1f1;
  border-radius: 999px;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
}

.studio-tabs button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #595f5b;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 600;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  transition: all 0.14s ease;
}

.studio-tabs button:hover {
  color: var(--ink);
}

.studio-tabs button.is-active {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  color: var(--ink);
}

.studio-header-actions {
  align-items: center;
  display: flex;
  gap: 6px;
}

.studio-run-btn {
  align-items: center;
  background: #10a37f !important;
  border-radius: 8px !important;
  color: #ffffff !important;
  display: inline-flex !important;
  font-size: 0.78rem;
  font-weight: 620;
  gap: 4px;
  height: 28px !important;
  padding: 0 10px !important;
  transition: background 0.14s ease;
  width: auto !important;
}

.studio-run-btn:hover {
  background: #0e9270 !important;
}

/* Studio Subchrome Toolbar */
.studio-subchrome {
  align-items: center;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-height: 40px;
  padding: 4px 8px;
}

.browser-viewport-tools button {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #6a6f6c;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  height: 24px;
  padding: 0 8px;
  transition: all 0.12s ease;
}

.browser-viewport-tools button.is-active {
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  color: var(--ink);
}

.studio-quick-tools {
  align-items: center;
  display: flex;
  gap: 4px;
}

.studio-tool-btn {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #4a4e4b;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 560;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  transition: all 0.12s ease;
}

.studio-tool-btn:hover {
  background: #f4f4f4;
  border-color: var(--line-strong);
  color: var(--ink);
}

/* Studio Surface Display Logic */
.studio-surface {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.studio-surface.is-active {
  display: flex;
}

/* ── TAB 1: Preview Viewport ── */
.browser-viewport-frame {
  align-items: center;
  background: #18191c;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
  position: relative;
}

.browser-viewport-frame iframe {
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  display: block;
  height: 100%;
  transition: max-width var(--motion-medium) var(--ease-spring-soft);
  width: 100%;
}

.studio-dock[data-viewport="desktop"] .browser-viewport-frame iframe {
  max-width: 1200px;
}

.studio-dock[data-viewport="tablet"] .browser-viewport-frame iframe {
  max-width: 768px;
}

.studio-dock[data-viewport="mobile"] .browser-viewport-frame iframe {
  max-width: 375px;
}

/* ── TAB 2: Code Editor (Cursor) ── */
.code-editor-filetabs {
  align-items: center;
  background: #18191c;
  border-radius: 10px 10px 0 0;
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
}

.code-file-tab {
  align-items: center;
  background: #232428;
  border: 0;
  border-radius: 6px 6px 0 0;
  color: #9ba09d;
  cursor: pointer;
  display: inline-flex;
  font-family: 'Fira Code', monospace;
  font-size: 0.76rem;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  transition: all 0.12s ease;
}

.code-file-tab.is-active {
  background: #111215;
  color: #ffffff;
  font-weight: 600;
}

.file-tab-dot {
  border-radius: 50%;
  display: inline-block;
  height: 7px;
  width: 7px;
}

.html-dot { background: #e34f26; }
.css-dot { background: #1572b6; }
.js-dot { background: #f7df1e; }

.code-editor-body {
  background: #111215;
  border-radius: 0 0 10px 10px;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.code-line-numbers {
  background: #18191c;
  color: #555a58;
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 12px 8px;
  text-align: right;
  user-select: none;
  width: 36px;
}

.code-editor-textarea {
  background: transparent;
  border: 0;
  color: #d4d4d8;
  flex: 1 1 auto;
  font-family: 'Fira Code', Consolas, Monaco, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  outline: 0;
  padding: 12px 14px;
  resize: none;
  tab-size: 2;
  white-space: pre;
}

/* ── TAB 3: UI/UX Designer (Framer) ── */
.design-studio-panel {
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 16px;
}

.design-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.design-section-title {
  color: #3b3f3c;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
}

.design-theme-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, 1fr);
}

.theme-preset-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  text-align: left;
  transition: all 0.14s ease;
}

.theme-preset-card:hover {
  background: #f7f7f7;
  border-color: var(--line-strong);
}

.theme-preset-card.is-active {
  background: #ffffff;
  border-color: #10a37f;
  box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2);
}

.theme-swatch {
  border-radius: 4px;
  flex-shrink: 0;
  height: 18px;
  width: 18px;
}

.dark-saas-swatch { background: linear-gradient(135deg, #0f172a, #6366f1); }
.clean-minimal-swatch { background: linear-gradient(135deg, #ffffff, #e2e8f0); border: 1px solid #cbd5e1; }
.glassmorphism-swatch { background: linear-gradient(135deg, rgba(255,255,255,0.4), #38bdf8); }
.cyber-neon-swatch { background: linear-gradient(135deg, #000000, #10b981); }

.design-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.design-pill-btn {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #4a4e4b;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 560;
  height: 28px;
  padding: 0 10px;
  transition: all 0.12s ease;
}

.design-pill-btn:hover {
  background: #f2f2f2;
}

.design-pill-btn.is-active {
  background: #10a37f;
  border-color: #10a37f;
  color: #ffffff;
}

.design-component-starters {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, 1fr);
}

.component-starter-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  text-align: left;
  transition: all 0.14s ease;
}

.component-starter-card:hover {
  background: #f7f7f7;
  border-color: #10a37f;
  transform: translateY(-1px);
}

.component-starter-card strong {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 620;
}

.component-starter-card small {
  color: #717673;
  font-size: 0.72rem;
  line-height: 1.3;
}

/* ── TAB 3: Git Checkpoints & Diff Viewer (Cursor) ── */
.studio-diff-panel {
  background: #111215;
  border-radius: 12px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.diff-header-bar {
  align-items: center;
  background: #18191c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
}

.diff-header-bar strong {
  color: #f4f4f5;
  font-size: 0.8rem;
}

.diff-checkpoint-tag {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 4px;
  color: #818cf8;
  font-family: 'Fira Code', monospace;
  font-size: 0.7rem;
  margin-left: 6px;
  padding: 1px 6px;
}

.diff-actions {
  display: flex;
  gap: 6px;
}

.diff-btn-accept {
  background: #10a37f;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  transition: background 0.12s;
}

.diff-btn-accept:hover {
  background: #0e9270;
}

.diff-btn-revert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  color: #f87171;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  transition: all 0.12s;
}

.diff-btn-revert:hover {
  background: rgba(239, 68, 68, 0.25);
}

.diff-content-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 12px;
}

.diff-empty-state {
  color: #71717a;
  font-size: 0.8rem;
  padding: 24px;
  text-align: center;
}

.diff-file-card {
  background: #18191c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.diff-file-header {
  align-items: center;
  background: #232428;
  color: #d4d4d8;
  display: flex;
  font-family: 'Fira Code', monospace;
  font-size: 0.76rem;
  font-weight: 600;
  justify-content: space-between;
  padding: 6px 10px;
}

.diff-status-tag {
  border-radius: 3px;
  font-size: 0.68rem;
  padding: 1px 5px;
}

.diff-status-tag.modified { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.diff-status-tag.created { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.diff-status-tag.deleted { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.diff-code-view {
  font-family: 'Fira Code', monospace;
  font-size: 0.76rem;
  line-height: 1.4;
  overflow-x: auto;
  padding: 8px 10px;
}

.diff-line-add {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.diff-line-del {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* ── TAB 4: Isolated Terminal & Command Engine (Replit) ── */
.studio-terminal-panel {
  background: #090a0f;
  border-radius: 12px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.terminal-quick-bar {
  align-items: center;
  background: #13151f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
}

.terminal-cwd {
  color: #818cf8;
  font-family: 'Fira Code', monospace;
  font-size: 0.74rem;
  font-weight: 600;
}

.terminal-quick-cmds {
  display: flex;
  gap: 4px;
}

.term-quick-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #a1a1aa;
  cursor: pointer;
  font-family: 'Fira Code', monospace;
  font-size: 0.68rem;
  padding: 2px 6px;
  transition: all 0.12s;
}

.term-quick-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.terminal-output {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 10px 12px;
}

.term-line {
  font-family: 'Fira Code', monospace;
  font-size: 0.76rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
}

.term-line.info { color: #60a5fa; }
.term-line.success { color: #34d399; }
.term-line.error { color: #f87171; }
.term-line.cmd { color: #facc15; font-weight: 600; }
.term-line.stdout { color: #d4d4d8; }

.terminal-input-row {
  align-items: center;
  background: #111215;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  padding: 6px 10px;
}

.terminal-prompt-symbol {
  color: #10a37f;
  font-family: 'Fira Code', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  margin-right: 8px;
}

.terminal-input {
  background: transparent;
  border: 0;
  color: #ffffff;
  flex: 1 1 auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  outline: 0;
}

.terminal-submit-btn {
  background: #232428;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #d4d4d8;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 3px 8px;
}

.terminal-submit-btn:hover {
  background: #2d3036;
  color: #fff;
}

/* ── TAB 5: Universal Artifacts Registry ── */
.studio-artifacts-panel {
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 12px;
}

.artifacts-header-bar {
  align-items: center;
  color: #3b3f3c;
  display: flex;
  font-size: 0.82rem;
  font-weight: 650;
  justify-content: space-between;
  margin-bottom: 12px;
}

.artifacts-count-badge {
  background: #e0e7ff;
  border-radius: 999px;
  color: #4338ca;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
}

.artifacts-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.artifact-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  transition: all 0.14s ease;
}

.artifact-card:hover {
  border-color: #10a37f;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.artifact-card-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.artifact-card-title {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 650;
}

.artifact-type-badge {
  background: #f1f3f2;
  border-radius: 4px;
  color: #555b57;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  text-transform: uppercase;
}

.artifact-card-files {
  color: #717673;
  font-family: 'Fira Code', monospace;
  font-size: 0.72rem;
}

.artifact-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.artifact-action-btn {
  background: #f4f4f4;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #3b3f3c;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  transition: all 0.12s;
}

.artifact-action-btn:hover {
  background: #10a37f;
  border-color: #10a37f;
  color: #ffffff;
}

/* ── AGENT TIMELINE & APPROVAL CARDS IN CHAT ── */
.agent-timeline-container {
  background: #fbfbfb;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
  padding: 10px 12px;
}

.agent-timeline-header {
  align-items: center;
  color: #4a4e4b;
  display: flex;
  font-size: 0.78rem;
  font-weight: 700;
  justify-content: space-between;
}

.agent-step-pill {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  font-size: 0.74rem;
  gap: 8px;
  padding: 6px 10px;
}

.agent-step-icon {
  font-weight: 700;
}
.agent-step-icon.done { color: #10a37f; }
.agent-step-icon.error { color: #ef4444; }

.agent-approval-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
}

.agent-approval-title {
  color: #92400e;
  font-size: 0.8rem;
  font-weight: 700;
}

.agent-approval-actions {
  display: flex;
  gap: 8px;
}

/* ── UIE INTENT ASSUMPTION BANNER & PIVOT MODAL ── */
.intent-assumption-card {
  align-items: center;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  display: flex;
  font-size: 0.76rem;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 8px 12px;
}

.intent-assumption-text {
  color: #166534;
  font-weight: 550;
}

.btn-change-intent {
  background: #ffffff;
  border: 1px solid #86efac;
  border-radius: 6px;
  color: #15803d;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 650;
  padding: 3px 8px;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.btn-change-intent:hover {
  background: #dcfce7;
  border-color: #4ade80;
}

.intent-pivot-popover {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 320px;
  padding: 12px;
  position: absolute;
  z-index: 1000;
}

.intent-pivot-title {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.intent-hypothesis-option {
  align-items: center;
  background: #fbfbfb;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  font-size: 0.74rem;
  justify-content: space-between;
  padding: 6px 10px;
  text-align: left;
  transition: all 0.12s ease;
}

.intent-hypothesis-option:hover {
  background: #f0fdf4;
  border-color: #10a37f;
  color: #0f766e;
}

.intent-hyp-conf {
  background: rgba(16, 185, 129, 0.15);
  border-radius: 4px;
  color: #059669;
  font-family: 'Fira Code', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 4px;
}



/* ── TAB 5: Files View ── */
.studio-files-panel {
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 12px;
}

.studio-files-header {
  align-items: center;
  color: #3b3f3c;
  display: flex;
  font-size: 0.82rem;
  font-weight: 650;
  justify-content: space-between;
  margin-bottom: 8px;
}

.studio-files-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.studio-file-item {
  align-items: center;
  border-radius: 6px;
  color: #4a4e4b;
  cursor: pointer;
  display: flex;
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  gap: 8px;
  height: 30px;
  padding: 0 8px;
  transition: all 0.12s ease;
}

.studio-file-item:hover {
  background: #f0f0f0;
  color: var(--ink);
}

.studio-file-item.is-active {
  background: #e6f4ea;
  color: #137333;
  font-weight: 600;
}

.studio-status {
  color: #7b807d;
  font-size: 0.74rem;
  line-height: 1.3;
  min-height: 16px;
  text-align: center;
}
-width var(--motion-medium) var(--ease-spring-soft);
  width: 100%;
}

.browser-dock[data-viewport="desktop"] .browser-viewport-frame iframe {
  max-width: 1280px;
}

.browser-dock[data-viewport="mobile"] .browser-viewport-frame iframe {
  max-width: 390px;
}

.browser-status {
  color: #7b807d;
  font-size: 0.76rem;
  line-height: 1.3;
  min-height: 18px;
  text-align: center;
}

.panel-backdrop {
  background: rgba(17, 19, 18, 0.18);
  inset: 0;
  position: fixed;
  z-index: 30;
}

.side-panel {
  background: var(--panel);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 42px rgba(20, 22, 21, 0.12);
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: min(440px, calc(100vw - 28px));
  pointer-events: none;
  position: fixed;
  right: 0;
  top: 0;
  transform: translate3d(100%, 0, 0);
  transition:
    transform var(--motion-panel) var(--ease-apple-spring),
    opacity var(--motion-panel) var(--ease-apple-spring),
    visibility var(--motion-panel) var(--ease-apple-spring);
  visibility: hidden;
  width: 420px;
  z-index: 40;
}

.side-panel.is-open {
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  visibility: visible;
}

.settings-panel {
  width: 720px;
  max-width: min(720px, calc(100vw - 28px));
}

.workflow-content {
  display: grid;
  gap: 18px;
  padding: 18px 20px;
}

.workflow-lead {
  color: #4f5551;
  font-size: 0.92rem;
  line-height: 1.48;
  margin: 0;
}

.workflow-steps {
  display: grid;
  gap: 8px;
}

.workflow-step {
  border-bottom: 1px solid #efefef;
  gap: 10px;
  min-height: 42px;
  padding: 7px 0;
}

.workflow-step:last-child {
  border-bottom: 0;
}

.workflow-step span {
  align-items: center;
  background: #f4f4f4;
  border-radius: 50%;
  color: #5e6460;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 700;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.workflow-step strong {
  font-size: 0.9rem;
  font-weight: 560;
}

.panel-header {
  border-bottom: 1px solid var(--line);
  justify-content: space-between;
  min-height: 70px;
  padding: 14px 16px 12px 20px;
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.2;
  margin: 0;
}

.panel-header p {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 2px 0 0;
}

.panel-close {
  cursor: pointer;
  pointer-events: auto !important;
  position: relative;
  z-index: 20;
}

.panel-close * {
  pointer-events: none !important;
}

.project-form {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
}

.project-form label,
.settings-field {
  display: grid;
  gap: 7px;
}

.project-form label > span,
.settings-label {
  color: #555b57;
  font-size: 0.78rem;
  font-weight: 620;
}

input:not(.auth-email-input):not(.command-palette-input),
.project-form textarea,
.project-form select,
.settings-select {
  background: #f7f7f7;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  height: 38px;
  max-width: 210px;
  min-width: 0;
  outline: 0;
  padding: 0 11px;
  width: 100%;
}

input:focus,
.project-form textarea:focus,
.project-form select:focus,
.settings-select:focus {
  border-color: var(--line-strong);
  background: #ffffff;
}

.project-form input,
.project-form textarea,
.project-form select {
  max-width: none;
}

.project-form textarea {
  height: auto;
  line-height: 1.45;
  min-height: 96px;
  padding: 10px 11px;
  resize: vertical;
}

.project-upload {
  display: grid;
  gap: 10px;
}

.project-upload-copy {
  display: grid;
  gap: 2px;
}

.project-upload-copy span {
  color: #555b57;
  font-size: 0.78rem;
  font-weight: 620;
}

.project-upload-copy small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.file-input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.upload-target {
  align-items: center;
  background: #f7f7f7;
  border: 1px dashed #cfcfcf;
  border-radius: 12px;
  color: #303431;
  display: flex;
  gap: 9px;
  justify-content: center;
  min-height: 48px;
  width: 100%;
}

.upload-target:hover {
  background: #f1f1f1;
  border-color: #bdbdbd;
}

.upload-target .ui-icon {
  height: 17px;
  width: 17px;
}

.project-file-list {
  display: grid;
  gap: 6px;
}

.project-file-list[hidden] {
  display: none;
}

.project-file-row {
  align-items: center;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 36px;
  padding: 0 10px;
}

.project-file-row span {
  color: #303431;
  font-size: 0.82rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-file-row small {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 0.76rem;
}

.check-row {
  color: #303431;
  display: flex;
  gap: 9px;
  min-height: 34px;
}

.check-row input {
  height: 16px;
  width: 16px;
}

.panel-actions {
  border-top: 1px solid var(--line);
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
  padding-top: 14px;
}

.primary-action,
.secondary-action {
  border-radius: 999px;
  font-weight: 620;
  height: 36px;
  padding: 0 15px;
}

.primary-action {
  background: var(--ink);
  border: 1px solid var(--ink);
  color: #ffffff;
}

.secondary-action {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.settings-shell {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  min-height: 0;
}

.settings-nav {
  border-right: 1px solid var(--line);
  display: grid;
  gap: 2px;
  padding: 12px 8px;
}

.settings-nav button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #4f5551;
  font-size: 0.86rem;
  min-height: 34px;
  padding: 0 10px;
  text-align: left;
}

.settings-nav button:hover,
.settings-nav button.is-active {
  background: var(--hover);
  color: var(--ink);
}

.settings-content {
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 70px);
  overflow: auto;
  padding: 16px 20px 24px;
}

.settings-group {
  display: grid;
  gap: 10px;
}

.settings-group h3 {
  font-size: 0.94rem;
  font-weight: 650;
  margin: 0;
}

.settings-row {
  border-bottom: 1px solid #efefef;
  gap: 14px;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 0;
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row-title {
  color: #262a27;
  font-size: 0.88rem;
  font-weight: 540;
}

.settings-row-value {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.switch {
  align-items: center;
  background: #d9dbd7;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  height: 24px;
  padding: 2px;
  width: 42px;
}

.switch::before {
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(20, 22, 21, 0.18);
  content: "";
  height: 20px;
  transform: translateX(0);
  transition: transform var(--motion-fast) var(--ease-spring-snap);
  width: 20px;
}

.switch[aria-pressed="true"] {
  background: var(--accent);
}

.switch[aria-pressed="true"]::before {
  transform: translateX(18px);
}

/* ── Sidebar Toggle Controls & Backdrop ── */
.topbar-sidebar-toggle {
  display: none;
  flex-shrink: 0;
  margin-right: 4px;
}

body.sidebar-collapsed .topbar-sidebar-toggle {
  display: inline-flex;
}

.sidebar-backdrop {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 0.24s ease;
  z-index: 999;
}

/* ══════════════════════════════════
   RESPONSIVE BREAKPOINTS (Mobile & Tablet)
   ══════════════════════════════════ */
@media (max-width: 768px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    width: 100vw;
  }

  .topbar-sidebar-toggle {
    display: inline-flex !important;
  }

  .sidebar {
    bottom: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    height: 100vh;
    height: 100dvh;
    left: 0;
    max-width: 85vw;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.28s var(--ease-apple-spring);
    width: 280px;
    z-index: 1000;
  }

  body.sidebar-mobile-open .sidebar {
    border-right: 1px solid var(--line);
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    width: 280px;
  }

  body.sidebar-mobile-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    gap: 8px;
    padding: 0 12px;
  }

  .project-tree-breadcrumb {
    max-width: calc(100vw - 64px);
    overflow-x: auto;
  }

  .conversation {
    padding: 16px 12px 100px;
  }

  .composer {
    border-radius: 22px;
    width: 100%;
  }

  .composer-tools {
    flex-wrap: wrap;
    gap: 6px;
  }

  .browser-dock {
    height: calc(100vh - 54px);
    height: calc(100dvh - 54px);
    max-width: 100vw;
    top: 54px;
    width: 100vw;
    z-index: 35;
  }
  .composer-tools .picker-button {
    flex: 1 1 calc(33.33% - 6px);
    max-width: none;
    min-width: 0;
  }

  .composer {
    border-radius: 24px;
    padding: 8px;
    width: 100%;
  }

  .composer-row {
    align-items: flex-end;
    flex-wrap: nowrap;
    gap: 4px;
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .composer textarea {
    min-width: 0;
    padding: 10px 2px;
  }

  .composer-trailing .context-picker-button {
    max-width: none;
    min-width: 36px;
    padding: 0 8px;
  }

  .composer-trailing .context-picker-button span {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    width: 0;
  }

  .workspace-surface-header {
    flex-direction: column;
  }

  .workspace-surface-header .secondary-action {
    width: 100%;
  }

  select {
    background: #f7f7f7;
    max-width: none;
  }

  .settings-panel,
  .side-panel {
    max-width: 100vw;
    width: 100vw;
  }
}


  .settings-shell {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .settings-nav button {
    white-space: nowrap;
  }
}

/* ── Obsidian Dark Mode Tokens (macOS Vibrancy) ── */
body.dark-mode {
  --app: #141615;
  --sidebar: #101211;
  --panel: rgba(26, 29, 28, 0.85);
  --hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(255, 255, 255, 0.08);
  --ink: #f0f2f1;
  --muted: #959a97;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 10px 28px rgba(0, 0, 0, 0.4);
  --shadow-float: 0 8px 24px -4px rgba(0, 0, 0, 0.4), 0 20px 48px rgba(0, 0, 0, 0.6);
  background: var(--app);
  color: var(--ink);
}

body.dark-mode .sidebar {
  border-right-color: var(--line);
}

body.dark-mode .icon-button {
  color: #e2e5e3;
}

body.dark-mode .composer textarea {
  color: #f0f2f1;
}

/* ── Spotlight / Command Palette Dialog (⌘K) ── */
.command-palette-dialog {
  background: transparent;
  border: 0;
  margin: auto;
  max-width: 600px;
  outline: none;
  padding: 0;
  width: min(600px, calc(100vw - 32px));
  z-index: 1000;
}

.command-palette-dialog::backdrop {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.45);
}

.command-palette-shell {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.command-palette-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  padding: 14px 18px;
}

.command-palette-input {
  background: transparent;
  border: 0;
  color: var(--ink);
  flex: 1;
  font-size: 1.05rem;
  outline: none;
}

.command-palette-kbd {
  background: var(--hover);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
}

.command-palette-list {
  display: flex;
  flex-direction: column;
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
}

.command-palette-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  padding: 10px 14px;
  text-align: left;
  transition: background-color var(--motion-instant) var(--ease-apple-spring);
  width: 100%;
}

.command-palette-item:hover,
.command-palette-item.is-selected {
  background: var(--hover);
}

.command-palette-item-text {
  display: flex;
  flex-direction: column;
}

.command-palette-item-title {
  font-size: 0.92rem;
  font-weight: 500;
}

.command-palette-item-desc {
  color: var(--muted);
  font-size: 0.78rem;
}

/* ── Apple-Grade Realtime Voice Waveform Overlay ── */
.voice-mode-overlay {
  align-items: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(10, 12, 11, 0.75);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 999;
}

.voice-mode-overlay[hidden] {
  display: none !important;
}

.voice-mode-card {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  max-width: 420px;
  padding: 36px 28px;
  text-align: center;
  width: min(420px, calc(100vw - 40px));
}

.voice-wave-container {
  align-items: center;
  display: flex;
  gap: 6px;
  height: 54px;
  justify-content: center;
  margin-bottom: 20px;
}

.voice-bar {
  animation: voice-pulse 1.2s ease-in-out infinite alternate;
  background: linear-gradient(180deg, #2667f0 0%, #60a5fa 100%);
  border-radius: 999px;
  display: inline-block;
  height: 14px;
  width: 5px;
}

.voice-bar:nth-child(1) { animation-delay: 0.0s; }
.voice-bar:nth-child(2) { animation-delay: 0.2s; }
.voice-bar:nth-child(3) { animation-delay: 0.4s; }
.voice-bar:nth-child(4) { animation-delay: 0.1s; }
.voice-bar:nth-child(5) { animation-delay: 0.3s; }

@keyframes voice-pulse {
  0% { height: 10px; opacity: 0.4; }
  100% { height: 48px; opacity: 1; transform: scaleY(1.1); }
}

/* ── Hierarchical Project Trees & Breadcrumbs ── */
.project-tree-breadcrumb {
  align-items: center;
  border: 0;
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  padding: 4px 16px;
  width: 100%;
}

.breadcrumb-trail {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.breadcrumb-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 500;
  gap: 5px;
  padding: 4px 6px;
  transition: all 0.15s ease;
}

.breadcrumb-item:hover {
  background: var(--hover);
  color: var(--ink);
}

.breadcrumb-item.is-current {
  color: var(--ink);
  cursor: default;
  font-weight: 600;
}

.breadcrumb-item.is-branch {
  color: #10a37f;
}

.breadcrumb-separator {
  color: var(--muted);
  font-size: 0.76rem;
  opacity: 0.5;
  user-select: none;
}

.breadcrumb-actions {
  align-items: center;
  display: flex;
  gap: 6px;
}

.breadcrumb-action-btn {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 550;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  transition: all 0.15s var(--ease-apple-spring);
}

.breadcrumb-action-btn:hover {
  background: var(--hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

/* ══════════════════════════════
   SIDEBAR TREE — Scoped under .sidebar-content-zone
   ══════════════════════════════ */

/* Project container */
.project-tree-container {
  box-sizing: border-box;
  margin-bottom: 4px;
  max-width: 100%;
  overflow: hidden;
  width: 100%;
}

.project-tree-container.is-active-project > .project-tree-header {
  background: transparent;
}

/* Project header row */
.project-tree-header {
  align-items: center;
  border-radius: 8px;
  box-sizing: border-box;
  display: flex;
  height: 32px;
  max-width: 100%;
  overflow: hidden;
  padding: 0 4px 0 6px;
  position: relative;
  transition: background 0.14s ease;
  width: 100%;
}

.project-tree-header:hover {
  background: var(--hover);
}

/* Project name button (takes all available space) */
.project-header-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  box-sizing: border-box;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  flex: 1 1 auto;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 7px;
  height: 28px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 0 4px;
  text-align: left;
}

.project-root-icon {
  color: #8a8d8a;
  flex: 0 0 auto;
  flex-shrink: 0;
}

.project-title-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tree body */
.project-tree-body {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 1px;
  max-width: 100%;
  overflow: hidden;
  width: 100%;
}

/* Generic tree node */
.tree-node {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  width: 100%;
}

/* Tree row (folder or chat line) */
.tree-item-row {
  align-items: center;
  border-radius: 8px;
  box-sizing: border-box;
  display: flex;
  height: 30px;
  max-width: 100%;
  min-height: 30px;
  min-width: 0;
  overflow: hidden;
  padding-right: 4px;
  position: relative;
  transition: background 0.14s ease;
  width: 100%;
}

.tree-item-row:hover {
  background: var(--hover);
}

.tree-item-row.is-active {
  background: var(--sidebar-active, #ebebea);
  font-weight: 580;
}

.tree-item-row.is-branch .branch-icon {
  color: #10a37f;
}

/* Chevron toggle button */
.tree-toggle-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 18px;
  flex-shrink: 0;
  height: 18px;
  justify-content: center;
  margin-right: 1px;
  padding: 0;
  transition: background 0.12s ease, color 0.12s ease;
  width: 18px;
}

.tree-toggle-btn:hover {
  background: rgba(0,0,0,0.07);
  color: var(--ink);
}

.tree-chevron {
  display: block;
  transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.tree-chevron.is-expanded {
  transform: rotate(90deg);
}

/* Icon column */
.tree-item-icon {
  align-items: center;
  color: #9ba09d;
  display: inline-flex;
  flex: 0 0 18px;
  flex-shrink: 0;
  justify-content: center;
  margin-right: 5px;
}

.tree-item-row.is-active .tree-item-icon {
  color: var(--ink);
}

/* Text label span (folders use span, chats use button) */
.tree-item-label {
  color: var(--ink);
  cursor: pointer;
  flex: 1 1 auto;
  font-size: 0.83rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  white-space: nowrap;
}

/* Chat label button */
.tree-item-label-btn {
  align-items: center;
  background: transparent;
  border: 0;
  box-sizing: border-box;
  color: #3c3f3d;
  cursor: pointer;
  display: inline-flex;
  flex: 1 1 auto;
  font-size: 0.83rem;
  height: 26px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  text-align: left;
  transition: color 0.12s ease;
}

.tree-item-row.is-active .tree-item-label-btn {
  color: var(--ink);
  font-weight: 580;
}

.tree-item-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hover-reveal action buttons */
.tree-actions {
  align-items: center;
  display: none;
  flex: 0 0 auto;
  flex-shrink: 0;
  gap: 1px;
  margin-left: auto;
  padding-left: 4px;
}

.project-tree-header:hover .tree-actions,
.tree-item-row:hover .tree-actions {
  display: inline-flex;
}

.tree-action-btn {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 20px;
  flex-shrink: 0;
  height: 20px;
  justify-content: center;
  padding: 0;
  transition: all 0.12s ease;
  width: 20px;
}

.tree-action-btn:hover {
  background: rgba(0,0,0,0.08);
  color: var(--ink);
}

.tree-action-btn.delete-btn:hover {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}

/* Children containers */
.tree-children {
  border-left: 1px solid rgba(0,0,0,0.07);
  margin-left: 14px;
  padding-left: 2px;
}

.tree-branch-children {
  border-left: 1.5px dashed rgba(16,163,127,0.35);
  margin-left: 14px;
  padding-left: 2px;
}

/* Branch suggestion card */
.branch-suggestion-card {
  align-items: flex-start;
  background: #f0fdf9;
  border: 1px solid rgba(16,163,127,0.25);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 16px 12px;
  padding: 12px 14px;
}

.branch-suggestion-card-header {
  align-items: center;
  display: flex;
  gap: 8px;
}

.branch-suggestion-card-icon {
  color: #10a37f;
  flex: 0 0 auto;
}

.branch-suggestion-card-title {
  color: #0d4d3b;
  font-size: 0.84rem;
  font-weight: 600;
}

.branch-suggestion-card-body {
  color: #2e6655;
  font-size: 0.82rem;
  line-height: 1.5;
  padding-left: 24px;
}

.branch-suggestion-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  padding-left: 24px;
}

.branch-suggestion-btn {
  align-items: center;
  background: #10a37f;
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.8rem;
  font-weight: 580;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  transition: background 0.14s ease;
}

.branch-suggestion-btn:hover {
  background: #0e9270;
}

.branch-suggestion-dismiss {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #2e6655;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.8rem;
  height: 30px;
  opacity: 0.7;
  padding: 0 10px;
  transition: opacity 0.14s ease;
}

.branch-suggestion-dismiss:hover {
  opacity: 1;
}

/* ── Claude-Style Suggestive Next Clicks & Action Pills ── */
.suggestive-clicks-container {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestive-clicks-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.suggestive-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.suggestive-pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  color: var(--foreground, #f8fafc);
  font-size: 0.82rem;
  padding: 6px 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
}

.suggestive-pill-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #60a5fa;
  transform: translateY(-1px);
}

.suggestive-pill-btn.more-sug-btn {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-weight: 600;
}

.suggestive-pill-btn.more-sug-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
}

/* ── Context Ceiling & 220+ Apps Modal Shells ── */
.context-ceiling-badge {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

/* ── Starter Command Grid & Welcome Center ── */
.welcome-panel {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

.welcome-header {
  margin-bottom: 32px;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 999px;
  color: #60a5fa;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.welcome-header h1 {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--ink, #ffffff);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.welcome-subtitle {
  color: var(--text-muted, #94a3b8);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.starter-command-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 860px;
  margin-bottom: 36px;
}

.starter-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.starter-card:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.starter-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.starter-card-icon {
  font-size: 1.2rem;
}

.starter-card-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #60a5fa;
}

.starter-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink, #ffffff);
}

.starter-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.4;
}

/* ── Attachment Bar ── */
.composer-attachment-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: 820px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: #e2e8f0;
}

.attachment-pill-remove {
  cursor: pointer;
  color: #94a3b8;
  border: none;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
}

.attachment-pill-remove:hover {
  color: #ef4444;
}

/* ── STRICT AUTH STATE ISOLATION & THEME ── */
body.is-signed-out {
  background: #0d0d0d !important;
  color: #f4f4f5 !important;
}

body.is-signed-out .app-layout {
  background: #0d0d0d !important;
}

body.is-signed-out .chat-app {
  background: #0d0d0d !important;
}

body.is-signed-out .topbar {
  background: #0d0d0d !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.is-signed-out .conversation {
  background: #0d0d0d !important;
}

body.is-signed-out .welcome-panel h1 {
  color: #f4f4f5 !important;
}

body.is-signed-out .sidebar-branding small {
  display: none !important;
}

body.is-signed-out .project-tree-breadcrumb {
  display: none !important;
}

body.is-signed-out .nav-section[data-nav-section="pinned"],
body.is-signed-out .nav-section[data-nav-section="projects"],
body.is-signed-out .nav-section[data-nav-section="chats"] {
  display: none !important;
}

/* Hide feature nav buttons that require sign-in */
body.is-signed-out #imagesButton,
body.is-signed-out #pluginsButton,
body.is-signed-out #deepResearchButton,
body.is-signed-out #libraryButton,
body.is-signed-out #searchChatsNavBtn {
  opacity: 0.35;
  pointer-events: none;
}

body.is-signed-out .auth-header-actions {
  display: flex !important;
}

body.is-signed-out .auth-header-user {
  display: none !important;
}

body.is-signed-out .sidebar-auth-card {
  display: flex !important;
}

body.is-signed-out .user-pill {
  display: none !important;
}

body.is-signed-out .signed-out-footer {
  display: block !important;
}

/* ── Signed-in state ── */
body.is-signed-in .auth-header-actions {
  display: none !important;
}

body.is-signed-in .auth-header-user {
  display: flex !important;
}

body.is-signed-in .sidebar-auth-card {
  display: none !important;
}

body.is-signed-in .user-pill {
  display: flex !important;
}

body.is-signed-in .signed-out-footer {
  display: none !important;
}

/* ── Topbar Model Badge & Auth Header Actions ── */
.topbar-model-select {
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.topbar-model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--ink, #ffffff);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.topbar-model-badge:hover {
  background: rgba(255, 255, 255, 0.06);
}

.auth-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.auth-login-btn {
  background: transparent;
  color: #ececec;
  border: none;
  border-radius: 9999px;
  padding: 7px 16px;
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-login-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.auth-signup-btn {
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: 9999px;
  padding: 7px 16px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-signup-btn:hover {
  background: #e5e5e5;
}

.auth-header-actions[hidden] {
  display: none !important;
}

.auth-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.auth-header-user[hidden] {
  display: none !important;
}

.sidebar-auth-card[hidden] {
  display: none !important;
}

.user-pill[hidden] {
  display: none !important;
}

.user-avatar-tag {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}

.auth-logout-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 72px !important;
  flex-shrink: 0 !important;
}

.auth-logout-btn:hover {
  color: #ef4444;
  border-color: #ef4444;
}

/* ── Sidebar Login Callout Card ── */
.sidebar-auth-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px;
  margin: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-auth-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink, #ffffff);
}

.sidebar-auth-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.35;
}

.sidebar-auth-login-btn {
  width: 100%;
  background: #ffffff;
  color: #000000;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 4px;
}

.sidebar-auth-login-btn:hover {
  background: #e2e8f0;
}

/* ── What Can You Do Pill & Footer ── */
.what-can-you-do-wrap {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.what-can-you-do-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--text-muted, #cbd5e1);
  font-size: 0.84rem;
  padding: 8px 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.what-can-you-do-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.signed-out-footer {
  text-align: center;
  font-size: 0.74rem;
  color: #9ca3af;
  padding: 14px 20px;
  margin-top: auto;
}

.signed-out-footer a {
  color: #cbd5e1;
  text-decoration: underline;
}

body.has-chat .signed-out-footer,
body.has-chat .what-can-you-do-wrap {
  display: none !important;
}

/* ── Auth Dialog Modal ── */
.auth-dialog {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
}

.auth-dialog:not([open]) {
  display: none !important;
}

.auth-dialog[open] {
  display: flex !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 999999 !important;
  box-sizing: border-box !important;
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.auth-dialog-shell {
  background: #212121;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 36px 32px 32px;
  color: #ffffff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  max-width: 440px;
  width: 92vw;
  position: relative;
  z-index: 1000000;
  box-sizing: border-box;
  overflow: hidden;
}

.auth-dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: none;
  color: #8e8e8e;
  font-size: 1.1rem;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-dialog-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.auth-dialog-back {
  position: absolute;
  top: 18px;
  left: 18px;
  background: transparent;
  border: none;
  color: #8e8e8e;
  font-size: 1.25rem;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-dialog-back:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.auth-dialog-back[hidden] {
  display: none !important;
}

.auth-dialog-body {
  text-align: center;
}

.auth-modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

.auth-modal-sub {
  font-size: 0.88rem;
  color: #b4b4b4;
  line-height: 1.45;
  margin: 0 auto 20px auto;
  max-width: 330px;
}

/* Social OAuth Stacked Pills */
.auth-social-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.auth-social-pill {
  width: 100%;
  height: 48px;
  border-radius: 9999px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.auth-social-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

.auth-social-pill .social-icon {
  flex-shrink: 0;
}

/* Subtle Divider */
.auth-divider-line {
  display: flex;
  align-items: center;
  margin: 18px 0;
  width: 100%;
}

.auth-divider-line::before,
.auth-divider-line::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.auth-divider-text {
  padding: 0 14px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #8e8e8e;
  letter-spacing: 0.06em;
}

/* Single Identifier-First Email Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.auth-email-input {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  display: block !important;
  height: 48px !important;
  border-radius: 9999px !important;
  background: #0d0d0d !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  font-size: 0.95rem !important;
  padding: 0 22px !important;
  box-sizing: border-box !important;
  outline: none !important;
  transition: border-color 0.15s ease !important;
}

.auth-email-input:focus {
  border-color: rgba(255, 255, 255, 0.4);
}

.auth-email-input::placeholder {
  color: #71717a;
}

/* Integrated ChatGPT-grade Phone Input Capsule */
.auth-phone-row {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  height: 48px !important;
  border-radius: 9999px !important;
  background: #0d0d0d !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  transition: border-color 0.15s ease !important;
}

.auth-phone-row:focus-within {
  border-color: rgba(255, 255, 255, 0.4) !important;
}

.auth-phone-country-select {
  height: 100% !important;
  border: none !important;
  background: transparent !important;
  color: #ffffff !important;
  padding: 0 10px 0 16px !important;
  outline: none !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  border-right: 1px solid rgba(255, 255, 255, 0.15) !important;
  flex-shrink: 0 !important;
  width: auto !important;
  min-width: 86px !important;
  box-sizing: border-box !important;
}

.auth-phone-country-select option {
  background: #212121 !important;
  color: #ffffff !important;
}

.auth-phone-number-input {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  background: transparent !important;
  color: #ffffff !important;
  font-size: 0.95rem !important;
  padding: 0 16px !important;
  outline: none !important;
  box-sizing: border-box !important;
  border-radius: 0 !important;
}

.auth-phone-number-input::placeholder {
  color: #71717a !important;
}

.auth-continue-btn {
  width: 100%;
  height: 48px;
  border-radius: 9999px;
  background: #ffffff;
  color: #000000;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.auth-continue-btn:hover {
  background: #e5e5e5;
}

.auth-text-link {
  background: transparent;
  border: none;
  color: #10a37f;
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0 2px;
}

.auth-text-link:hover {
  color: #1a7f64;
}

/* Google Account Chooser */
.google-account-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 18px 0 14px;
  text-align: left;
}

.google-account-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.google-account-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.google-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4285F4;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.google-avatar.google-avatar-add {
  background: rgba(255, 255, 255, 0.1);
  color: #a1a1aa;
}

.google-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.google-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.google-email {
  font-size: 0.8rem;
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.google-disclaimer {
  font-size: 0.76rem;
  color: #71717a;
  line-height: 1.4;
  margin-top: 14px;
  text-align: center;
}

/* Multi-step Auth Transitions */
.auth-step[hidden] {
  display: none !important;
}

.auth-user-identity-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  padding: 6px 14px;
  margin-bottom: 20px;
  font-size: 0.84rem;
  color: #ececec;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-back-btn {
  background: transparent;
  border: none;
  color: #8e8e8e;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.auth-back-btn:hover {
  color: #ffffff;
}

.auth-identity-email {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.auth-change-link {
  background: transparent;
  border: none;
  color: #10a37f;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: underline;
  padding: 0;
}

.auth-change-link:hover {
  color: #1a7f64;
}

.auth-error-msg {
  color: #ef4444;
  font-size: 0.82rem;
  text-align: left;
  margin-top: -4px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
}

.auth-secondary-link-btn {
  background: transparent;
  border: none;
  color: #a1a1aa;
  font-size: 0.84rem;
  cursor: pointer;
  padding: 6px 0;
  transition: color 0.15s ease;
  text-align: center;
}

.auth-secondary-link-btn:hover {
  color: #ffffff;
}

/* Authentic ChatGPT 6-Cell OTP Grid */
.auth-otp-cell-group {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  margin: 18px 0 16px !important;
  width: 100% !important;
}

.auth-otp-cell {
  width: 46px !important;
  height: 56px !important;
  border-radius: 12px !important;
  background: #0d0d0d !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  font-size: 1.5rem !important;
  font-weight: 600 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  text-align: center !important;
  outline: none !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  transition: all 0.15s ease !important;
}

.auth-otp-cell:focus,
.auth-otp-cell.is-active {
  border-color: #10a37f !important;
  box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.25) !important;
  background: #141414 !important;
}

.auth-otp-separator {
  width: 8px;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 1px;
  margin: 0 2px;
}

.auth-sms-hint {
  font-size: 0.8rem;
  color: #8e8e8e;
  margin-top: 12px;
  text-align: center;
}

.auth-sms-hint code {
  color: #10a37f;
  background: rgba(16, 163, 127, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: monospace;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .motion-ready button.is-pressing,
  .composer.is-thinking {
    transform: none;
  }
}

/* ── Model Dropdown Popover ── */
.model-dropdown-menu {
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  padding: 6px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.model-dropdown-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #71717a;
  padding: 6px 10px 4px 10px;
}

.model-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  border: none;
  color: #f4f4f5;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.model-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.model-dropdown-item.is-selected {
  background: rgba(59, 130, 246, 0.15);
}

.model-item-info {
  display: flex;
  flex-direction: column;
}

.model-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-item-desc {
  font-size: 0.75rem;
  color: #a1a1aa;
  margin-top: 2px;
}

.model-badge {
  font-size: 0.68rem;
  font-weight: 600;
  background: #27272a;
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.check-icon {
  color: #3b82f6;
  flex-shrink: 0;
}

/* ── Authentic ChatGPT Suggestion Pills & Composer ── */
.chatgpt-suggestions-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  max-width: 760px;
}

.chatgpt-suggestion-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #212121;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  color: #b4b4b4;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chatgpt-suggestion-pill:hover {
  background: #2f2f2f;
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: translateY(-1px);
}

.chatgpt-suggestion-pill .ui-icon {
  color: #9ca3af;
  flex-shrink: 0;
}

.chatgpt-suggestion-pill:hover .ui-icon {
  color: #ffffff;
}

/* ── ChatGPT Omni-Composer Bar Styling ── */
.composer {
  background: #2f2f2f !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 26px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
  padding: 8px 12px !important;
}

.composer:focus-within {
  border-color: rgba(255, 255, 255, 0.35) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35) !important;
}

.composer textarea {
  color: #ececec !important;
  font-size: 1rem !important;
  line-height: 1.5 !important;
}

.composer textarea::placeholder {
  color: #8e8e8e !important;
}

.composer-plus-btn {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 50% !important;
  color: #b4b4b4 !important;
  height: 32px !important;
  width: 32px !important;
  min-height: 32px !important;
  min-width: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  transition: all 0.15s ease !important;
}

.composer-plus-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

.send-button {
  background: #494949 !important;
  border-radius: 50% !important;
  color: #212121 !important;
  height: 32px !important;
  width: 32px !important;
  min-height: 32px !important;
  min-width: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  transition: all 0.15s ease !important;
}

.send-button.is-active,
.composer:not(:has(textarea:placeholder-shown)) .send-button {
  background: #ffffff !important;
  color: #000000 !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

.mic-button {
  color: #b4b4b4 !important;
}

.mic-button:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}
