/* Boltbar's panel, recreated for the web. Measurements follow Views.swift. */
.bb {
  --bb-secondary: color-mix(in srgb, var(--bb-text) 56%, transparent);
  --bb-surface: color-mix(in srgb, var(--bb-text) 6%, transparent);
  --bb-border: color-mix(in srgb, var(--bb-text) 12%, transparent);
  --bb-mono: ui-monospace, "SF Mono", SFMono-Regular, "Geist Mono", Menlo, monospace;
  --bb-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Geist", system-ui, sans-serif;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 700px;
  max-width: 100%;
  padding: 9px 16px 14px;
  border-radius: 19px;
  background: var(--bb-bg);
  color: var(--bb-text);
  font-family: var(--bb-mono);
  text-align: left;
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.28),
    0 24px 70px -18px rgba(0, 0, 0, 0.55),
    0 8px 22px -10px rgba(0, 0, 0, 0.35);
  -webkit-font-smoothing: antialiased;
}
.bb button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
.bb [hidden] {
  display: none !important;
}
.bb-move {
  height: 12px;
  flex: none;
}
.bb-flex {
  flex: 1;
}

/* The newest text stays in view; older text slides up and out. */
.bb-thread-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bb-thread {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  overflow: hidden;
}
.bb-msg {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 6px 0;
  flex: none;
}
.bb-msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
}
.bb-label,
.bb-badge {
  font: 600 9px/1 var(--bb-mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--bb-secondary);
}
.bb-badge {
  padding: 2px 5px;
  border: 1px solid color-mix(in srgb, var(--bb-text) 25%, transparent);
  border-radius: 4px;
}
.bb-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font: 14px/20px var(--bb-sans);
}
.bb-p {
  margin: 0;
}
.bb-p code {
  font: 12.5px var(--bb-mono);
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--bb-surface);
}
.bb-pending {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 13px var(--bb-mono);
  color: var(--bb-secondary);
}
.bb-spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.6px solid var(--bb-border);
  border-top-color: var(--bb-secondary);
  animation: bb-spin 0.8s linear infinite;
}
@keyframes bb-spin {
  to {
    transform: rotate(360deg);
  }
}
.bb-code {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: var(--bb-surface);
}
.bb-code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 10px var(--bb-mono);
  color: var(--bb-secondary);
}
.bb-pre {
  margin: 0;
  font: 12px/1.5 var(--bb-mono);
  white-space: pre;
  overflow-x: auto;
  scrollbar-width: none;
}
.bb-kw {
  color: var(--bb-kw);
}
.bb-num {
  color: var(--bb-num);
}
.bb-str {
  color: var(--bb-str);
}
.bb-com {
  color: var(--bb-com);
}
.bb-divider {
  height: 1px;
  flex: none;
  background: var(--bb-border);
}

/* Queue */
.bb-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bb-surface);
  box-shadow: inset 0 0 0 1px var(--bb-border);
}
.bb-queue-head,
.bb-queue-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
}
.bb-queue-status {
  font: 10px var(--bb-mono);
  color: var(--bb-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bb .bb-send-now {
  font: 500 11px/22px var(--bb-mono);
  color: var(--bb-accent);
  padding: 0 8px;
  border-radius: 6px;
  white-space: nowrap;
  background: color-mix(in srgb, var(--bb-accent) 12%, transparent);
}
.bb-queue-row {
  font: 12px var(--bb-mono);
}
.bb-queue-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.bb .bb-queue-remove {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--bb-secondary);
}

/* Composer */
.bb-composer {
  position: relative;
  min-height: 26px;
  padding-top: 2px;
  font: 15px/22px var(--bb-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bb-placeholder {
  color: #8e8e93;
}
.bb-caret {
  display: inline-block;
  width: 2px;
  height: 18px;
  margin-right: 1px;
  vertical-align: -3px;
  background: var(--bb-accent);
}
.bb-input {
  display: block;
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: inherit;
  font: inherit;
  caret-color: var(--bb-accent);
  overflow-y: auto;
}
.bb-input::placeholder {
  color: #8e8e93;
  opacity: 1;
}
.bb-hint {
  position: absolute;
  top: 4px;
  right: 0;
  font: 11px var(--bb-mono);
  color: var(--bb-secondary);
  pointer-events: none;
}

/* Toolbar */
.bb-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 31px;
}
.bb-circle {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bb-surface);
}
.bb-chip-wrap {
  position: relative;
  min-width: 0;
}
.bb .bb-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 29px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--bb-surface);
  font: 500 12px/1 var(--bb-mono);
  white-space: nowrap;
  box-shadow: inset 0 0 0 1.5px transparent;
}
.bb .bb-chip.on {
  box-shadow: inset 0 0 0 1.5px var(--bb-accent);
}
.bb-model {
  display: inline-grid;
  min-width: 0;
  overflow: hidden;
}
.bb-model > span {
  grid-area: 1 / 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bb-gauge {
  display: flex;
  flex: none;
}
.bb .bb-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--bb-secondary);
}
.bb .bb-globe.on {
  color: var(--bb-accent);
  background: color-mix(in srgb, var(--bb-accent) 12%, transparent);
}
.bb .bb-send,
.bb .bb-stop2 {
  display: grid;
  place-items: center;
  flex: none;
  width: 31px;
  height: 31px;
  border-radius: 50%;
}
.bb .bb-send {
  background: var(--bb-accent);
  color: var(--bb-on-accent);
}
.bb .bb-stop2 {
  background: var(--bb-surface);
}

/* Model popover */
.bb-popover {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 280px;
  padding: 16px;
  border-radius: 12px;
  background: var(--bb-bg);
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.3),
    0 18px 50px -12px rgba(0, 0, 0, 0.5);
}
.bb-popover::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 40px;
  border: 8px solid transparent;
  border-top-color: var(--bb-bg);
}
.bb-pop-title {
  font: 500 12px var(--bb-mono);
}
.bb-segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: var(--bb-surface);
}
.bb .bb-segmented button {
  flex: 1;
  padding: 7px 0;
  border-radius: 6px;
  font: 500 12px var(--bb-mono);
  color: color-mix(in srgb, var(--bb-text) 60%, transparent);
}
.bb .bb-segmented button.on {
  color: var(--bb-accent);
  background: color-mix(in srgb, var(--bb-accent) 14%, transparent);
}
.bb-pop-divider {
  height: 1px;
  background: var(--bb-border);
}
.bb-models {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 230px;
  overflow-y: auto;
}
.bb .bb-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 6px;
  border-radius: 6px;
  font: 12px var(--bb-mono);
  text-align: left;
}
.bb .bb-model-row:hover {
  background: var(--bb-surface);
}
.bb .bb-model-row svg {
  color: var(--bb-accent);
}
.bb-model-provider {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  color: var(--bb-secondary);
}

/* Previous chats (HistoryView.swift) */
.bb-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bb-history-head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
}
.bb .bb-back,
.bb .bb-new {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
}
.bb-history-title {
  font: 600 14px var(--bb-mono);
}
.bb-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding-left: 7px;
  font: 12px var(--bb-mono);
}
.bb-search::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: var(--bb-border);
}
.bb-prompt {
  width: 18px;
  font: 500 15px var(--bb-mono);
  color: var(--bb-accent);
}
.bb-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  caret-color: var(--bb-accent);
}
.bb-search-input::placeholder,
.bb-search-placeholder {
  color: #8e8e93;
  opacity: 1;
}
.bb-search .bb-caret {
  height: 14px;
  vertical-align: -2px;
}
.bb-history-list {
  position: relative;
  margin-top: 6px;
  overflow-y: auto;
  scrollbar-width: none;
}
.bb-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 8px;
  cursor: pointer;
}
.bb-row.on::before {
  content: "";
  position: absolute;
  inset: 2px 0;
  z-index: -1;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bb-text) 9%, transparent);
}
.bb-row-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 500 12px var(--bb-mono);
}
.bb-row-date {
  flex: none;
  font: 11px var(--bb-mono);
  color: color-mix(in srgb, var(--bb-text) 60%, transparent);
}
.bb-row-date.warn {
  color: #e79891;
}
.bb-history-list {
  isolation: isolate;
}
.bb-history-empty {
  padding-top: 20px;
  text-align: center;
  font: 12px var(--bb-mono);
  color: var(--bb-secondary);
}
.bb-history-hint {
  font: 10px var(--bb-mono);
  color: var(--bb-secondary);
}

/* Agent mode: the chip, its popover, step lines, approvals, commands, help. */
.bb-agent-wrap {
  position: relative;
  flex: none;
}
.bb .bb-agent-off {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 30px;
  height: 30px;
  padding: 0 7.5px;
  border-radius: 999px;
  background: var(--bb-surface);
  color: var(--bb-secondary);
  box-shadow: inset 0 0 0 1.5px transparent;
}
.bb .bb-agent-off.on {
  padding: 0 11px;
  color: var(--bb-accent);
  box-shadow: inset 0 0 0 1.5px var(--bb-accent);
}
.bb-agent {
  display: flex;
  align-items: stretch;
  height: 29px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bb-surface);
  color: var(--bb-accent);
  font: 500 12px/1 var(--bb-mono);
  white-space: nowrap;
  box-shadow: inset 0 0 0 1.5px transparent;
}
.bb-agent.on {
  box-shadow: inset 0 0 0 1.5px var(--bb-accent);
}
.bb .bb-agent-switch,
.bb .bb-agent-project {
  display: flex;
  align-items: center;
  gap: 7px;
}
.bb .bb-agent-switch {
  padding: 0 6px 0 11px;
}
.bb .bb-agent-project {
  padding: 0 11px 0 5px;
}
.bb .bb-agent-switch:hover {
  background: color-mix(in srgb, var(--bb-text) 8%, transparent);
}
.bb .bb-agent-project:hover {
  background: color-mix(in srgb, var(--bb-text) 6%, transparent);
}
.bb-agent-name {
  display: inline-grid;
  max-width: 180px;
  overflow: hidden;
}
.bb-agent-name > span {
  grid-area: 1 / 1;
}
.bb-agent-hint {
  font: 500 12px/1 var(--bb-mono);
}
.bb-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bb-ask);
}
.bb-dot.look, .bb-agent-hint.look { --c: var(--bb-look); }
.bb-dot.ask, .bb-agent-hint.ask { --c: var(--bb-ask); }
.bb-dot.edit, .bb-agent-hint.edit { --c: var(--bb-edit); }
.bb-dot.full, .bb-agent-hint.full, .bb-agent-hint.error { --c: var(--bb-full); }
.bb-dot { background: var(--c, var(--bb-ask)); }
.bb-agent-hint { color: var(--c, var(--bb-accent)); }
.bb-agent-off .bb-agent-hint { color: inherit; }
.bb-dim {
  color: var(--bb-secondary);
}

.bb-agent-popover {
  width: 320px;
  gap: 10px;
  padding: 14px;
}
.bb-agent-popover::after {
  left: var(--arrow, 28px);
}
.bb-pop-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font: 11px var(--bb-mono);
}
.bb-projects {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bb .bb-project-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 6px;
  font: 12px var(--bb-mono);
  text-align: left;
}
.bb .bb-project-row.on {
  background: color-mix(in srgb, var(--bb-text) 7%, transparent);
}
.bb .bb-project-row svg {
  margin-left: auto;
  color: var(--bb-accent);
}
.bb-project-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.bb-project-path {
  font-size: 9px;
  color: var(--bb-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bb-project-path.warn,
.bb-pop-summary.warn {
  color: var(--bb-full);
}
.bb-add-folder {
  display: flex;
  justify-content: space-between;
  padding: 6px;
  font: 11px var(--bb-mono);
}
.bb .bb-levels button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.bb .bb-levels button.on {
  color: var(--bb-text);
  background: color-mix(in srgb, var(--bb-text) 9%, transparent);
}
.bb-pop-summary {
  font: 10px/1.45 var(--bb-mono);
  color: var(--bb-secondary);
}
.bb .bb-pop-action {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font: 11px var(--bb-mono);
  text-align: left;
}

.bb-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 2px;
  font: 12px/1.35 var(--bb-mono);
}
.bb-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: color-mix(in srgb, var(--bb-text) 75%, transparent);
}
.bb-step.running {
  color: var(--bb-text);
}
.bb-step-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 14px;
  color: var(--bb-secondary);
}
.bb-step.failed .bb-step-icon {
  color: var(--bb-error);
}
.bb-step-icon .bb-spinner {
  width: 10px;
  height: 10px;
}
.bb-step-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bb-step.denied .bb-step-title {
  text-decoration: line-through;
}
.bb-step-detail {
  flex: none;
  color: var(--bb-secondary);
}

.bb-approval {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bb-accent) 8%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bb-accent) 35%, transparent);
  font: 12px var(--bb-mono);
}
.bb-approval-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.bb-approval-subject {
  color: var(--bb-accent);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.bb-approval-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bb .bb-approval-buttons button {
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--bb-text) 7%, transparent);
  font: 500 11px/22px var(--bb-mono);
}
.bb .bb-approval-buttons button span {
  color: var(--bb-secondary);
}
.bb .bb-approval-buttons button.on {
  background: color-mix(in srgb, var(--bb-accent) 30%, transparent);
}

.bb-slash {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bb .bb-slash-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  font: 12px var(--bb-mono);
  text-align: left;
}
.bb .bb-slash-row.on {
  background: var(--bb-surface);
}
.bb-slash-cmd {
  color: var(--bb-accent);
}
.bb-slash-sum {
  color: var(--bb-secondary);
}

.bb-notice {
  padding: 8px;
  border-radius: 6px;
  background: var(--bb-surface);
  font: 12px/1.45 var(--bb-mono);
  color: var(--bb-secondary);
  overflow-wrap: anywhere;
}

.bb-help {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}
.bb-help-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 11px var(--bb-mono);
}
.bb .bb-help-back {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}
.bb-help-body {
  max-height: 330px;
  overflow-y: auto;
  font: 14px/1.5 var(--bb-sans);
}
.bb-help-body .bb-p {
  margin: 0 0 8px;
}
.bb-h {
  margin: 12px 0 6px;
  font: 600 15px var(--bb-sans);
}
.bb-h:first-child {
  margin-top: 0;
}
.bb-keys {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin-bottom: 8px;
  font-size: 13px;
}
.bb-keys-k {
  font-family: var(--bb-mono);
  white-space: nowrap;
}

/* + unrolls the globe and previous chats: on hover in the page (opening after
   120 ms, closing after 400 ms, as in the app), from props in the trailer. */
.bb-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  --reveal: 0;
}
.bb .bb-plus {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bb-surface);
}
.bb-plus svg {
  transition: transform 0.28s cubic-bezier(0.3, 1.25, 0.5, 1) 0.4s;
}
.bb-tools .bb-globe,
.bb-tools .bb-clock {
  max-width: calc(var(--reveal) * 30px);
  opacity: var(--reveal);
  transform: translateX(calc((1 - var(--reveal)) * -8px));
  overflow: hidden;
}
.bb:not(.bb-static) .bb-tools .bb-globe,
.bb:not(.bb-static) .bb-tools .bb-clock {
  max-width: 0;
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
  transition: max-width 0.28s ease 0.4s, opacity 0.2s ease 0.4s, transform 0.28s ease 0.4s;
}
.bb:not(.bb-static) .bb-tools:hover .bb-globe,
.bb:not(.bb-static) .bb-tools:hover .bb-clock,
.bb:not(.bb-static) .bb-tools:focus-within .bb-globe,
.bb:not(.bb-static) .bb-tools:focus-within .bb-clock,
.bb:not(.bb-static) .bb-tools.pinned .bb-globe {
  max-width: 30px;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition-delay: 0.12s;
}
.bb:not(.bb-static) .bb-tools:hover .bb-plus svg,
.bb:not(.bb-static) .bb-tools:focus-within .bb-plus svg {
  transform: rotate(90deg);
  transition-delay: 0.12s;
}
.bb-static .bb-plus svg {
  transition: none;
}
.bb .bb-globe:disabled {
  opacity: 0.35;
}
@media (prefers-reduced-motion: reduce) {
  .bb-plus svg,
  .bb:not(.bb-static) .bb-tools .bb-globe,
  .bb:not(.bb-static) .bb-tools .bb-clock {
    transition: none !important;
  }
}

/* Narrow screens keep the controls that matter. */
@container bar (max-width: 420px) {
  .bb {
    padding-inline: 12px;
  }
  .bb .bb-clock {
    display: none;
  }
  .bb-agent-name {
    max-width: 90px;
  }
  .bb .bb-chip {
    gap: 6px;
    padding: 0 9px;
  }
}
