/* Final feature overrides. Loaded after legacy toolbar.css. */
#topbar { scrollbar-width: none !important; }
#topbar::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }

.ai-context-toolbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 7px !important;
  padding: 9px 12px 10px !important;
}

.topbar-scroll-rail {
  position: fixed !important;
  z-index: 200001 !important;
  top: 43px !important;
  left: 8px !important;
  right: 8px !important;
  height: 7px !important;
  display: flex !important;
  align-items: center !important;
  pointer-events: auto !important;
}
.topbar-scroll-track { pointer-events: auto !important; }

.project-search-results {
  top: 54px !important;
  max-height: calc(100dvh - 66px) !important;
}

.ai-clear-history {
  grid-column: auto !important;
}

.ai-context-toolbar .ai-clear-history.is-confirming {
  color: #fee2e2 !important;
  border-color: rgba(248, 113, 113, .72) !important;
  background: rgba(127, 29, 29, .34) !important;
  box-shadow: inset 0 0 0 1px rgba(254, 202, 202, .08), 0 0 14px rgba(239, 68, 68, .14) !important;
}

.ai-context-toolbar .ai-deep-analysis-toggle.is-confirming {
  color: #fef3c7 !important;
  border-color: rgba(251, 191, 36, .72) !important;
  background: linear-gradient(180deg, rgba(120, 53, 15, .48), rgba(69, 26, 3, .42)) !important;
  box-shadow: inset 0 0 0 1px rgba(254, 243, 199, .08), 0 0 14px rgba(245, 158, 11, .18) !important;
}

.ai-context-toolbar .ai-deep-analysis-toggle.is-confirming .ai-deep-analysis-state {
  color: #fff7ed !important;
  background: rgba(245, 158, 11, .24) !important;
}

/* All five actions share one visual language. Purple means "active", not merely important. */
.ai-context-toolbar #aiAddSelectionBtn {
  border-color: rgba(148, 163, 184, .18) !important;
  color: #cbd5e1 !important;
  background: rgba(255, 255, 255, .045) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025) !important;
  transform: none;
}

.ai-context-toolbar #aiAddSelectionBtn:hover {
  color: #eef2ff !important;
  border-color: rgba(167, 139, 250, .44) !important;
  background: rgba(124, 58, 237, .12) !important;
}

.ai-context-toolbar #aiAddSelectionBtn.active,
.ai-context-toolbar #aiAddSelectionBtn[aria-pressed="true"] {
  color: #ffffff !important;
  border-color: rgba(167, 139, 250, .9) !important;
  background: linear-gradient(135deg, rgba(109, 40, 217, .86), rgba(124, 58, 237, .62)) !important;
  box-shadow:
    inset 0 0 0 1px rgba(221, 214, 254, .14),
    0 0 15px rgba(139, 92, 246, .4) !important;
}

.ai-journal-mode.active,
.ai-journal-mode[aria-pressed="true"] {
  color: #f5f3ff;
  border-color: rgba(139, 92, 246, .75);
  background: rgba(124, 58, 237, .28);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, .18);
}

.ai-workspace-mode-status {
  grid-column: 1 / -1;
  min-height: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 3px;
  color: #8f9bad;
  font: 650 11.5px/1.2 system-ui, sans-serif;
}

.ai-workspace-mode-label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.ai-workspace-mode-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #64748b;
}

.ai-workspace-mode-status.is-journal {
  color: #c4b5fd;
}

.ai-workspace-mode-status.is-journal .ai-workspace-mode-dot {
  background: #8b5cf6;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, .13);
}

.ai-context-toolbar .ai-deep-analysis-toggle {
  grid-column: 1 / -1;
  justify-self: center;
  position: relative;
  min-width: 164px;
  width: max-content;
  max-width: calc(100% - 88px);
  min-height: 36px;
  margin: 1px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 1px solid rgba(167, 139, 250, .34);
  border-radius: 999px;
  color: #c4b5d8;
  background: linear-gradient(180deg, rgba(31, 41, 58, .96), rgba(15, 23, 42, .94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .045),
    inset 0 -1px 0 rgba(0, 0, 0, .18);
  font: 750 11.5px/1 system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ai-context-toolbar .ai-deep-analysis-toggle::before,
.ai-context-toolbar .ai-deep-analysis-toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30px;
  height: 1px;
  pointer-events: none;
  opacity: .72;
}

.ai-context-toolbar .ai-deep-analysis-toggle::before {
  right: calc(100% + 10px);
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, .28));
}

.ai-context-toolbar .ai-deep-analysis-toggle::after {
  left: calc(100% + 10px);
  background: linear-gradient(90deg, rgba(148, 163, 184, .28), transparent);
}

.ai-context-toolbar .ai-deep-analysis-toggle:hover {
  color: #d8d3ff;
  border-color: rgba(167, 139, 250, .62);
  background: linear-gradient(180deg, rgba(63, 43, 97, .7), rgba(30, 24, 54, .92));
  transform: translateY(-1px);
}

.ai-context-toolbar .ai-deep-analysis-toggle:focus-visible {
  outline: 2px solid rgba(167, 139, 250, .9);
  outline-offset: 2px;
}

.ai-context-toolbar .ai-deep-analysis-toggle.active,
.ai-context-toolbar .ai-deep-analysis-toggle[aria-pressed="true"] {
  color: #ffffff;
  border-color: rgba(167, 139, 250, .92);
  background: linear-gradient(135deg, rgba(109, 40, 217, .88), rgba(124, 58, 237, .68));
  box-shadow:
    0 0 0 1px rgba(196, 181, 253, .16) inset,
    0 0 14px rgba(139, 92, 246, .48),
    0 0 28px rgba(109, 40, 217, .24);
}

.ai-context-toolbar .ai-deep-analysis-toggle.active::before,
.ai-context-toolbar .ai-deep-analysis-toggle[aria-pressed="true"]::before,
.ai-context-toolbar .ai-deep-analysis-toggle.active::after,
.ai-context-toolbar .ai-deep-analysis-toggle[aria-pressed="true"]::after {
  opacity: 1;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, .7));
}

.ai-context-toolbar .ai-deep-analysis-toggle.active::after,
.ai-context-toolbar .ai-deep-analysis-toggle[aria-pressed="true"]::after {
  background: linear-gradient(90deg, rgba(167, 139, 250, .7), transparent);
}

.ai-context-toolbar .ai-deep-analysis-toggle.active .ai-deep-analysis-icon,
.ai-context-toolbar .ai-deep-analysis-toggle[aria-pressed="true"] .ai-deep-analysis-icon {
  color: #ddd6fe;
  text-shadow: 0 0 8px rgba(221, 214, 254, .95);
}

.ai-quick-prompts {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.ai-quick-prompts::-webkit-scrollbar {
  display: none;
}

.ai-context-toolbar .ai-quick-prompt {
  min-height: 28px !important;
  flex: 0 0 auto;
  padding: 0 9px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 999px;
  color: #9aa7b9;
  background: rgba(15, 23, 42, .38);
  font: 600 10.5px/1 system-ui, sans-serif;
  box-shadow: none;
  transform: none;
}

.ai-context-toolbar .ai-quick-prompt:hover {
  color: #e2e8f0;
  border-color: rgba(139, 92, 246, .38);
  background: rgba(124, 58, 237, .12);
  transform: none;
}

.ai-mode-message.is-journal {
  color: #d8ccff !important;
  border-color: rgba(139, 92, 246, .5) !important;
  background: rgba(124, 58, 237, .14) !important;
}

/* Agent v2: four actions, one accent state, no sticky discipline mode. */
@property --ai-workspace-progress {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

.ai-context-toolbar > button {
  min-width: 0 !important;
  width: 100% !important;
  min-height: 42px !important;
}

.ai-context-toolbar .ai-deep-analysis-toggle {
  grid-column: auto !important;
  justify-self: stretch !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 42px !important;
  margin: 0 !important;
  padding: 0 10px !important;
  border-radius: 11px !important;
  --ai-workspace-progress: 0%;
  background:
    linear-gradient(135deg, rgba(109, 40, 217, .94), rgba(124, 58, 237, .78)) left center / var(--ai-workspace-progress) 100% no-repeat,
    linear-gradient(180deg, rgba(31, 41, 58, .96), rgba(15, 23, 42, .94)) !important;
  transition:
    color .16s ease,
    border-color .16s ease,
    box-shadow .16s ease,
    transform .16s ease,
    --ai-workspace-progress .22s ease !important;
}

.ai-context-toolbar .ai-deep-analysis-toggle::before,
.ai-context-toolbar .ai-deep-analysis-toggle::after {
  display: none !important;
}

.ai-deep-analysis-state {
  margin-left: auto;
  padding: 3px 6px;
  border-radius: 999px;
  color: #94a3b8;
  background: rgba(148, 163, 184, .1);
  font: 750 9px/1 system-ui, sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ai-deep-analysis-toggle.active .ai-deep-analysis-state,
.ai-deep-analysis-toggle[aria-pressed="true"] .ai-deep-analysis-state {
  color: #ffffff;
  background: rgba(255, 255, 255, .18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

/* Quiet session cost: part of the input texture, never another toolbar pill. */
.ai-session-cost {
  min-height: 11px;
  margin: -3px 3px 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: rgba(148, 163, 184, .42);
  font: 620 9.5px/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: .045em;
  pointer-events: none;
  user-select: none;
}

.ai-evidence-strip {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid rgba(100, 116, 139, .2);
}

.ai-evidence-strip-title {
  margin-bottom: 8px;
  color: #64748b;
  font: 750 10.5px/1.2 system-ui, sans-serif;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.ai-evidence-strip-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.ai-evidence-card {
  flex: 0 0 132px;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(100, 116, 139, .22);
  border-radius: 9px;
  color: #334155;
  background: #f8fafc;
  text-align: left;
  cursor: default;
}

.ai-evidence-card:hover {
  border-color: rgba(124, 58, 237, .46);
  box-shadow: 0 5px 16px rgba(15, 23, 42, .12);
}

.ai-evidence-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.ai-evidence-card img {
  display: block;
  width: 100%;
  height: 82px;
  object-fit: cover;
  background: #e2e8f0;
}

.ai-evidence-link {
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 6px 7px 7px;
  border: 0;
  color: #334155;
  background: transparent;
  font: 650 10px/1.25 system-ui, sans-serif;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ai-evidence-link:disabled { cursor: default; opacity: .72; }
