/* The project editor's "⋯ More" menu (editor-tidy.mjs): the top bar keeps
   Share and Publish, and the rest opens as one list under "⋯ More". The menu
   is fixed to the window (editor-tidy.mjs places it), so a scrolling header
   never clips it. Self-themed: both palettes are set here, so no generated
   light twin is needed. Items use ids so they win over the header's older
   per-button rules (the phone ◆, the square Simulate dot). */
.editor-more {
  --more-ink: #f1eaf2;
  --more-muted: #ab9fb0;
  --more-sheet: #1c1821;
  --more-line: rgba(255,255,255,.1);
  --more-hover: rgba(240,68,145,.14);
  --more-accent: #ff7db5;
  --more-shadow: 0 22px 56px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.03);
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
html[data-theme="light"] .editor-more {
  --more-ink: #2f2430;
  --more-muted: #786a7b;
  --more-sheet: #fffdfe;
  --more-line: #ecdfe8;
  --more-hover: #fff0f7;
  --more-accent: #b0306f;
  --more-shadow: 0 22px 56px rgba(84,37,65,.16), 0 0 0 1px rgba(84,37,65,.05);
}

#editorMoreBtn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#editorMoreBtn[aria-expanded="true"] { border-color: var(--more-accent); color: var(--more-ink); }
.editor-more-dots { font-size: 16px; line-height: 1; letter-spacing: 0; }
/* On a phone the button is just its dots; "More" stays its spoken name. */
@media (max-width: 760px) {
  #editorMoreBtn { width: 36px; min-width: 36px; padding: 0; justify-content: center; }
  #editorMoreBtn .editor-more-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

#editorMoreMenu {
  position: fixed;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: min(260px, calc(100vw - 16px));
  padding: 6px;
  border: 1px solid var(--more-line);
  border-radius: 14px;
  background: var(--more-sheet);
  box-shadow: var(--more-shadow);
  color: var(--more-ink);
}
#editorMoreMenu[hidden] { display: none !important; }

/* Every item is one full-width row: text on the start side, no pill. */
#editorMoreMenu > button,
#editorMoreMenu .collab-avatars > button,
#editorMoreMenu button.editor-simulate-button {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--more-ink) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  text-align: start !important;
  white-space: nowrap !important;
  overflow: visible !important;
  transform: none !important;
}
#editorMoreMenu > button:hover:not(:disabled),
#editorMoreMenu .collab-avatars > button:hover,
#editorMoreMenu button.editor-simulate-button:hover,
#editorMoreMenu > button:focus-visible,
#editorMoreMenu .collab-avatars > button:focus-visible,
#editorMoreMenu button.editor-simulate-button:focus-visible {
  background: var(--more-hover) !important;
  outline: none;
}
#editorMoreMenu > button:disabled { opacity: .45; cursor: not-allowed; }
#editorMoreMenu button.editor-simulate-button .editor-simulate-pulse { flex: 0 0 auto; margin-inline: 5px !important; }

/* Each row gets a small icon in front so the list reads at a glance. */
#editorMoreMenu #collaboratorsBtn::before,
#editorMoreMenu #editorControlCenterBtn::before,
#editorMoreMenu #editorDownloadBtn::before,
#editorMoreMenu .editor-github-button::before {
  display: inline-grid;
  place-items: center;
  width: 18px;
  flex: 0 0 18px;
  color: var(--more-muted);
  font-size: 14px;
}
#editorMoreMenu #collaboratorsBtn::before { content: '◎'; }
#editorMoreMenu #editorControlCenterBtn::before { content: '◆'; }
#editorMoreMenu #editorControlCenterBtn::after { content: none !important; }
#editorMoreMenu #editorDownloadBtn::before { content: '⤓'; }
#editorMoreMenu #editorGithubPushBtn::before { content: '↑'; }
#editorMoreMenu #editorGithubPullBtn::before { content: '↓'; }

/* People: the button and any online teammates (editor-live-team.mjs) on one row. */
#editorMoreMenu .collab-avatars { display: flex !important; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 6px; padding: 0; margin: 0; }
#editorMoreMenu .collab-avatars > button { flex: 1 1 auto; }
#editorMoreMenu .collab-avatars .bh-team-avatars { flex: 0 0 auto; padding-inline-end: 8px; }
/* A line between the project's own tools and code/GitHub. */
#editorMoreMenu #editorDownloadBtn { margin-top: 5px !important; position: relative; }
#editorMoreMenu #editorDownloadBtn::after { content: ''; position: absolute; inset: -4px 6px auto; height: 1px; background: var(--more-line); }
/* The Simulate button only shows for Builder projects (styles.css). */
body:not(.builder-mode) #editorMoreMenu #editorSimulateBtn { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
  #editorMoreMenu:not([hidden]) { animation: editor-more-in .14s ease-out; }
}
@keyframes editor-more-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---- My projects ----------------------------------------------------------
   "＋ New project" is the page's main button at the end of the heading row,
   and on a phone search, filter, sort and view take two rows instead of four.
   Opening My projects scrolls the title to the top; it now stops under the
   floating top bar instead of behind it. */
#projectsTitle { scroll-margin-top: 84px; }
#projectsSection .section-heading { flex-wrap: wrap; align-items: center; row-gap: 12px; }
#projectsSection .section-heading .work-source { flex: 1 1 280px; min-width: 0; }
.main-content #projectsSection #newProjectBtn.project-create-main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
  flex: 0 0 auto;
  border: 1px solid #e44682 !important;
  background: linear-gradient(110deg,#f04491,#e43479) !important;
  color: #fff !important;
  box-shadow: 0 8px 22px rgba(231,54,124,.22);
}
.main-content #projectsSection #newProjectBtn.project-create-main:hover { filter: brightness(1.08) !important; box-shadow: 0 10px 26px rgba(231,54,124,.3); }
.main-content #projectsSection #newProjectBtn.project-create-main:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#projectsSection #newProjectBtn .project-create-icon { font-size: 16px; line-height: 1; color: #fff !important; }
/* Anything else in the folder row (folders, + New folder, Manage folders)
   stays one quiet scrolling line. */
.main-content #projectsSection .folder-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.main-content #projectsSection .folder-bar::-webkit-scrollbar { display: none; }
.main-content #projectsSection .folder-bar .folder-chip { flex: 0 0 auto; white-space: nowrap; }

@media (max-width: 720px) {
  #projectsTitle { scroll-margin-top: 104px; }
  /* The title gets its own row; account and "＋ New project" share the next. */
  #projectsSection .section-heading .work-source { flex: 1 1 100%; }
  #projectsSection .section-heading #projectAccountScope { margin-inline-end: auto; }
  .main-content #projectsSection #newProjectBtn.project-create-main { min-height: 40px; padding: 0 14px; }
  .main-content #projectsSection .library-toolbar,
  body[data-preview-device="mobile"] .main-content #projectsSection .library-toolbar {
    grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto;
    gap: 8px;
  }
  /* Row 1: search and the view buttons. Row 2: status and sort. */
  .main-content #projectsSection .project-toolbar-search,
  body[data-preview-device="mobile"] .main-content #projectsSection .project-toolbar-search { grid-column: 1 / 3; grid-row: 1; }
  .main-content #projectsSection .project-toolbar-view { grid-column: 3 !important; grid-row: 1; }
  .main-content #projectsSection .project-toolbar-select:has(#projectStatusFilter) { grid-column: 1; grid-row: 2; }
  .main-content #projectsSection .project-toolbar-select:has(#projectSort) { grid-column: 2 / 4; grid-row: 2; }
  .main-content #projectsSection .project-toolbar-control,
  .main-content #projectsSection .project-toolbar-view { min-height: 42px; }
  .main-content #projectsSection .project-toolbar-select { grid-template-columns: minmax(0,1fr) auto; padding-inline: 12px 8px; gap: 4px; }
  .main-content #projectsSection .project-toolbar-select > .project-toolbar-icon { display: none; }
  .main-content #projectsSection .project-toolbar-view { width: auto; justify-self: end; gap: 2px; padding: 4px; }
  .main-content #projectsSection .project-toolbar-view button { width: 34px; min-width: 34px; padding: 0; }
}
@media (max-width: 380px) {
  /* The smallest phones: "＋" alone, its words stay its name. */
  .main-content #projectsSection #newProjectBtn.project-create-main { width: 42px; padding: 0; justify-content: center; }
  .main-content #projectsSection #newProjectBtn.project-create-main > span:not(.project-create-icon) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---- The composer's ⚙ ------------------------------------------------------
   The Brain notes choice opens from a small ⚙ in the composer's top corner,
   as a line at the composer's foot (the composer clips anything outside it).
   A dot on the ⚙ shows it is on. */
.editor-shell #editorComposerForm { position: relative; }
.editor-shell #editorComposerForm #editorPrompt { padding-inline-end: 40px; }
.editor-shell button.editor-composer-extras-button {
  position: absolute;
  z-index: 3;
  top: 8px;
  inset-inline-end: 8px;
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  display: grid !important;
  place-items: center;
  padding: 0 !important;
  border: 1px solid transparent !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: #ab9fb0 !important;
  font-size: 15px;
  line-height: 1;
  box-shadow: none !important;
  cursor: pointer;
}
.editor-shell button.editor-composer-extras-button:hover,
.editor-shell button.editor-composer-extras-button[aria-expanded="true"] { border-color: rgba(240,68,145,.4) !important; background: rgba(240,68,145,.12) !important; color: #fff !important; }
.editor-shell button.editor-composer-extras-button:focus-visible { outline: 2px solid #ff7db5; outline-offset: 1px; }
.editor-shell button.editor-composer-extras-button[data-on="true"]::after {
  content: '';
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff4fa3;
  box-shadow: 0 0 0 2px #16121b;
}
.editor-shell .editor-composer-extras {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 10px 2px 2px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.editor-shell .editor-composer-extras[hidden] { display: none !important; }
.editor-shell .editor-composer-extras .agent-brain-consent-row { padding: 0 !important; margin: 0; }
html[data-theme="light"] .editor-shell button.editor-composer-extras-button { color: #786a7b !important; }
html[data-theme="light"] .editor-shell button.editor-composer-extras-button:hover,
html[data-theme="light"] .editor-shell button.editor-composer-extras-button[aria-expanded="true"] { border-color: #dcc6d4 !important; background: #fff0f7 !important; color: #2f2430 !important; }
html[data-theme="light"] .editor-shell button.editor-composer-extras-button[data-on="true"]::after { box-shadow: 0 0 0 2px #fff; }
html[data-theme="light"] .editor-shell .editor-composer-extras { border-top-color: #ecdfe8; }
/* In right-to-left languages the chat launcher sits in the composer's bottom
   left corner; the Brain notes choice keeps clear of it. */
html[dir="rtl"] body.builder-mode .editor-shell .editor-composer-extras { padding-left: 48px; }

/* Chat header on one line: the Chat/Files tabs sit in the header band on the
   start side; the Agent's heart, status and level sit on the end side. The
   name "BaseHeart Agent" stays for screen readers only. --editor-tabs-w is
   the tabs' width (editor-tidy.mjs), so a long status never runs under them. */
body.builder-mode .editor-chat-panel > .builder-agent-header {
  min-height: 48px !important;
  display: flex !important;
  justify-content: flex-end;
  gap: 8px;
  padding-block: 8px !important;
  padding-inline: calc(var(--editor-tabs-w, 150px) + 18px) 12px !important;
}
body.builder-mode .builder-agent-header .builder-agent-core { order: 1; width: 22px; height: 22px; border-radius: 8px; flex: none; }
body.builder-mode .builder-agent-header .builder-agent-core::before { font-size: 11px; }
body.builder-mode .builder-agent-header .builder-agent-core i { display: none; }
body.builder-mode .builder-agent-header .builder-agent-identity { order: 2; min-width: 0; display: block; }
body.builder-mode .builder-agent-header .builder-agent-identity strong {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
body.builder-mode .builder-agent-header .builder-agent-status {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650;
}
body.builder-mode .builder-agent-header .builder-agent-header-meta { order: 3; flex: none; }
body.builder-mode .editor-chat-panel > .editor-panel-tabs {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  width: max-content;
  height: 48px;
  margin-top: -49px;
  align-items: center;
  padding-block: 0 !important;
  border-bottom: 0 !important;
  background: transparent !important;
}

/* Starting ideas in an empty project's chat (builder-editor.mjs). */
.builder-empty-ideas { display: grid; gap: 8px; margin-top: 8px; }
.editor-shell button.builder-empty-idea {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 44px; padding: 9px 12px;
  border: 1px solid rgba(240,68,145,.22) !important; border-radius: 12px;
  background: rgba(240,68,145,.06) !important;
  color: var(--bh-text, #f4f1f6) !important;
  font: inherit; font-size: 13px; font-weight: 600; text-align: start; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}
.editor-shell button.builder-empty-idea:hover,
.editor-shell button.builder-empty-idea:focus-visible { border-color: rgba(240,68,145,.5) !important; background: rgba(240,68,145,.12) !important; transform: translateY(-1px); }
.builder-empty-idea-icon { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.06); font-size: 14px; }
html[data-theme="light"] .editor-shell button.builder-empty-idea { border-color: #f1c9dc !important; background: #fff5fa !important; color: #2f2430 !important; }
html[data-theme="light"] .editor-shell button.builder-empty-idea:hover,
html[data-theme="light"] .editor-shell button.builder-empty-idea:focus-visible { border-color: #e48ab4 !important; background: #ffeaf4 !important; }
html[data-theme="light"] .builder-empty-idea-icon { background: #ffffff; box-shadow: 0 1px 2px rgba(60,20,45,.08); }
@media (prefers-reduced-motion: reduce) { .editor-shell button.builder-empty-idea { transition: none; } .editor-shell button.builder-empty-idea:hover { transform: none; } }

/* A new, empty project's preview: where the app will appear. */
.builder-preview-status.builder-preview-fresh strong { color: var(--bh-text, #f7f4fa); font-size: 18px; }
.builder-preview-fresh-mark {
  width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 4px;
  border: 1px solid rgba(240,68,145,.3); border-radius: 18px;
  background: radial-gradient(circle at 50% 35%, rgba(240,68,145,.22), rgba(240,68,145,.05));
  color: #f04491; font-size: 24px; box-shadow: 0 0 36px rgba(240,68,145,.18);
}
html[data-theme="light"] .builder-preview-status.builder-preview-fresh strong { color: #2f2430; }

/* My projects: each card says where the project stands and when it was last
   changed (project-card-preview.mjs), and a last card starts a new project. */
.project-meta .project-card-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; font-size: 11.5px; line-height: 1.3; }
.project-meta .project-card-sub span { font-size: 11.5px; }
.project-meta .project-card-status { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--bh-muted, #aaa4b3); }
.project-meta .project-card-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.project-meta .project-card-status[data-status="live"] { color: #7fd6a0; }
.project-meta .project-card-status[data-status="live"]::before { opacity: 1; box-shadow: 0 0 0 3px rgba(127,214,160,.16); }
.project-meta .project-card-status[data-status="ready"] { color: #aebff0; }
.project-meta .project-card-status[data-status="attention"] { color: #f2b36b; }
.project-meta .project-card-time:empty { display: none; }
.project-meta .project-card-time { color: var(--bh-muted-2, #8d8796); }
html[data-theme="light"] .project-meta .project-card-status { color: #6d6070; }
html[data-theme="light"] .project-meta .project-card-status[data-status="live"] { color: #1f8a4c; }
html[data-theme="light"] .project-meta .project-card-status[data-status="ready"] { color: #3c5bb0; }
html[data-theme="light"] .project-meta .project-card-status[data-status="attention"] { color: #a35f12; }
html[data-theme="light"] .project-meta .project-card-time { color: #85788a; }

.project-grid button.project-create-card {
  min-width: 0; min-height: 228px;
  display: grid; place-content: center; justify-items: center; gap: 6px; padding: 20px;
  border: 1.5px dashed rgba(240,68,145,.34) !important; border-radius: 14px;
  background: rgba(240,68,145,.035) !important;
  color: var(--bh-text, #f4f1f6) !important; text-align: center; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}
.project-grid button.project-create-card:hover,
.project-grid button.project-create-card:focus-visible { border-color: rgba(240,68,145,.7) !important; background: rgba(240,68,145,.08) !important; transform: translateY(-2px); }
.project-create-card-icon {
  width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 4px;
  border-radius: 14px; background: linear-gradient(135deg, #f04491, #c13ad8); color: #fff; font-size: 22px; font-weight: 700;
  box-shadow: 0 8px 22px rgba(240,68,145,.28);
}
.project-create-card strong { font-size: 14px; }
.project-create-card small { color: var(--bh-muted, #aaa4b3); font-size: 12px; }
.project-grid.list-view button.project-create-card { min-height: 64px; grid-auto-flow: column; justify-content: start; align-items: center; gap: 12px; padding: 12px 16px; text-align: start; }
.project-grid.list-view .project-create-card-icon { width: 36px; height: 36px; margin: 0; font-size: 18px; }
#projectGrid.bh-galaxy > .project-create-card { display: none; }
html[data-theme="light"] .project-grid button.project-create-card { border-color: #eab3cd !important; background: #fff7fb !important; color: #2f2430 !important; }
html[data-theme="light"] .project-grid button.project-create-card:hover,
html[data-theme="light"] .project-grid button.project-create-card:focus-visible { border-color: #e06aa3 !important; background: #ffeef6 !important; }
html[data-theme="light"] .project-create-card small { color: #7a6b7d; }
@media (prefers-reduced-motion: reduce) { .project-grid button.project-create-card { transition: none; } .project-grid button.project-create-card:hover { transform: none; } }

/* Composer controls on one row: Agent level, Premium and Build. The Heart
   balance and the price for the message share one quiet line under them. */
body.builder-mode .editor-shell .editor-composer-footer { grid-template-columns: minmax(0,1fr) auto auto !important; row-gap: 4px !important; }
body.builder-mode .editor-shell .editor-composer-footer #buildLevel { grid-column: 1 !important; grid-row: 1 !important; width: 100% !important; max-width: none !important; }
body.builder-mode .editor-shell .editor-composer-footer .agent-premium-switch { grid-column: 2 !important; grid-row: 1 !important; width: auto !important; min-height: 34px; padding-inline: 10px !important; }
body.builder-mode .editor-shell .editor-composer-footer #editorSendBtn { grid-column: 3 !important; grid-row: 1 !important; min-width: 92px; padding-inline: 16px !important; }
body.builder-mode .editor-shell .editor-composer-footer #editorHeartBalance { grid-column: 1 !important; grid-row: 2 !important; justify-self: start; width: auto !important; min-height: 24px !important; height: auto !important; padding: 2px 8px !important; font-size: 11.5px !important; }
body.builder-mode .editor-shell .editor-composer-footer .editor-heart-estimate { grid-column: 2 / 4 !important; grid-row: 2 !important; flex: none !important; justify-self: end; padding-inline: 0 4px !important; white-space: nowrap !important; text-align: end !important; font-size: 11px; }
