Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

112 KB
Raw Blame
/* WebBrain Side Panel Styles */

/* Theme tokens — dark defaults on :root, cream-light overrides on
   :root[data-theme="light"]. The theme bootstrap in sidepanel.html /
   settings.html sets the attribute before first paint to avoid FOUC.
   Hardcoded rgba(255,255,255,*) tints across the file moved to --tint-*
   tokens so they invert per theme. */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --bg-input: #1e2746;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;
  --accent: #6c63ff;
  --accent-hover: #5a52d5;
  --accent-dim: rgba(108, 99, 255, 0.15);
  --promotion-action-accent: #4db5f9;
  --success: #4caf50;
  --warning: #ff9800;
  --error: #f44336;
  --error-soft: #ff8a80;
  --destructive-action: #c5363c;
  --destructive-action-hover: #a92d33;
  --border: rgba(255, 255, 255, 0.08);
  --tint-soft: rgba(255, 255, 255, 0.05);
  --tint-soft-2: rgba(255, 255, 255, 0.04);
  --tint-medium: rgba(255, 255, 255, 0.08);
  --overlay-bg: rgba(0, 0, 0, 0.30);
  --overlay-bg-strong: rgba(0, 0, 0, 0.40);
  --syntax-comment: #8796a5;
  --syntax-keyword: #c792ea;
  --syntax-string: #c3e88d;
  --syntax-number: #f78c6c;
  --syntax-function: #82aaff;
  --syntax-property: #80cbc4;
  --syntax-tag: #f07178;
  --syntax-constant: #ffcb6b;
  --syntax-operator: #89ddff;
  --syntax-variable: #f78c6c;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg-primary: #f7f1e6;       /* warm cream — main panel background */
  --bg-secondary: #fffdf8;     /* cards, message bubbles */
  --bg-tertiary: #ebe0c9;      /* deeper cream — section dividers */
  --bg-input: #fdf6e0;         /* input fields */
  --text-primary: #2c1810;     /* espresso */
  --text-secondary: #6b5b47;   /* mocha */
  --text-muted: #9b8c75;       /* lighter mocha */
  --accent: #5b52e8;
  --accent-hover: #4a42c4;
  --accent-dim: rgba(91, 82, 232, 0.12);
  --promotion-action-accent: #116f9f;
  --success: #2d8866;
  --warning: #b97a00;
  --error: #c5363c;
  --error-soft: #b04349;
  --border: rgba(89, 55, 25, 0.15);
  --tint-soft: rgba(89, 55, 25, 0.05);
  --tint-soft-2: rgba(89, 55, 25, 0.07);
  --tint-medium: rgba(89, 55, 25, 0.10);
  --overlay-bg: rgba(89, 55, 25, 0.10);
  --overlay-bg-strong: rgba(89, 55, 25, 0.18);
  --syntax-comment: #776b5d;
  --syntax-keyword: #7138a8;
  --syntax-string: #2f7135;
  --syntax-number: #a94e13;
  --syntax-function: #2457a7;
  --syntax-property: #08737d;
  --syntax-tag: #b4233c;
  --syntax-constant: #8a5a00;
  --syntax-operator: #0e6f7d;
  --syntax-variable: #a23e48;
  --shadow: 0 2px 8px rgba(89, 55, 25, 0.10);
  color-scheme: light;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 100%;
  /* `vh` is not adjusted for `zoom`, so the height is pre-divided by the zoom
     factor; the percentage width already resolves in the zoomed space. */
  height: var(--ui-scale-height, 100vh);
  zoom: var(--ui-scale-zoom, 1);
  overflow: hidden;
}

html[data-ui-scale-ready="false"] body { visibility: hidden; }

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ==========================================================================
   ONBOARDING OVERLAY — first-launch wizard
   ========================================================================== */

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.onboarding.hidden {
  display: none;
}

.new-conversation-confirm {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: var(--overlay-bg-strong);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.16s ease;
}

.new-conversation-confirm.hidden {
  display: none;
}

.new-conversation-confirm-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px 12px;
  align-items: start;
  width: min(100%, 340px);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-secondary);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.30);
}

.new-conversation-confirm-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--error) 14%, transparent);
  color: var(--error-soft);
}

.new-conversation-confirm-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.new-conversation-confirm-copy {
  min-width: 0;
}

.new-conversation-confirm-card h2 {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.new-conversation-confirm-copy p {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.new-conversation-confirm-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr);
  gap: 8px;
}

.new-conversation-confirm-actions button {
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.new-conversation-confirm-actions button:active {
  transform: scale(0.98);
}

.new-conversation-confirm-actions button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 2px;
}

.new-conversation-confirm-actions .new-conversation-confirm-cancel {
  border-color: var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
}

.new-conversation-confirm-actions .new-conversation-confirm-cancel:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.new-conversation-confirm-actions .new-conversation-confirm-accept {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--destructive-action);
  color: #fff;
}

.new-conversation-confirm-action-label {
  font-size: 12px;
  font-weight: 750;
  line-height: 1.15;
}

.new-conversation-confirm-action-warning {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.1;
}

.new-conversation-confirm-actions .new-conversation-confirm-accept:hover {
  background: var(--destructive-action-hover);
}

@media (max-width: 340px) {
  .new-conversation-confirm-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .new-conversation-confirm {
    animation: none;
  }

  .new-conversation-confirm-actions button {
    transition: none;
  }
}

/* "Dangerously skip permissions" dialog, opened from a permission card.
   Laid out like the new-conversation confirm above, with a close button. */
.permission-skip-dialog {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: var(--overlay-bg-strong);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.16s ease;
}

.permission-skip-dialog.hidden {
  display: none;
}

.permission-skip-dialog-card {
  position: relative;
  /* Long translations on a short panel scroll inside the card. */
  max-height: 100%;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px 12px;
  align-items: start;
  width: min(100%, 340px);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-secondary);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.30);
}

.permission-skip-dialog-close {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.permission-skip-dialog-close:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.permission-skip-dialog-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.permission-skip-dialog-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--error) 14%, transparent);
  color: var(--error-soft);
}

.permission-skip-dialog-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.permission-skip-dialog-copy {
  min-width: 0;
  padding-inline-end: 18px;
}

.permission-skip-dialog-card h2 {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.permission-skip-dialog-copy p {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.permission-skip-dialog-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.permission-skip-dialog-actions button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.permission-skip-dialog-actions button:active {
  transform: scale(0.98);
}

.permission-skip-dialog-actions button:focus-visible,
.permission-skip-dialog-close:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 2px;
}

.permission-skip-dialog-action-label {
  font-size: 12px;
  font-weight: 750;
  line-height: 1.15;
}

.permission-skip-dialog-action-hint {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  opacity: 0.85;
}

.permission-skip-dialog-actions .permission-skip-dialog-session {
  border-color: var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
}

.permission-skip-dialog-actions .permission-skip-dialog-session:hover {
  border-color: var(--warning);
}

.permission-skip-dialog-actions .permission-skip-dialog-forever {
  background: var(--destructive-action);
  color: #fff;
}

.permission-skip-dialog-actions .permission-skip-dialog-forever:hover {
  background: var(--destructive-action-hover);
}

@media (max-width: 340px) {
  .permission-skip-dialog-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .permission-skip-dialog {
    animation: none;
  }

  .permission-skip-dialog-actions button {
    transition: none;
  }
}

.ob-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: auto;
  padding-block: 16px;
}

.ob-step-indicator {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
}

.ob-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s, transform 0.3s;
}

.ob-step-dot.active {
  background: var(--accent);
  transform: scale(1.25);
}

.ob-step-dot.done {
  background: var(--success);
}

.ob-step {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeIn 0.25s ease;
}

.ob-step.active {
  display: flex;
}

.ob-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  color: var(--accent);
}
.ob-brand-logo { width: 48px; height: 48px; border-radius: 12px; display: block; }

.ob-icon-warn {
  background: rgba(255, 152, 0, 0.12);
  color: var(--warning);
}

.ob-icon-key {
  background: rgba(76, 175, 80, 0.12);
  color: var(--success);
}

.ob-step h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.ob-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.ob-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.ob-browser-pin-note {
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-secondary));
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
  text-align: left;
}

.ob-permission-note {
  margin-top: 12px;
  line-height: 1.5;
}

.ob-warn-list,
.ob-provider-list {
  text-align: left;
  width: 100%;
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ob-warn-list li {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  padding: 10px 12px;
  background: rgba(255, 152, 0, 0.08);
  border: 1px solid rgba(255, 152, 0, 0.18);
  border-radius: var(--radius-sm);
  position: relative;
  padding-left: 32px;
}

.ob-warn-list li::before {
  content: '!';
  position: absolute;
  left: 10px;
  top: 10px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 152, 0, 0.2);
  color: var(--warning);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ob-provider-list li {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ob-provider-list.hidden,
.ob-local-models.hidden {
  display: none;
}

.ob-provider-status {
  width: 100%;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
}

.ob-provider-status.hidden,
.ob-help-improve.hidden {
  display: none;
}

.ob-help-improve {
  width: 100%;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-secondary));
  text-align: left;
}

.ob-help-improve-control {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.ob-help-improve-control input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.ob-help-improve-control input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 2px;
}

.ob-help-improve-description {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
}

.ob-help-improve-description a {
  color: var(--accent) !important;
}

.ob-local-models {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.ob-local-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.ob-local-model-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.ob-local-model-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  text-align: left;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.ob-local-model-option:hover,
.ob-local-model-option:focus-visible {
  border-color: var(--accent, #6c63ff);
  outline: none;
}

.ob-local-model-option[aria-selected="true"] {
  border-color: var(--accent, #6c63ff);
  background: rgba(108, 99, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(108, 99, 255, 0.25);
}

.ob-local-model-option .provider-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.94);
  padding: 1px;
  box-sizing: border-box;
  object-fit: contain;
  flex-shrink: 0;
}

.ob-local-model-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ob-local-model-provider {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ob-local-model-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ob-btn:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.ob-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  gap: 10px;
}

.ob-nav .ob-btn {
  flex: 1;
  min-height: 38px;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.ob-btn:active {
  transform: scale(0.97);
}

.ob-btn-next {
  background: var(--accent);
  color: #fff;
}

.ob-btn-next:hover {
  background: var(--accent-hover);
}

.ob-btn-back {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.ob-btn-back:hover {
  color: var(--text-primary);
  background: var(--tint-soft);
}

.ob-nav .ob-btn.hidden {
  display: none;
}

.ob-btn-settings {
  background: var(--accent);
  color: #fff;
}

.ob-btn-settings:hover {
  background: var(--accent-hover);
}

.ob-btn-settings.hidden {
  display: none;
}

.ob-skip {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
}

.ob-skip:hover {
  color: var(--text-secondary);
}

.ob-skip:disabled {
  color: var(--text-muted);
  cursor: wait;
  opacity: 0.5;
}

.ob-skip.hidden {
  display: none;
}


/* Header */
.header-shell {
  position: relative;
  z-index: 25;
  flex-shrink: 0;
}

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Display tools (language, scale, Settings, pop-out) sit at the start of the
   header and the conversation actions (History, New chat) at its end. */
.header-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.header-conversation {
  margin-inline-start: auto;
}

.ui-scale-menu {
  position: relative;
}

.ui-scale-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  /* The trigger sits at the start of the header: align the popover to the
     trigger's start edge (logical, so RTL locales also open it inward)
     instead of off the panel edge. */
  inset-inline-start: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: max-content;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.ui-scale-popover.hidden { display: none; }

/* Two ids: the generic `#header .header-tools button:not(...)` rule below is
   more specific than a class-based selector, and these chips live inside
   .header-tools. */
#header #ui-scale-popover button {
  min-width: 28px;
  min-height: 28px;
  justify-content: center;
  padding: 4px 7px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
}

/* The base rule above (two ids) outranks the generic `.header-tools
   button:hover`, so these chips need their own hover to react at all. */
#header #ui-scale-popover button:hover:not(:disabled) { background: var(--accent-dim); }
#header #ui-scale-popover button:disabled { opacity: 0.45; cursor: default; }
#header #ui-scale-popover .ui-scale-reset { min-width: auto; padding-inline: 9px; }
.ui-scale-popover output { min-width: 40px; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }

/* Permission prompts: the same switch as Settings → Permissions → Ask before
   consequential actions, as an icon in the composer toolbar next to the
   microphone. Its popover opens upward like the model picker's menu. When
   prompts are off the trigger keeps a warning color and dot, so the state stays
   visible while the popover is closed. The popover anchors to the toolbar (not
   its trigger) so it always fits a narrow or zoomed panel. */
.composer-toolbar { position: relative; }

#btn-permission-gate {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.1s;
  flex-shrink: 0;
}

#btn-permission-gate:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

#btn-permission-gate:active { transform: scale(0.95); }

#btn-permission-gate[aria-expanded="true"] {
  color: var(--text-primary);
  background: var(--accent-dim);
}

#btn-permission-gate.is-gate-off {
  color: var(--warning);
}

#btn-permission-gate.is-gate-off::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-end: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 1.5px var(--bg-input);
}

#btn-permission-gate:focus-visible {
  outline: 2px solid var(--accent, #6c63ff);
  outline-offset: 1px;
}

.permission-gate-popover {
  position: absolute;
  z-index: 40;
  bottom: calc(100% + 10px);
  inset-inline-end: 0;
  display: grid;
  gap: 8px;
  width: min(272px, calc(100vw / var(--ui-scale-zoom, 1) - 28px));
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.permission-gate-popover.hidden { display: none; }

/* Mode picker at the top of the "!" popover. Automatic is the default; a mode
   chosen here lasts for the tab's chat, and the trigger then shows it, so a
   kept mode stays visible while the popover is closed. Act and Dev use the
   warning color of the old Ask/Act/Dev toggle. */
.composer-mode-picker {
  display: grid;
  gap: 6px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}

/* Each option takes its name's width and shares the rest; long names wrap
   onto a second row instead of being cut off. */
.composer-mode-options {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-input);
}

.composer-mode-option {
  flex: 1 0 auto;
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.composer-mode-option:hover {
  color: var(--text-primary);
  background: var(--tint-medium);
}

.composer-mode-option.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.composer-mode-option.active:is([data-composer-mode="act"], [data-composer-mode="dev"]) {
  color: var(--warning);
  background: rgba(255, 152, 0, 0.12);
}

.composer-mode-option:focus-visible {
  outline: 2px solid var(--accent, #6c63ff);
  outline-offset: 1px;
}

#btn-permission-gate.has-mode-pin {
  width: auto;
  min-width: 28px;
  gap: 4px;
  padding-inline: 6px 8px;
  border-radius: 14px;
  color: var(--accent);
  background: var(--accent-dim);
}

#btn-permission-gate.has-mode-pin:is([data-composer-mode="act"], [data-composer-mode="dev"]) {
  color: var(--warning);
  background: rgba(255, 152, 0, 0.12);
}

.composer-mode-badge {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.composer-mode-badge[hidden] { display: none; }

/* The standalone window always stays in Ask. */
html[data-standalone="true"] .composer-mode-picker { display: none; }

.permission-gate-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.permission-gate-copy {
  display: grid;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}

.permission-gate-title {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.permission-gate-desc {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

/* The checkbox stays in the accessibility tree and keyboard order; the track
   next to it draws the switch. */
.permission-gate-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.permission-gate-switch {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 18px;
  margin-top: 1px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--tint-medium);
  transition: background 0.2s, border-color 0.2s;
}

.permission-gate-switch::before {
  content: '';
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 0.2s, background 0.2s;
}

.permission-gate-input:checked + .permission-gate-switch {
  border-color: var(--accent);
  background: var(--accent);
}

.permission-gate-input:checked + .permission-gate-switch::before {
  transform: translateX(14px);
  background: #fff;
}

html[dir="rtl"] .permission-gate-input:checked + .permission-gate-switch::before {
  transform: translateX(-14px);
}

.permission-gate-input:focus-visible + .permission-gate-switch {
  outline: 2px solid var(--accent, #6c63ff);
  outline-offset: 2px;
}

.permission-gate-off-note {
  margin: 0;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  color: var(--warning);
  font-size: 11px;
  line-height: 1.4;
}

.permission-gate-off-note.hidden { display: none; }

.permission-gate-settings {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.permission-gate-settings:hover {
  color: var(--accent-hover);
  background: none;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background 0.3s;
  flex-shrink: 0;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--error); }
.status-dot.connecting { background: var(--warning); animation: pulse 1.5s infinite; }

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

/* Provider picker — closed header is text-only; brand icons appear only
   in the open menu rows. Native <select> stays as the value source
   (visually hidden) for existing change handlers. */
.provider-picker {
  position: relative;
  min-width: 0;
  max-width: 200px;
  /* Grow to content only: the toolbar's spacer takes the free room. */
  flex: 0 1 auto;
}

.provider-select-native,
.language-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.provider-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 6px 4px 8px;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
  font-family: inherit;
}

.provider-picker-btn:hover {
  border-color: var(--accent, #6c63ff);
}

.provider-picker-btn:hover .provider-picker-caret {
  color: var(--text-primary);
  opacity: 1;
}

.provider-picker-btn:focus-visible {
  outline: 2px solid var(--accent, #6c63ff);
  outline-offset: 1px;
}

.provider-picker-btn[aria-expanded="true"] {
  border-color: var(--accent, #6c63ff);
}

.provider-picker-btn[aria-expanded="true"] .provider-picker-caret {
  transform: rotate(180deg);
  color: var(--accent, #6c63ff);
  opacity: 1;
}

.provider-picker-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.provider-picker-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  color: var(--text-muted, var(--text-secondary));
  opacity: 0.85;
  transition: transform 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.provider-picker-caret svg {
  display: block;
}

.provider-picker-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: max(100%, 200px);
  max-width: min(280px, calc(90vw / var(--ui-scale-zoom, 1)));
  max-height: min(320px, calc(50vh / var(--ui-scale-zoom, 1)));
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-secondary, var(--bg-input));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  padding: 4px;
}

.picker-menu-highlight {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 0;
  height: 0;
  border-radius: 4px;
  background: rgba(108, 99, 255, 0.12);
  opacity: 0;
  pointer-events: none;
  will-change: transform, width, height;
  transition:
    transform 170ms cubic-bezier(0.22, 1, 0.36, 1),
    width 170ms cubic-bezier(0.22, 1, 0.36, 1),
    height 170ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 90ms ease;
}

.picker-menu-highlight.visible {
  opacity: 1;
}

.picker-menu-highlight.instant {
  transition: none;
}

.provider-picker-menu.hidden {
  display: none;
}

.provider-picker-group-label,
.provider-picker-option,
.language-picker-separator {
  position: relative;
  z-index: 1;
}

.provider-picker-group-label {
  padding: 6px 8px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-muted, var(--text-secondary));
}

.provider-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.94);
  padding: 1px;
  box-sizing: border-box;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.provider-icon-sm {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.provider-picker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  padding: 7px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.provider-picker-option:hover,
.provider-picker-option:focus-visible {
  background: transparent;
  outline: none;
}

.provider-picker-option:focus-visible {
  box-shadow: inset 0 0 0 1px var(--accent, #6c63ff);
}

.provider-picker-option[aria-selected="true"] {
  background: transparent;
  box-shadow: inset 2px 0 0 var(--accent, #6c63ff);
}

@media (prefers-reduced-motion: reduce) {
  .picker-menu-highlight {
    transition: none;
  }
}

.provider-picker-option-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-picker-option-meta {
  color: var(--text-muted, var(--text-secondary));
  font-size: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Compact language picker: the closed trigger is a plain header icon, matching
   the other header buttons; flags, codes and names live in the open menu. */
.language-picker {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

/* Two selectors deep: the generic `#header .header-tools button:not(...)` rule
   below outranks a bare class selector, and this trigger lives in .header-tools. */
#header .header-tools button.language-picker-btn[aria-expanded="true"] {
  color: var(--text-primary);
  background: var(--accent-dim);
}

.language-picker-btn:focus-visible {
  outline: 2px solid var(--accent, #6c63ff);
  outline-offset: 1px;
}

.language-picker-option-flag {
  display: block;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  background: var(--bg-input);
}

/* Opens inward from the start of the header. The menu itself is always
   LTR, so its side follows the document direction explicitly. */
.language-picker-menu {
  left: 0;
  right: auto;
  min-width: 224px;
  max-width: min(272px, calc(100vw / var(--ui-scale-zoom, 1) - 16px));
  max-height: min(352px, calc(60vh / var(--ui-scale-zoom, 1)));
  direction: ltr;
}

html[dir="rtl"] .language-picker-menu {
  left: auto;
  right: 0;
}

.language-picker-option {
  direction: ltr;
  text-align: left;
}

.language-picker-option-flag {
  width: 24px;
  height: 18px;
  border-radius: 3px;
}

.language-picker-option-code {
  min-width: 18px;
  color: var(--text-muted, var(--text-secondary));
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: center;
  flex: 0 0 auto;
}

.language-picker-option-copy {
  min-width: 0;
  flex: 1 1 auto;
  direction: ltr;
  text-align: left;
}

.language-picker-option-native,
.language-picker-option-english {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.language-picker-option-native {
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.2;
  text-align: left;
  unicode-bidi: plaintext;
}

.language-picker-option-english {
  margin-top: 2px;
  color: var(--text-muted, var(--text-secondary));
  font-size: 10px;
  line-height: 1.15;
}

.language-picker-check {
  width: 14px;
  height: 14px;
  color: var(--accent, #6c63ff);
  opacity: 0;
  flex: 0 0 auto;
}

.language-picker-option[aria-selected="true"] .language-picker-check {
  opacity: 1;
}

.language-picker-separator {
  height: 1px;
  margin: 4px 6px;
  background: var(--border);
}

/* Icon buttons in the header tools cluster only. The language trigger is one
   of them; its menu options keep their own option styling. */
#header .header-tools button:not(.language-picker-option) {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s, background 0.2s;
}

#header .header-tools button:not(.language-picker-option):hover {
  color: var(--text-primary);
  background: var(--accent-dim);
}

#header .header-tools button:not(.language-picker-option).active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* Narrow panels: reduce only the outer chrome. The header icons keep their
   normal gap and padding instead of collapsing together. */
@media (max-width: 380px) {
  #header { padding-inline: 8px; }
}

/* First child of #input-area, so it shares the composer's gutters; the gap
   below matches the queued-message and attachment rows. */
.composer-toast {
  margin: 0 0 8px;
  padding: 7px 11px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
  box-shadow: var(--shadow);
}

.composer-toast.hidden {
  display: none;
}

.composer-toast.memory-update-cue {
  border-color: color-mix(in srgb, var(--success) 48%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--bg-input));
  color: var(--text-primary);
}

.composer-toast.memory-update-cue-enter {
  animation: memory-update-cue-enter 480ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes memory-update-cue-enter {
  0% {
    opacity: 0;
    transform: translateY(6px);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 34%, transparent);
  }
  55% {
    opacity: 1;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 8%, transparent);
  }
  100% {
    transform: translateY(0);
    box-shadow: var(--shadow);
  }
}

@media (prefers-reduced-motion: reduce) {
  .composer-toast.memory-update-cue-enter {
    animation: none;
  }
}

/* Page Inspection Banner */
#inspection-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(108, 99, 255, 0.08);
  border-bottom: 1px solid rgba(108, 99, 255, 0.15);
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
  flex-shrink: 0;
  animation: fadeIn 0.2s ease;
}

#inspection-banner.hidden {
  display: none;
}

.inspection-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}

/* Chat Container */
#chat-shell {
  position: relative;
  flex: 1;
  min-height: 0;
}

#chat-container {
  height: 100%;
  overflow-y: auto;
  padding: 12px;
  scroll-behavior: smooth;
  position: relative;
}

.message.assistant.chat-navigation-inset .message-content {
  padding-block-end: 60px;
}

.chat-navigation {
  position: absolute;
  inset-inline-end: 12px;
  bottom: 12px;
  z-index: 7;
  display: inline-block;
  max-width: calc(100% - 36px);
  transition: transform 0.15s, opacity 0.4s ease;
}

.chat-navigation-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  max-width: 100%;
  padding-block: 7px;
  padding-inline: 12px 24px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 5px 18px color-mix(in srgb, var(--overlay-bg-strong) 72%, transparent);
  backdrop-filter: blur(10px);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chat-navigation.hidden {
  display: none;
}

.chat-navigation:hover,
.chat-navigation:focus-within {
  transform: translateY(-1px);
  opacity: 1;
  transition: transform 0.15s, opacity 0.12s ease;
}

/* Idle at partial opacity so the control stops competing with the reply it
   floats over; pointing at it brings it back to full strength. */
@media (hover: hover) {
  .chat-navigation {
    opacity: 0.78;
  }
}

.chat-navigation-action:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-secondary));
  color: var(--text-primary);
}

.chat-navigation-action:focus-visible,
.chat-navigation-dismiss:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 2px;
}

.chat-navigation-action svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s ease;
}

.chat-navigation[data-direction="down"] .chat-navigation-action svg {
  transform: rotate(180deg);
}

.chat-navigation-dismiss {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  width: 20px;
  height: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  box-shadow: 0 2px 7px color-mix(in srgb, var(--overlay-bg-strong) 60%, transparent);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  line-height: 18px;
}

.chat-navigation-dismiss:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
  color: var(--text-primary);
}

@media (prefers-reduced-motion: reduce) {
  .chat-navigation,
  .chat-navigation-action svg {
    transition: none;
  }
}

#messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Messages */
.message {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 95%;
  animation: fadeIn 0.2s ease;
}

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

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

.message.assistant, .message.system {
  align-self: flex-start;
}

.message.assistant {
  width: 95%;
}

.message.user,
.message.assistant {
  cursor: pointer;
}

.message.assistant .message-text {
  -webkit-user-select: text;
  user-select: text;
}

.message.assistant.assistant-awaiting-content {
  display: none;
}

.response-incomplete-note {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.message-content,
.slash-command-content {
  padding: 10px 14px;
  border-radius: var(--radius);
  line-height: 1.5;
  word-wrap: break-word;
  white-space: normal;
}

.message.user .message-content {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.user .message-text {
  white-space: pre-wrap;
}

.message-attachments {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}

.message-attachment {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  line-height: 1.25;
}

.message-attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-attachment-icon,
.message-attachment-state {
  flex-shrink: 0;
}

.message-attachment-state {
  margin-left: auto;
  font-weight: 700;
}

.message-attachment-not-sent,
.message-attachment-unknown {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(90, 20, 20, 0.24);
}

.message.assistant .message-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.message-info-bar {
  position: absolute;
  inset-block-start: 100%;
  inset-inline-start: 0;
  display: none;
  align-items: center;
  width: max-content;
  max-width: calc(100vw / var(--ui-scale-zoom, 1) - 24px);
  min-width: 0;
  margin-top: 3px;
}

.message.message-info-open {
  margin-bottom: 25px;
}

.message.message-info-open > .message-info-bar {
  display: flex;
}

.message.user .message-info-bar {
  inset-inline-start: auto;
  inset-inline-end: 0;
}

.message-info-toggle {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  appearance: none;
  background: transparent;
  pointer-events: none;
}

.message-info-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.message-info {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.message-info::-webkit-scrollbar {
  display: none;
}

.message.user .message-info {
  justify-content: flex-start;
}

.message-info[hidden] {
  display: none;
}

.message-info-pill {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.message-info-sent {
  opacity: 0.9;
}

.message.system .message-content,
.slash-command-content {
  background: var(--accent-dim);
  border: 1px solid rgba(108, 99, 255, 0.2);
  font-size: 12px;
}

.slash-command-output {
  margin: 10px 0;
  cursor: auto;
}

.screenshot-result {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.screenshot-attachment-note {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 11px;
}

.screenshot-result-image {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: top;
  border-radius: 6px;
}

.screenshot-result-image-full-page {
  max-height: calc(70vh / var(--ui-scale-zoom, 1));
}

.screenshot-warning {
  color: var(--warning-color, #b26a00);
  line-height: 1.4;
}

.screenshot-result-actions {
  display: flex;
  justify-content: flex-end;
}

.screenshot-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

.screenshot-save-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screenshot-save-btn:hover,
.screenshot-save-btn:focus-visible {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.screenshot-save-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.screenshot-save-btn:active {
  transform: translateY(1px);
}

.screenshot-save-btn:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

/* "Context automatically compacted" inline separator. */
.context-compacted-note {
  align-self: center;
  max-width: 90%;
  margin: 6px 0;
  padding: 3px 12px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  opacity: 0.9;
}

.context-compacted-note::before {
  content: "\21A5  ";
  opacity: 0.7;
}

.scheduled-jobs {
  margin: 8px 12px 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scheduled-jobs.hidden {
  display: none;
}

.scheduled-job-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  align-items: center;
  font-size: 12px;
}

.scheduled-job-title {
  color: var(--text-primary);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.scheduled-job-meta {
  color: var(--text-muted);
  font-size: 11px;
  grid-column: 1 / -1;
}

.scheduled-job-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.scheduled-job-actions button {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 7px;
  cursor: pointer;
}

.scheduled-job-actions button:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.workflow-manager {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.workflow-manager-empty {
  color: var(--text-muted);
  font-size: 12px;
}

.workflow-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-secondary);
}

.workflow-card-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.workflow-card-meta {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.workflow-card-actions,
.workflow-rename-form {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}

.workflow-card-actions button,
.workflow-rename-form button {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 7px;
  cursor: pointer;
}

.workflow-card-actions button:hover,
.workflow-rename-form button:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.workflow-card-actions button[data-workflow-action="delete"]:hover {
  color: var(--error-soft);
  border-color: var(--error);
}

.workflow-card-actions button.confirm-delete {
  color: var(--error-soft);
  border-color: var(--error);
}

.workflow-card-actions button:disabled,
.workflow-rename-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.workflow-rename-form.hidden {
  display: none;
}

.workflow-rename-form input {
  flex: 1 1 150px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font: inherit;
  padding: 5px 7px;
}

.workflow-rename-form input:focus {
  border-color: var(--accent);
  outline: none;
}

.schedule-composer {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.schedule-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.schedule-field.hidden {
  display: none;
}

.schedule-field input,
.schedule-field textarea,
.schedule-field select {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
}

.schedule-field textarea {
  resize: vertical;
  min-height: 82px;
}

.schedule-error {
  min-height: 16px;
  color: var(--error-soft);
  font-size: 11px;
}

.schedule-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.schedule-form-actions button {
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.schedule-submit {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.schedule-cancel {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.schedule-form-actions button:disabled {
  opacity: 0.6;
  cursor: default;
}

.scratchpad-dump {
  margin-top: 8px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 11px;
  line-height: 1.45;
}

.message-content p {
  margin-bottom: 6px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* Chat links keep the surrounding text color. A dotted underline marks them
   and turns solid on hover or keyboard focus. */
.message-content a {
  color: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

.message-content a:hover,
.message-content a:focus-visible {
  text-decoration-style: solid;
}

.message-content a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 2px;
}


/* The favicon sits in the link's start padding. An inline icon box would add a
   line break opportunity before the URL, leaving the icon alone on a line. The
   space is held while the icon loads and given back when it cannot load. */
.message-content a.chat-link:not(.chat-link-no-icon) {
  position: relative;
  padding-inline-start: calc(14px + 0.35em);
}

.message-content .chat-link-icon {
  display: none;
  position: absolute;
  inset-inline-start: 0;
  top: calc(0.6em - 7px);
  width: 14px;
  height: 14px;
  object-fit: contain;
  border-radius: 3px;
}

.message-content .chat-link-icon-ready > .chat-link-icon {
  display: block;
}

.hint {
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
}


/* Verbose mode: each turn's reasoning blurb is appended as its own dim
   paragraph instead of overwriting the previous one, so the full chain
   of intermediate thinking is preserved alongside the steps log. */
.reasoning-step {
  border-left: 2px solid var(--border);
  padding: 4px 0 4px 8px;
  margin: 6px 0;
  opacity: 0.85;
  font-size: 13px;
}
.reasoning-step + .reasoning-step {
  margin-top: 4px;
}
.reasoning-step:last-child {
  opacity: 1;
  border-left-color: var(--accent, var(--border));
}


/* ==========================================================================
   COMPACT ACTIVITY HISTORY — visible by default; status click hides it
   ========================================================================== */

#messages:not(.progress-verbose).progress-status-only .steps-container {
  display: none;
}

#messages:not(.progress-verbose) .tool-call {
  display: none;
}

.steps-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 6px 0 8px 0;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 0;
  transition: color 0.2s;
}

.step-item.active {
  color: var(--text-secondary);
}

.step-item.done {
  color: var(--text-muted);
}

.step-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
}

.step-icon.spinning {
  border: 1.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.step-icon.check {
  color: var(--success);
  font-size: 12px;
}

.step-icon.fail {
  color: var(--error);
  font-size: 12px;
}

.step-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapsible details toggle — for showing verbose info on a per-step basis */
.step-details-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 9px;
  padding: 2px 4px;
  border-radius: 3px;
  opacity: 0.72;
  transition: opacity 0.2s;
}

.step-item:hover .step-details-toggle,
.step-details-toggle:focus-visible {
  opacity: 1;
}

.step-details-toggle:hover,
.step-details-toggle:focus-visible {
  background: var(--accent-dim);
  color: var(--text-secondary);
}

.step-details-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.step-details {
  display: none;
  margin: 2px 0 4px 20px;
  padding: 6px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-secondary);
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.step-details.open {
  display: block;
}

.step-details .detail-label {
  color: var(--accent);
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.step-details .detail-result {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   VERBOSE TOOL CALLS (opt-in via settings) — full debug output
   ========================================================================== */

.tool-call {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 4px 0;
  font-size: 11px;
}

.tool-call-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.tool-call-header .icon {
  font-size: 12px;
}

.tool-call-body {
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 10px;
  max-height: 80px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.tool-result {
  background: rgba(76, 175, 80, 0.08);
  border-left: 2px solid var(--success);
  padding: 4px 8px;
  margin-top: 4px;
  border-radius: 0 4px 4px 0;
  font-size: 10px;
  color: var(--text-secondary);
  font-family: monospace;
  max-height: 60px;
  overflow-y: auto;
  white-space: pre-wrap;
}


/* ==========================================================================
   AGENT ACTIVITY BAR
   ========================================================================== */

#agent-activity {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}

#agent-activity.hidden {
  display: none;
}

#activity-progress-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}

#agent-activity.progress-toggle-enabled #activity-progress-toggle {
  cursor: pointer;
}

#activity-progress-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

#btn-stop {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(244, 67, 54, 0.12);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: var(--error);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

#btn-stop:hover {
  background: rgba(244, 67, 54, 0.22);
}

#btn-stop svg {
  flex-shrink: 0;
}

#activity-text {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#activity-live-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  #activity-text {
    background: linear-gradient(
      102deg,
      var(--text-secondary) 0%,
      var(--text-secondary) 37%,
      var(--text-primary) 45%,
      var(--accent) 50%,
      var(--text-primary) 55%,
      var(--text-secondary) 63%,
      var(--text-secondary) 100%
    );
    background-size: 260% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: activity-text-sweep 1.9s ease-in-out infinite;
  }
}

/* The working indicator (activity-brain.js) draws into a 22px canvas. The
   negative margin leaves it the old 14px spinner's footprint, so the bar keeps
   its height and the label stays where it was. */
.activity-brain {
  display: block;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: -4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes activity-text-sweep {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  #activity-text {
    animation: none;
    background: none;
    color: var(--text-primary);
  }
}

/* ==========================================================================
   ACT MODE WARNING BANNER
   ========================================================================== */

#act-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(255, 152, 0, 0.1);
  border-top: 1px solid rgba(255, 152, 0, 0.25);
  font-size: 10px;
  color: var(--warning);
  flex-shrink: 0;
  line-height: 1.3;
}

#act-warning.hidden {
  display: none;
}

#act-warning svg {
  flex-shrink: 0;
}

#act-warning-dismiss {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-block: -4px;
  margin-inline-start: auto;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  font: inherit;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  opacity: 0.72;
}

#act-warning-dismiss:hover {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  opacity: 1;
}

#act-warning-dismiss:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--warning) 34%, transparent);
  outline-offset: 1px;
  opacity: 1;
}

.selection-scope-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid color-mix(in srgb, var(--warning) 28%, var(--border));
  background: color-mix(in srgb, var(--warning) 9%, var(--bg-secondary));
  color: var(--text-secondary);
  flex-shrink: 0;
}

.selection-scope-banner.hidden {
  display: none;
}

.selection-scope-banner-icon {
  color: var(--warning);
  font-size: 13px;
  line-height: 1;
}

.selection-scope-banner-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
  font-size: 10px;
  line-height: 1.3;
}

.selection-scope-banner-copy strong {
  color: var(--text-primary);
  font-size: 10.5px;
  font-weight: 700;
}

.selection-scope-banner button {
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--warning) 42%, var(--border));
  border-radius: 7px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-scope-banner button:not(:disabled):hover {
  border-color: var(--warning);
}

.selection-scope-banner button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.selection-scope-banner button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--warning) 34%, transparent);
  outline-offset: 2px;
}

.selection-scope-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 8px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.selection-scope-divider::before,
.selection-scope-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: color-mix(in srgb, var(--warning) 34%, var(--border));
}

.selection-scope-divider-label {
  white-space: nowrap;
}

@media (max-width: 520px) {
  .selection-scope-banner {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .selection-scope-banner-copy {
    grid-column: 2 / -1;
  }

  #selection-scope-restore {
    grid-column: 2;
    width: 100%;
  }

  #selection-scope-new-conversation {
    grid-column: 3;
    width: 100%;
  }
}

@media (max-width: 340px) {
  .selection-scope-banner {
    grid-template-columns: auto minmax(0, 1fr);
  }

  #selection-scope-restore,
  #selection-scope-new-conversation {
    grid-column: 2;
    width: 100%;
  }
}

.mode-btn.selection-scope-unavailable {
  opacity: 0.48;
}

.selection-ask-action {
  position: fixed;
  z-index: 10000;
  display: block;
  opacity: 1;
  max-width: calc(100vw / var(--ui-scale-zoom, 1) - 16px);
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 999px;
  background: var(--bg-secondary);
  box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 18%, transparent);
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: auto;
  user-select: none;
  white-space: nowrap;
}

.selection-ask-action.hidden {
  display: none !important;
}

.selection-ask-action:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-secondary));
}

.selection-ask-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 2px;
}



/* First-turn empty state — optically centered a little above the mathematical
   midpoint so the composer still feels connected to the invitation. */
.chat-empty-state {
  box-sizing: border-box;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0 clamp(72px, 14vh, 112px);
}

/* The empty state is deliberately outside #messages, so it never becomes
   transcript history. Its adjacent position lets the first message remove it
   without a second source of conversation state. */
#messages:not(:empty) + .chat-empty-state {
  display: none;
}

.chat-empty-state-heading {
  width: min(100%, 340px);
  margin: 0 0 18px;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
  text-align: center;
}

/* Context-aware recommendations — a compact action list within the empty state. */
.recommended-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
  width: min(100%, 320px);
}

.recommended-actions.collapsed {
  margin-bottom: 0;
}

.recommended-actions.hidden {
  display: none;
}

.recommended-actions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 0;
  padding-inline: 2px;
}

.recommended-actions.collapsed .recommended-actions-header {
  margin-bottom: 0;
}

.recommended-actions-title {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.recommended-actions-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: 18px;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  width: 18px;
}

.recommended-actions-toggle:hover {
  background: var(--accent-dim);
  border-color: var(--border);
  color: var(--text-primary);
}

.recommended-actions-toggle svg {
  fill: none;
  height: 12px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 0.15s;
  width: 12px;
}

.recommended-actions.collapsed .recommended-actions-toggle svg {
  transform: rotate(-90deg);
}

.recommended-actions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.recommended-actions.collapsed .recommended-actions-list {
  display: none;
}

.recommended-action-chip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-secondary) 72%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  padding: 8px 11px;
  text-align: start;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--border) 28%, transparent);
}

.recommended-action-chip:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-primary);
}

.recommended-action-chip:active {
  transform: scale(0.98);
}

.recommended-action-chip-promotion {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  border-color: color-mix(in srgb, var(--promotion-action-accent) 48%, var(--border));
  background: color-mix(in srgb, var(--promotion-action-accent) 13%, var(--bg-secondary));
  color: var(--text-primary);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--promotion-action-accent) 14%, transparent);
}

.recommended-action-chip-promotion:hover {
  border-color: var(--promotion-action-accent);
  background: color-mix(in srgb, var(--promotion-action-accent) 20%, var(--bg-secondary));
  box-shadow: 0 3px 12px color-mix(in srgb, var(--promotion-action-accent) 22%, transparent);
}

.recommended-action-chip-promotion:focus-visible {
  outline: 2px solid var(--promotion-action-accent);
  outline-offset: 2px;
}

.recommended-action-icon {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  fill: currentColor;
  color: var(--promotion-action-accent);
}

.recommended-action-chip-promotion-enter {
  animation: recommended-promotion-action-glow 850ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

@keyframes recommended-promotion-action-glow {
  0%, 100% {
    box-shadow: 0 1px 4px color-mix(in srgb, var(--promotion-action-accent) 14%, transparent);
  }
  45% {
    box-shadow:
      0 3px 12px color-mix(in srgb, var(--promotion-action-accent) 24%, transparent),
      0 0 0 5px color-mix(in srgb, var(--promotion-action-accent) 18%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .recommended-action-chip-promotion-enter {
    animation: none;
  }
}

/* Store review prompt (#208) — sticky card at bottom of chat */
.store-review-prompt {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 10px;
  animation: fadeIn 0.25s ease;
}

.store-review-prompt.hidden {
  display: none;
}

.store-review-card {
  position: relative;
  padding: 14px 14px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px color-mix(in srgb, var(--border) 55%, transparent);
}

.store-review-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.store-review-close:hover {
  background: var(--accent-dim);
  color: var(--text-primary);
}

.store-review-step.hidden {
  display: none;
}

.store-review-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  padding-right: 20px;
}

.store-review-body {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.store-review-stars {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin: 4px 0 2px;
}

.store-review-star {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  padding: 2px 4px;
  transition: color 0.12s, transform 0.1s;
}

.store-review-star:hover,
.store-review-star.active {
  color: #ffb703;
  transform: scale(1.08);
}

.store-review-primary {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.store-review-primary:hover {
  filter: brightness(1.05);
}

.store-review-feedback {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  resize: vertical;
  min-height: 72px;
}

.store-review-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.store-review-link {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.store-review-link:hover {
  color: var(--text-primary);
}

.store-review-prompt:has(#store-review-step-positive:not(.hidden)) .store-review-footer,
.store-review-prompt:has(#store-review-step-negative:not(.hidden)) .store-review-footer,
.store-review-prompt:has(#store-review-step-thanks:not(.hidden)) .store-review-footer {
  display: none;
}

/* ==========================================================================
   ASK / ACT MODE TOGGLE
   ========================================================================== */

html[data-standalone="true"] .composer-control-row {
  display: none;
}

html[data-standalone="true"] #header #btn-expand {
  display: none;
}

/* Standalone chat has no History; New chat stays in the header. */
html[data-standalone="true"] #header #btn-history {
  display: none;
}

.composer-control-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 8px;
}

/* Mode selection is always Automatic: the agent routes each turn, so the
   Ask/Act/Dev row never shows. */
.composer-control-row {
  display: none;
}

#mode-toggle {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
  margin-bottom: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  position: relative;
}

.mode-toggle-highlight {
  position: absolute;
  top: 2px;
  left: 0;
  z-index: 0;
  height: calc(100% - 4px);
  border-radius: 6px;
  background: var(--accent-dim);
  pointer-events: none;
  will-change: transform, width;
  transition:
    transform 170ms cubic-bezier(0.22, 1, 0.36, 1),
    width 170ms cubic-bezier(0.22, 1, 0.36, 1),
    background 170ms ease;
}

.mode-toggle-highlight.act {
  background: rgba(255, 152, 0, 0.12);
}

.mode-toggle-highlight.instant {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .mode-toggle-highlight {
    transition: none;
  }
}

.mode-btn {
  flex: 1;
  position: relative;
  z-index: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s;
  text-align: center;
}

.mode-btn:hover {
  color: var(--text-secondary);
}

.mode-btn.active {
  color: var(--accent);
}

.mode-btn.active.act {
  color: var(--warning);
}

.conversation-action-group {
  display: flex;
  align-items: stretch;
  gap: 4px;
  flex: 0 0 auto;
}

.conversation-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-secondary);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.conversation-action:hover {
  color: var(--text-primary);
  background: var(--accent-dim);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.conversation-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.conversation-action svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

@media (max-width: 430px) {
  .conversation-action {
    width: 30px;
    padding-inline: 0;
  }

  .conversation-action-label {
    display: none;
  }
}

html[data-ui-scale="150"] .conversation-action,
html[data-ui-scale="175"] .conversation-action {
  width: 30px;
  padding-inline: 0;
}

html[data-ui-scale="150"] .conversation-action-label,
html[data-ui-scale="175"] .conversation-action-label {
  display: none;
}


/* Input Area */
#input-area {
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Two rows: the message on top, then attach, the model picker and its
   status, and mic and send at the end. */
#input-wrapper {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 8px 6px;
  transition: border-color 0.2s;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.composer-toolbar-spacer {
  flex: 1 1 0;
}

/* The model picker stays quiet until hovered; its menu opens upward. */
.composer-toolbar .provider-picker {
  max-width: 220px;
}

.composer-toolbar .provider-picker-btn {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
  gap: 2px;
  padding: 4px 4px 4px 5px;
}

/* Keep the provider logo and engine fallback the same size, so switching
   providers never moves the connection badge or crowds the toolbar. */
.provider-picker-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.provider-picker-logo.hidden,
.provider-picker-icon.has-logo .provider-picker-fallback {
  display: none;
}

/* The connection dot is a badge on the logo's lower corner, inside the
   button: it reads as the model's status, and clicking it opens the menu like
   the rest of the button. A ring in the button's background keeps it clear of
   the icon's strokes. */
.provider-picker-engine {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.provider-picker-engine .status-dot {
  position: absolute;
  bottom: -1px;
  inset-inline-end: -2px;
  width: 7px;
  height: 7px;
}

.provider-picker-engine .status-dot:is(.online, .offline, .connecting) {
  box-shadow: 0 0 0 2px var(--status-dot-ring, var(--bg-input));
}

.composer-toolbar .provider-picker-label {
  display: none;
}

.composer-toolbar .provider-picker-btn:hover,
.composer-toolbar .provider-picker-btn[aria-expanded="true"] {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-primary);
  --status-dot-ring: var(--bg-secondary);
}

.composer-toolbar .provider-picker-menu {
  top: auto;
  bottom: calc(100% + 6px);
}

html[dir="rtl"] .composer-toolbar .provider-picker-menu {
  left: auto;
  right: 0;
}

/* Narrow panel at a large UI scale (150%/175% leave ~160-200px inside the
   composer): if the controls do not fit on one row they wrap to a second one
   instead of being squeezed. The DOM order is unchanged, so keyboard focus
   follows the visual order. */
html[data-ui-scale="150"] .composer-toolbar,
html[data-ui-scale="175"] .composer-toolbar {
  flex-wrap: wrap;
  row-gap: 4px;
}

#input-wrapper:focus-within {
  border-color: var(--accent);
}

#input-area.act-mode #input-wrapper {
  border-color: rgba(255, 152, 0, 0.3);
}

#input-area.act-mode #input-wrapper:focus-within {
  border-color: var(--warning);
}

#input-area.drag-over #input-wrapper {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent);
}

.slash-command-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 8px;
  padding: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
}

.slash-command-menu.hidden {
  display: none;
}

.queued-messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 8px;
}

.queued-messages.hidden {
  display: none;
}

.queued-message {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.queued-message.has-steer {
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
}

/* Held after Stop: nothing sends it automatically; edit, steer or delete it. */
.queued-message[data-held="true"] {
  border-style: dashed;
  box-shadow: none;
}

.queued-message[data-held="true"] .queued-message-label {
  color: var(--text-secondary);
}

.queued-message-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.queued-message-text {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queued-message-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.queued-message-action:hover {
  color: var(--text-primary);
  background: rgba(91, 82, 232, 0.12);
  border-color: var(--border);
}

.queued-message-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.slash-command-option {
  display: grid;
  grid-template-columns: minmax(112px, max-content) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  padding: 7px 8px;
  text-align: left;
}

.slash-command-option:hover,
.slash-command-option.selected {
  background: rgba(91, 82, 232, 0.14);
  color: var(--text-primary);
}

.slash-command-option.slash-command-base-action {
  margin-bottom: 3px;
  border-bottom: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
}

.slash-command-name {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
}

.slash-command-description {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.attachment-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.attachment-preview-list.hidden {
  display: none;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 200px;
  padding: 4px 6px 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.attachment-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip-remove {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-chip-remove:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

#input-text-layer {
  display: grid;
  padding-inline: 4px;
  min-width: 0;
  position: relative;
}

#input-highlight,
#user-input {
  grid-area: 1 / 1;
  width: 100%;
  min-width: 0;
  max-height: 120px;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

#input-highlight {
  color: transparent;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.input-highlight-command {
  color: transparent;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

#user-input {
  position: relative;
  z-index: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  caret-color: var(--text-primary);
  resize: none;
  outline: none;
  /* autoResizeInput flips to auto only when content exceeds max-height */
  overflow-y: hidden;
}

#user-input::placeholder {
  color: var(--text-muted);
}

.queued-message-steer.hidden {
  display: none;
}

.queued-message-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#btn-send {
  background: var(--accent);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}

#btn-send:hover {
  background: var(--accent-hover);
}

#btn-send:active {
  transform: scale(0.95);
}

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

#btn-attach,
#btn-mic {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.1s;
  flex-shrink: 0;
}

#btn-attach:hover,
#btn-mic:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

#btn-attach:active,
#btn-mic:active {
  transform: scale(0.95);
}

#btn-attach:disabled,
#btn-mic:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Active dictation — pulsing red to signal the mic is live. */
#btn-mic.listening {
  color: var(--error);
  animation: btn-mic-pulse 1.4s ease-in-out infinite;
}

/* Visually disabled but NOT the disabled attribute — clicks must still
   register so the user gets a "why" message in chat (unsupported browser /
   disabled in settings) instead of a button that mysteriously does nothing. */
#btn-mic.mic-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#btn-mic.mic-disabled:hover {
  background: transparent;
  color: var(--text-secondary);
}

@keyframes btn-mic-pulse {
  0%, 100% { background: transparent; }
  50% { background: rgba(244, 67, 54, 0.16); }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Code blocks */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin: 14px 0 6px;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
}

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child,
.message-content h4:first-child,
.message-content h5:first-child,
.message-content h6:first-child {
  margin-top: 0;
}

.message-content h1 { font-size: 17px; }
.message-content h2 { font-size: 15px; }
.message-content h3 { font-size: 14px; }
.message-content h4,
.message-content h5,
.message-content h6 { font-size: 13px; }

.message-content blockquote {
  margin: 6px 0;
  padding: 2px 0 2px 10px;
  border-left: 3px solid var(--border);
  color: inherit;
}

.message-content ul,
.message-content ol {
  margin: 4px 0;
  padding-left: 20px;
}

.message-content li {
  margin: 2px 0;
}

.message-content li > ul,
.message-content li > ol {
  margin: 2px 0;
}

.message-content hr {
  height: 0;
  margin: 10px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.markdown-table-wrapper {
  max-width: 100%;
  margin: 8px 0;
  overflow-x: auto;
}

.message-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.message-content th,
.message-content td {
  padding: 5px 7px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.message-content th {
  background: var(--overlay-bg);
  font-weight: 600;
}

.message-content code {
  background: var(--overlay-bg);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
}

.message-content pre {
  background: var(--overlay-bg);
  padding: 8px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow-x: auto;
  margin: 0;
  white-space: pre;
}

.message-content pre code {
  background: none;
  padding: 0;
  white-space: pre;
}

.syntax-comment { color: var(--syntax-comment); font-style: italic; }
.syntax-keyword,
.syntax-decorator { color: var(--syntax-keyword); }
.syntax-string { color: var(--syntax-string); }
.syntax-number { color: var(--syntax-number); }
.syntax-variable { color: var(--syntax-variable); }
.syntax-function,
.syntax-builtin { color: var(--syntax-function); }
.syntax-property { color: var(--syntax-property); }
.syntax-tag { color: var(--syntax-tag); }
.syntax-constant,
.syntax-selector,
.syntax-type { color: var(--syntax-constant); }
.syntax-operator { color: var(--syntax-operator); }
.syntax-punctuation { color: var(--text-secondary); }

/* Fenced code block wrapper with header */
.code-block-wrapper {
  margin: 6px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: var(--overlay-bg-strong);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
}

.code-lang {
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  text-transform: lowercase;
}

.code-copy-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.code-copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background: var(--tint-soft);
}

.code-copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

/* Message-level copy button */
.msg-copy-btn {
  display: block;
  margin-top: 6px;
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
}

.message-content:hover .msg-copy-btn {
  opacity: 1;
}

/* User bubbles have the accent background, so the copy button needs
   light styling to stay legible. */
.message.user .msg-copy-btn {
  border-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.85);
}

.message.user .msg-copy-btn:hover {
  color: #fff;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.msg-copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background: var(--tint-soft);
}

.msg-copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
  opacity: 1;
}

/* Continue bar (shown when max steps reached) */
.continue-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(108, 99, 255, 0.08);
  border: 1px solid rgba(108, 99, 255, 0.2);
  border-radius: var(--radius);
  margin-top: 8px;
  animation: fadeIn 0.2s ease;
}

.continue-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.continue-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 18px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}

.continue-btn:hover {
  background: var(--accent-hover);
}

/* Planner transport/auth failure — actionable assistant card */
.message.assistant.planner-request-failure .message-content {
  background: rgba(244, 67, 54, 0.08);
  border-color: rgba(244, 67, 54, 0.3);
}

.planner-request-failure-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.planner-request-failure-message {
  color: var(--error-soft);
}

.planner-request-failure-provider {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
}

.planner-request-failure-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.planner-request-failure-action {
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid rgba(244, 67, 54, 0.35);
  border-radius: 6px;
  background: rgba(244, 67, 54, 0.06);
  color: var(--error-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.planner-request-failure-action.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.planner-request-failure-action:hover:not(:disabled),
.planner-request-failure-action:focus-visible {
  border-color: rgba(244, 67, 54, 0.6);
  background: rgba(244, 67, 54, 0.16);
  color: var(--text-primary);
}

.planner-request-failure-action.primary:hover:not(:disabled),
.planner-request-failure-action.primary:focus-visible {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #fff;
}

.planner-request-failure-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.planner-request-failure-action:disabled {
  cursor: wait;
  opacity: 0.65;
}

/* Error messages */
.message.error .message-content {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: var(--error-soft);
}

.message.error.retryable .message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.error-retry-btn,
.ask-act-handoff-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 22px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.ask-act-handoff-btn {
  margin-top: 10px;
  max-width: 100%;
  white-space: normal;
}

.error-retry-btn:hover,
.ask-act-handoff-btn:hover {
  background: var(--accent-dim);
  color: var(--text-primary);
}

.error-retry-btn:focus-visible,
.ask-act-handoff-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* WebBrain Compass quota / subscribe prompt — bare URL upgraded to a button */
.message-text.subscribe-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.subscribe-error-text {
  line-height: 1.45;
}

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

.subscribe-btn,
.subscribe-resume-btn {
  padding: 8px 22px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.subscribe-btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.subscribe-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.subscribe-resume-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  max-width: 100%;
  white-space: normal;
}

.subscribe-resume-btn:hover,
.subscribe-resume-btn:focus-visible {
  background: var(--accent-dim);
  color: var(--text-primary);
}

.subscribe-btn:focus-visible,
.subscribe-resume-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Paid-provider allowance stop — let the user raise the active guard in place. */
.message-text.cost-allowance-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.cost-allowance-error-text {
  line-height: 1.45;
}

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

.cost-allowance-bump-btn,
.cost-allowance-retry-btn,
.cost-allowance-continue-btn {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.cost-allowance-bump-btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.cost-allowance-bump-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.cost-allowance-bump-btn:disabled {
  cursor: default;
  opacity: 0.76;
}

.cost-allowance-bump-btn.cost-allowance-bumped {
  background: rgba(76, 175, 80, 0.14);
  border-color: rgba(76, 175, 80, 0.46);
  color: var(--text-primary);
}

.cost-allowance-retry-btn,
.cost-allowance-continue-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.cost-allowance-retry-btn:hover,
.cost-allowance-retry-btn:focus-visible,
.cost-allowance-continue-btn:hover,
.cost-allowance-continue-btn:focus-visible {
  background: var(--accent-dim);
  color: var(--text-primary);
}

.cost-allowance-bump-btn:focus-visible,
.cost-allowance-retry-btn:focus-visible,
.cost-allowance-continue-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cost-allowance-status {
  min-height: 15px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
}

.cost-allowance-status:empty {
  display: none;
}

.failure-recovery-card {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--bg-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.failure-recovery-message { color: var(--text-primary); }
.failure-recovery-note, .failure-recovery-status {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}
.failure-recovery-status:empty { display: none; }
.failure-recovery-actions { display: flex; gap: 8px; margin-top: 12px; }
.failure-recovery-action {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
}
.failure-recovery-action.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.failure-recovery-action:disabled { cursor: default; opacity: .55; }
.failure-recovery-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.failure-recovery-details { margin-top: 8px; color: var(--text-secondary); font-size: 11px; }
.failure-recovery-details summary { cursor: pointer; }
.failure-recovery-details pre { max-height: 180px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Clarify card — agent paused to ask user a question */
.clarify-card {
  margin: 8px 0;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius, 6px);
  background: var(--accent-dim, rgba(33, 150, 243, 0.08));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clarify-question {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.clarify-reason {
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
}

.clarify-subject {
  max-height: 120px;
  overflow: auto;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* What the page shows on WebBrain's "go ahead?" card about a step it could
   not verify (a file editor or a post draft): longer than a list item. */
.clarify-subject.clarify-content {
  max-height: 220px;
}

.clarify-research-request {
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-style: normal;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.permission-education-hint {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.permission-education-copy {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.permission-education-action {
  align-self: flex-start;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.permission-education-action:hover,
.permission-education-action:focus-visible {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.permission-education-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.clarify-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clarify-option {
  text-align: left;
  padding: 8px 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.clarify-option:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.clarify-option:disabled {
  opacity: 0.5;
  cursor: default;
}

/* The permission card's way to the skip dialog: set apart from the answers
   above it and marked as risky. */
.clarify-skip-permissions {
  margin-top: 4px;
  text-align: left;
  padding: 7px 10px;
  background: transparent;
  color: var(--warning);
  border: 1px dashed color-mix(in srgb, var(--warning) 55%, transparent);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.clarify-skip-permissions::before {
  content: "âš¡ " / "";
}

.clarify-skip-permissions:hover {
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border-color: var(--warning);
}

.clarify-skip-permissions:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.clarify-row {
  display: flex;
  gap: 6px;
}

.clarify-input {
  flex: 1;
  padding: 6px 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
}

.clarify-input:disabled {
  opacity: 0.5;
}

.clarify-submit {
  padding: 6px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.clarify-submit:disabled {
  opacity: 0.5;
  cursor: default;
}

.clarify-answered {
  border-color: var(--success, #4caf50);
  background: rgba(76, 175, 80, 0.06);
}

.clarify-your-answer {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.clarify-timeout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* The clock ring that empties with an auto-timeout: bottom-right of the clarification and plan
   review cards. */
.timeout-ring {
  flex: 0 0 auto;
  display: inline-flex;
  margin-inline-start: auto;
  color: var(--accent);
  cursor: default;
}

.timeout-ring svg { display: block; }

.timeout-ring-track {
  stroke: var(--border);
}

.timeout-ring-progress,
.timeout-ring-hand {
  stroke: currentColor;
}

.timeout-ring-progress {
  transition: stroke-dashoffset 0.25s linear, stroke 0.2s;
}

.timeout-ring-low {
  color: var(--warning);
}

@media (prefers-reduced-motion: reduce) {
  .timeout-ring-progress { transition: none; }
}

.plan-review-actions {
  align-items: center;
}

/* ─── Planner gate (issue #165) ───────────────────────────────────── */

.plan-review-card {
  margin: 8px 0;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius, 6px);
  background: var(--accent-dim, rgba(33, 150, 243, 0.08));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.plan-review-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.plan-review-confidence {
  flex-shrink: 0;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  line-height: 1.4;
}

.plan-review-hint {
  font-size: 11px;
  color: var(--text-secondary);
}

/* data-editing=true expands the optional raw-markdown editor under the
   always-visible structured step list. Structured rows stay visible. */
.plan-review-card:not([data-editing="true"]) .plan-review-hint,
.plan-review-card:not([data-editing="true"]) .plan-review-edit {
  display: none;
}

.plan-review-view {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.plan-review-summary,
.plan-review-summary-input {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.plan-review-summary-input,
.plan-review-step-input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 5px 7px;
  margin: 0;
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: 4px;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
}

.plan-review-summary-input:hover,
.plan-review-step-input:hover {
  border-color: var(--border);
  background: var(--bg-input);
}

.plan-review-summary-input:focus,
.plan-review-step-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-input);
  box-shadow: 0 0 0 1px var(--accent);
}

.plan-review-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-review-step {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 26px;
  gap: 6px;
  align-items: start;
  border-radius: 4px;
  transition: box-shadow 120ms ease, opacity 120ms ease;
}

.plan-review-step-number {
  width: 22px;
  height: 22px;
  margin-top: 3px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  cursor: grab;
  user-select: none;
}

.plan-review-step-number:hover,
.plan-review-step-number:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
  outline: none;
}

.plan-review-step-number:active {
  cursor: grabbing;
}

.plan-review-step-dragging {
  opacity: 0.45;
}

.plan-review-step-drop-before {
  box-shadow: inset 0 2px 0 var(--accent);
}

.plan-review-step-drop-after {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.plan-review-step-action,
.plan-review-step-input,
.plan-review-step-fallback {
  min-width: 0;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.plan-review-step-input {
  font-weight: 400;
}

.plan-review-step-remove {
  width: 26px;
  height: 26px;
  margin-top: 1px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.plan-review-step-remove:hover,
.plan-review-step-remove:focus-visible {
  border-color: var(--border);
  background: rgba(244, 67, 54, 0.12);
  color: var(--error, #f44336);
  outline: none;
}

.plan-review-reorder-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.3;
}

.plan-review-reorder-icon {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.plan-review-add-step {
  align-self: flex-start;
  padding: 4px 8px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.plan-review-add-step:hover,
.plan-review-add-step:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.plan-review-empty-steps {
  font-size: 11px;
  color: var(--error, #f44336);
}

.plan-review-risks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
}

.plan-review-risk {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.plan-review-skills {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
}

.plan-review-skills-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.plan-review-skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.plan-review-skill {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.plan-review-edit {
  width: 100%;
  min-height: 72px;
  padding: 8px;
  font-size: 12px;
  line-height: 1.4;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
}

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

.plan-review-approve,
.plan-review-change {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.plan-review-approve {
  background: var(--accent);
  color: #fff;
}

.plan-review-change {
  background: var(--bg3);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.plan-review-cancel {
  padding: 6px 12px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.plan-review-approve:disabled,
.plan-review-change:disabled,
.plan-review-cancel:disabled,
.plan-review-edit:disabled,
.plan-review-add-step:disabled,
.plan-review-step-remove:disabled,
.plan-review-summary-input:disabled,
.plan-review-step-input:disabled {
  opacity: 0.5;
  cursor: default;
}

.plan-reviewed {
  border-color: var(--success, #4caf50);
  background: rgba(76, 175, 80, 0.06);
}

.plan-review-expired {
  border-color: var(--border);
  background: rgba(127, 127, 127, 0.06);
}

.plan-review-expired > :not(.plan-review-timeout-footer) {
  opacity: 0.5;
  filter: grayscale(0.6);
  pointer-events: none;
}

.plan-review-expired .plan-review-actions {
  display: none;
}

.plan-review-expired .plan-review-summary-input:disabled,
.plan-review-expired .plan-review-step-input:disabled {
  opacity: 1;
}

/* Kept in the DOM so the turn survives in exported history; never shown. */
.plan-review-timeout-history-note {
  display: none;
}

.plan-review-timeout-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.plan-review-timeout-title {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
}

.plan-review-timeout-hint {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.plan-review-retry {
  margin-top: 3px;
  padding: 7px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.plan-review-retry:hover:not(:disabled) {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.plan-review-retry:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.plan-review-retry:disabled {
  cursor: default;
  opacity: 0.6;
}

.plan-auto-approved-note {
  margin: 6px 0;
  font-size: 11px;
  color: var(--text-secondary);
}

.planner-fallback-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 2px 0 4px;
  padding: 5px 7px;
  border-inline-start: 2px solid var(--warning);
  border-radius: 0 5px 5px 0;
  background: color-mix(in srgb, var(--warning) 7%, transparent);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
}

.planner-fallback-note-icon {
  display: grid;
  flex: 0 0 14px;
  place-items: center;
  width: 14px;
  height: 14px;
  margin-top: 1px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--warning);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.planner-fallback-note-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.plan-review-note {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.completion-confetti {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 9999;
}

.confetti-piece {
  position: absolute;
  top: -18px;
  left: var(--x);
  width: var(--size);
  height: var(--height);
  border-radius: 1px;
  opacity: 0;
  transform: translate3d(0, -18px, 0) rotate(0deg);
  animation: completion-confetti-fall var(--duration) cubic-bezier(0.18, 0.72, 0.24, 1) var(--delay) forwards;
}

@keyframes completion-confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -18px, 0) rotate(0deg);
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift), calc(100vh + 24px), 0) rotate(var(--rotation));
  }
}

@media (prefers-reduced-motion: reduce) {
  .completion-confetti {
    display: none;
  }
}

/* Compass quota recovery: controls wrap within narrow side panels. */
.compass-quota { width: 100%; min-width: 0; }
.quota-choices, .quota-composers, .quota-providers { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.compass-quota button { appearance: none; font: inherit; border: 1px solid var(--accent); background: transparent; color: var(--accent); max-width: 100%; white-space: normal; overflow-wrap: anywhere; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.quota-choices > button { flex: 1 1 100%; text-align: start; border: 1px solid var(--accent); background: var(--accent-dim); color: var(--text-primary); }
.quota-choices > .subscribe-btn { background: var(--accent); color: white; }
.quota-claim, .quota-providers label { width: 100%; min-width: 0; }
.quota-claim:empty, .quota-providers:empty { display: none; }
.quota-claim label { display: block; margin-block: 10px 6px; }
.quota-claim input, .quota-claim textarea, .quota-claim select, .quota-providers select { display: block; box-sizing: border-box; width: 100%; min-width: 0; margin-block: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-secondary); color: var(--text-primary); }
.quota-claim textarea { resize: vertical; }
.compass-quota :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.quota-balance, .quota-reset { font-size: 12px; overflow-wrap: anywhere; }
.quota-status { line-height: 1.45; overflow-wrap: anywhere; }
.compass-quota [hidden] { display: none; }

.page-feedback-note {
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 2px solid currentColor;
  opacity: .8;
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* Top-layer popover stays above the composer without clipping chat content. */
.history-popover {
  inset: auto;
  margin: 0;
  width: min(320px, calc(100vw - 16px));
  max-height: min(420px, 65vh);
  overflow: auto;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 8px 32px #0004;
  font: inherit;
  font-size: 12px;
}
.history-popover p { margin: 0 0 8px; color: var(--text-secondary); }
.history-popover-record { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.history-popover-record > div { flex: 1; min-width: 0; }
.history-popover-record strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-popover-record small { display: block; margin-top: 4px; color: var(--text-secondary); }
.history-popover button { border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: var(--bg-input); color: var(--text-primary); cursor: pointer; font: inherit; }
.history-popover button:disabled { opacity: .5; cursor: default; }
.history-popover .history-more { width: 100%; margin-top: 10px; }