/* ==========================================================================
   SCAN — Smart search relay styles using Fusion design tokens
   ========================================================================== */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.scan-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Sidebar — persistent on desktop, hidden on mobile
   -------------------------------------------------------------------------- */

.scan-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  background: rgba(8, 6, 0, 0.97);
  border-right: 1px solid rgba(255, 85, 0, 0.1);
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 4.5rem 0 1rem;
}

.sidebar-new-chat {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--zech-primary);
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  margin: 0 0.75rem 0.5rem;
  border: 1px solid rgba(255, 85, 0, 0.2);
  text-align: center;
  transition: background 0.2s, border-color 0.2s;
}

.sidebar-new-chat:hover {
  background: rgba(255, 85, 0, 0.06);
  border-color: var(--zech-primary);
}

.sidebar-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--zech-text-dim);
  padding: 0.75rem 1.25rem 0.4rem;
  opacity: 0.6;
}

.sidebar-chats {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.5rem;
}

.sidebar-chat-item {
  display: block;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--zech-text-dim);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.sidebar-chat-item:hover {
  color: var(--zech-text);
  border-left-color: var(--zech-primary);
  background: rgba(255, 85, 0, 0.03);
}

.sidebar-empty {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  color: var(--zech-text-dim);
  opacity: 0.5;
  padding: 0.75rem 1.25rem;
}

.sidebar-history-link {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--zech-text-dim);
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(255, 85, 0, 0.08);
  text-align: center;
  transition: color 0.2s;
}

.sidebar-history-link:hover {
  color: var(--zech-primary);
}

/* Offset main content for sidebar on desktop */
body:has(.scan-sidebar) .scan-main {
  margin-left: 240px;
}

body:has(.scan-sidebar) .zech-footer {
  margin-left: 240px;
}

/* Nav Recent Chats — for mobile nav menu only */

.nav-recent-divider {
  height: 1px;
  background: rgba(255, 85, 0, 0.08);
  margin: 0.25rem 0;
}

.nav-recent-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--zech-text-dim);
  opacity: 0.6;
}

.nav-recent-item {
  font-family: 'Rajdhani', sans-serif !important;
  font-size: 0.85rem !important;
  font-weight: 500;
  letter-spacing: 0 !important;
  text-transform: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-history-link {
  font-family: 'Orbitron', sans-serif !important;
  font-size: 0.55rem !important;
  letter-spacing: 2px !important;
  text-transform: uppercase !important;
  opacity: 0.6;
}

.nav-history-link:hover {
  opacity: 1;
}

/* Desktop: hide nav recents (sidebar is visible) */
@media (min-width: 769px) {
  .nav-recent-divider,
  .nav-recent-label,
  .nav-recent-item {
    display: none;
  }
}

/* Mobile: hide sidebar (nav menu has recents instead) */
@media (max-width: 768px) {
  .scan-sidebar {
    display: none;
  }

  body:has(.scan-sidebar) .scan-main,
  body:has(.scan-sidebar) .zech-footer {
    margin-left: 0;
  }
}

/* --------------------------------------------------------------------------
   Home Page Recent Searches
   -------------------------------------------------------------------------- */

.scan-recents {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.scan-recent-item {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--zech-text-dim);
  text-decoration: none;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 85, 0, 0.06);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

.scan-recent-item:hover {
  color: var(--zech-text);
}

.scan-recents-viewall {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--zech-text-dim);
  text-decoration: none;
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  opacity: 0.6;
  transition: color 0.2s, opacity 0.2s;
}

.scan-recents-viewall:hover {
  color: var(--zech-primary);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Search Section
   -------------------------------------------------------------------------- */

.scan-search-section {
  text-align: center;
  width: 100%;
  max-width: 640px;
}

.scan-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--zech-text-dim);
  margin-bottom: 2rem;
}

.scan-form {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Mode Split Button
   -------------------------------------------------------------------------- */

.scan-form-row {
  display: flex;
  align-items: stretch;
  border: 1px solid rgba(255, 85, 0, 0.15);
  background: rgba(255, 85, 0, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}

.scan-form-row:focus-within {
  border-color: var(--zech-primary);
  background: rgba(255, 85, 0, 0.06);
  box-shadow: 0 0 20px rgba(255, 85, 0, 0.1), inset 0 0 20px rgba(255, 85, 0, 0.03);
}

.scan-form-row .scan-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
}

.scan-form-row .scan-input:focus {
  border: none;
  box-shadow: none;
}

.scan-mode-split {
  display: flex;
  align-items: stretch;
  position: relative;
  flex-shrink: 0;
}

.scan-mode-submit {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--zech-primary);
  background: transparent;
  border: none;
  padding: 0 1rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.scan-mode-submit:hover {
  background: rgba(255, 85, 0, 0.06);
}

.scan-mode-divider {
  width: 1px;
  background: rgba(255, 85, 0, 0.15);
  align-self: stretch;
}

.scan-form-row:focus-within .scan-mode-divider {
  background: var(--zech-primary);
}

.scan-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  background: transparent;
  border: none;
  color: var(--zech-primary);
  cursor: pointer;
  transition: background 0.2s;
  padding: 0;
}

.scan-mode-toggle:hover {
  background: rgba(255, 85, 0, 0.06);
}

.scan-mode-toggle svg {
  transition: transform 0.2s;
}

.scan-mode-split.is-open .scan-mode-toggle svg {
  transform: rotate(180deg);
}

.scan-mode-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: rgba(8, 6, 0, 0.97);
  border: 1px solid rgba(255, 85, 0, 0.2);
  min-width: 200px;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 85, 0, 0.05);
}

.scan-mode-menu[hidden] {
  display: none;
}

.scan-mode-option {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: none;
  border-left: 2px solid transparent;
  border-bottom: 1px solid rgba(255, 85, 0, 0.06);
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.scan-mode-option:last-child {
  border-bottom: none;
}

.scan-mode-option:hover {
  background: rgba(255, 85, 0, 0.06);
}

.scan-mode-option.active {
  background: rgba(255, 85, 0, 0.08);
  border-left-color: var(--zech-primary);
}

.scan-mode-option-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--zech-primary);
}

.scan-mode-option.active .scan-mode-option-name {
  color: var(--zech-text);
}

.scan-mode-option-desc {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  color: var(--zech-text-dim);
  margin-top: 0.1rem;
  opacity: 0.7;
}

.scan-input {
  width: 100%;
  padding: 1rem 1.5rem;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--zech-text);
  background: rgba(255, 85, 0, 0.03);
  border: 1px solid rgba(255, 85, 0, 0.15);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-sizing: border-box;
}

.scan-input::placeholder {
  color: var(--zech-text-dim);
  opacity: 0.6;
}

.scan-input:focus {
  border-color: var(--zech-primary);
  box-shadow: 0 0 20px rgba(255, 85, 0, 0.1), inset 0 0 20px rgba(255, 85, 0, 0.03);
}

textarea.scan-input-auto {
  resize: none;
  overflow: hidden;
  field-sizing: content;
  min-height: calc(1.2em + 2rem);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Autocomplete Suggestions Dropdown
   -------------------------------------------------------------------------- */

.scan-suggest-dropdown {
  position: absolute;
  top: calc(100% + 1px);
  left: -1px;
  right: -1px;
  background: rgba(8, 6, 0, 0.97);
  border: 1px solid rgba(255, 85, 0, 0.2);
  border-top: none;
  z-index: 200;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 85, 0, 0.05);
}

.scan-suggest-dropdown[hidden] {
  display: none;
}

.scan-suggest-item {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--zech-text-dim);
  padding: 0.55rem 1.5rem;
  border-left: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.scan-suggest-item:hover,
.scan-suggest-item.is-selected {
  color: var(--zech-text);
  border-left-color: var(--zech-primary);
  background: rgba(255, 85, 0, 0.03);
}

/* --------------------------------------------------------------------------
   Unauthorized Section
   -------------------------------------------------------------------------- */

.scan-unauthorized-section {
  text-align: center;
  max-width: 560px;
}

.scan-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--zech-text);
  margin-bottom: 1rem;
}

.scan-description {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  color: var(--zech-text-dim);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Chat Section
   -------------------------------------------------------------------------- */

.chat-section {
  width: 100%;
  max-width: 760px;
  align-self: flex-start;
  padding-top: 2rem;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.chat-turn {
  margin-bottom: 1.5rem;
}

.chat-user-query {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--zech-text);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 85, 0, 0.1);
}

.chat-assistant-events {
  margin-bottom: 0.75rem;
}

.chat-assistant-response {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--zech-text-dim);
  line-height: 1.7;
}

.chat-assistant-response p {
  margin: 0 0 1em;
}

.chat-assistant-response h2,
.chat-assistant-response h3,
.chat-assistant-response h4 {
  font-family: 'Orbitron', sans-serif;
  color: var(--zech-text);
  margin: 1.5em 0 0.5em;
}

.chat-assistant-response h2 { font-size: 1.1rem; letter-spacing: 2px; }
.chat-assistant-response h3 { font-size: 0.95rem; letter-spacing: 1.5px; }
.chat-assistant-response h4 { font-size: 0.85rem; letter-spacing: 1px; }

.chat-assistant-response strong {
  color: var(--zech-text);
  font-weight: 600;
}

.chat-assistant-response a {
  color: var(--zech-primary);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 85, 0, 0.2);
  transition: border-color 0.2s;
}

.chat-assistant-response a:hover {
  border-color: var(--zech-primary);
}

.chat-assistant-response code {
  font-family: monospace;
  font-size: 0.9em;
  background: rgba(255, 85, 0, 0.06);
  padding: 0.15em 0.4em;
  border: 1px solid rgba(255, 85, 0, 0.1);
}

.chat-assistant-response pre.research-code {
  background: rgba(255, 85, 0, 0.03);
  border: 1px solid rgba(255, 85, 0, 0.1);
  padding: 1rem;
  overflow-x: auto;
  margin: 1em 0;
}

.chat-assistant-response pre.research-code code {
  background: none;
  border: none;
  padding: 0;
}

.chat-assistant-response ul,
.chat-assistant-response ol {
  padding-left: 1.5em;
  margin: 0.5em 0 1em;
}

.chat-assistant-response li {
  margin-bottom: 0.3em;
}

.chat-assistant-response a.citation {
  font-size: 0.8em;
  vertical-align: super;
  line-height: 1;
  border-bottom: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.chat-assistant-response a.citation:hover {
  opacity: 1;
}

.chat-assistant-response .table-wrap {
  overflow-x: auto;
  margin: 1em 0;
}

.chat-assistant-response table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}

.chat-assistant-response th,
.chat-assistant-response td {
  padding: 0.5em 0.75em;
  border: 1px solid rgba(255, 85, 0, 0.15);
}

.chat-assistant-response th {
  background: rgba(255, 85, 0, 0.06);
  color: var(--zech-text);
  font-weight: 600;
  font-size: 0.85em;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.chat-assistant-response td {
  background: rgba(255, 85, 0, 0.02);
}

.chat-active-turn[hidden] {
  display: none;
}

.chat-followup {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 85, 0, 0.1);
}

/* --------------------------------------------------------------------------
   Research Section (legacy)
   -------------------------------------------------------------------------- */

.research-section {
  width: 100%;
  max-width: 760px;
  align-self: flex-start;
  padding-top: 2rem;
}

.research-query {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--zech-text);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 85, 0, 0.1);
}

.research-response {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--zech-text-dim);
  line-height: 1.7;
  min-height: 4rem;
}

.research-response p {
  margin: 0 0 1em;
}

.research-response h2,
.research-response h3,
.research-response h4 {
  font-family: 'Orbitron', sans-serif;
  color: var(--zech-text);
  margin: 1.5em 0 0.5em;
}

.research-response h2 { font-size: 1.1rem; letter-spacing: 2px; }
.research-response h3 { font-size: 0.95rem; letter-spacing: 1.5px; }
.research-response h4 { font-size: 0.85rem; letter-spacing: 1px; }

.research-response strong {
  color: var(--zech-text);
  font-weight: 600;
}

.research-response a {
  color: var(--zech-primary);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 85, 0, 0.2);
  transition: border-color 0.2s;
}

.research-response a:hover {
  border-color: var(--zech-primary);
}

.research-response code {
  font-family: monospace;
  font-size: 0.9em;
  background: rgba(255, 85, 0, 0.06);
  padding: 0.15em 0.4em;
  border: 1px solid rgba(255, 85, 0, 0.1);
}

.research-response pre.research-code {
  background: rgba(255, 85, 0, 0.03);
  border: 1px solid rgba(255, 85, 0, 0.1);
  padding: 1rem;
  overflow-x: auto;
  margin: 1em 0;
}

.research-response pre.research-code code {
  background: none;
  border: none;
  padding: 0;
}

.research-response ul,
.research-response ol {
  padding-left: 1.5em;
  margin: 0.5em 0 1em;
}

.research-response li {
  margin-bottom: 0.3em;
}

.research-response a.citation {
  font-size: 0.8em;
  vertical-align: super;
  line-height: 1;
  border-bottom: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.research-response a.citation:hover {
  opacity: 1;
}

.research-response .table-wrap {
  overflow-x: auto;
  margin: 1em 0;
}

.research-response table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}

.research-response th,
.research-response td {
  padding: 0.5em 0.75em;
  border: 1px solid rgba(255, 85, 0, 0.15);
}

.research-response th {
  background: rgba(255, 85, 0, 0.06);
  color: var(--zech-text);
  font-weight: 600;
  font-size: 0.85em;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.research-response td {
  background: rgba(255, 85, 0, 0.02);
}

.research-cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--zech-primary);
  vertical-align: text-bottom;
  animation: cursor-blink 0.8s step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.title-cursor {
  display: inline-block;
  width: 6px;
  height: 0.9em;
  background: var(--zech-primary);
  vertical-align: text-bottom;
  animation: cursor-blink 0.8s step-end infinite;
  margin-left: 2px;
}

/* --------------------------------------------------------------------------
   Research Pipeline
   -------------------------------------------------------------------------- */

.research-pipeline {
  margin-bottom: 1.5rem;
}

.pipeline-status {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--zech-primary);
  margin-bottom: 0.75rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.pipeline-status.visible {
  opacity: 1;
}

.pipeline-details {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pipeline-detail {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  color: var(--zech-text-dim);
  padding: 0.3rem 0.6rem;
  background: rgba(255, 85, 0, 0.03);
  border-left: 2px solid rgba(255, 85, 0, 0.15);
  opacity: 0;
  animation: detail-fade-in 0.3s forwards;
}

.pipeline-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--zech-primary);
  margin-right: 0.5rem;
}

@keyframes detail-fade-in {
  to { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Tool-Call Hierarchy
   -------------------------------------------------------------------------- */

.tool-group {
  border-left: 2px solid rgba(255, 85, 0, 0.15);
  padding: 0.4rem 0 0.4rem 0.6rem;
  margin-bottom: 0.35rem;
  opacity: 0;
  animation: detail-fade-in 0.3s forwards;
}

.tool-group.is-running {
  border-left-color: var(--zech-primary);
}

.tool-group.is-done {
  border-left-color: rgba(255, 85, 0, 0.15);
}

.tool-group.is-done .tool-header {
  cursor: pointer;
}

.tool-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.4rem;
}

.tool-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--zech-primary);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.tool-group.is-done:not(.is-collapsed) .tool-chevron,
.tool-summary.is-expanded .tool-chevron {
  transform: rotate(90deg);
}

.tool-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--zech-primary);
  white-space: nowrap;
}

.tool-topic {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  color: var(--zech-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Spinner — cyan ring */
.tool-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 85, 0, 0.2);
  border-top-color: var(--zech-primary);
  border-radius: 50%;
  animation: tool-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.tool-spinner-sm {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(255, 85, 0, 0.2);
  border-top-color: var(--zech-primary);
  border-radius: 50%;
  animation: tool-spin 0.7s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

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

/* Done icon — cyan checkmark */
.tool-icon-done {
  font-size: 0.7rem;
  color: var(--zech-primary);
  flex-shrink: 0;
  line-height: 1;
}

/* Subline — shows currently running child */
.tool-subline {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  color: var(--zech-text-dim);
  padding-left: 1.3rem;
  margin-top: 0.15rem;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-subline[hidden] {
  display: none;
}

/* Sources strip — shown when done */
.tool-sources {
  display: flex;
  align-items: center;
  gap: 0;
  padding-left: 1.3rem;
  margin-top: 0.2rem;
}

.tool-sources .tool-source-count {
  margin-left: 0.4rem;
}

.tool-sources[hidden] {
  display: none;
}

.tool-favicon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  vertical-align: middle;
  flex-shrink: 0;
  position: relative;
  transition: margin 0.15s ease;
}

/* Overlap favicons by ~1/3 in stacking containers */
.tool-sources .tool-favicon + .tool-favicon,
.tool-summary-favicons .tool-favicon + .tool-favicon {
  margin-left: -5px;
}

.tool-sources .tool-favicon:hover,
.tool-summary-favicons .tool-favicon:hover {
  z-index: 1;
}

.tool-sources .tool-favicon:hover + .tool-favicon,
.tool-summary-favicons .tool-favicon:hover + .tool-favicon {
  margin-left: 1px;
}

.tool-source-count {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  color: var(--zech-text-dim);
  opacity: 0.7;
  white-space: nowrap;
}

/* Body — collapsible children list */
.tool-body {
  padding-left: 1.3rem;
  margin-top: 0.25rem;
}

.tool-group.is-collapsed .tool-body {
  display: none;
}

.tool-children {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tool-child {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  color: var(--zech-text-dim);
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.35rem;
  opacity: 0;
  animation: detail-fade-in 0.25s forwards;
}

.tool-child.is-done {
  opacity: 0.7;
}

.tool-child.has-content {
  cursor: pointer;
}

.tool-child.has-content:hover {
  opacity: 1;
}

.tool-child-content {
  width: 100%;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--zech-text-dim);
  background: rgba(255, 85, 0, 0.03);
  border: 1px solid rgba(255, 85, 0, 0.08);
  border-radius: 2px;
  padding: 0.5rem 0.6rem;
  margin-top: 0.25rem;
  max-height: 12rem;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.tool-child-content[hidden] {
  display: none;
}

/* Agent message — reasoning shown inside tool groups */
.tool-message {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--zech-text-dim);
  opacity: 0.7;
  padding: 0.3rem 0;
  animation: detail-fade-in 0.25s forwards;
}

/* Summary — collapsed overview of all tool groups */
.tool-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-left: 2px solid rgba(255, 85, 0, 0.15);
  cursor: pointer;
  transition: border-color 0.2s;
}

.tool-summary:hover {
  border-left-color: var(--zech-primary);
}

.tool-summary-count {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--zech-primary);
  white-space: nowrap;
}

.tool-summary-favicons {
  display: flex;
  align-items: center;
  gap: 0;
}

.tool-summary-body {
  margin-top: 0.35rem;
  padding-left: 0.6rem;
}

.tool-summary-body[hidden] {
  display: none;
}

/* Token usage — inline per-call */
.tool-usage {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.7rem;
  color: var(--zech-text-dim);
  opacity: 0.5;
  margin-left: 0.5rem;
  white-space: nowrap;
}

/* Token usage — aggregate breakdown */
.tool-usage-total {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  color: var(--zech-text-dim);
  opacity: 0.6;
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-top: 1px solid rgba(255, 85, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pipeline-clarification {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 85, 0, 0.2);
  background: rgba(255, 85, 0, 0.03);
}

.clarification-question {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  color: var(--zech-text);
  margin-bottom: 0.5rem;
}

.clarification-form {
  margin-top: 0.5rem;
}

.clarification-input {
  font-size: 0.95rem !important;
  padding: 0.6rem 1rem !important;
}

.research-followup {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 85, 0, 0.1);
}

.research-error {
  color: #ff4757;
}

/* --------------------------------------------------------------------------
   Response Actions (copy / download)
   -------------------------------------------------------------------------- */

.response-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 85, 0, 0.08);
}

.response-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 85, 0, 0.1);
  color: var(--zech-text-dim);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.response-action-btn:hover {
  color: var(--zech-primary);
  border-color: var(--zech-primary);
  box-shadow: 0 0 8px rgba(255, 85, 0, 0.15);
}

.response-actions-feedback {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  color: var(--zech-primary);
  margin-left: 0.35rem;
  animation: response-feedback-fade 1.5s ease forwards;
}

@keyframes response-feedback-fade {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   Deep Research — Iteration & Evaluation indicators
   -------------------------------------------------------------------------- */

.deep-iteration {
  padding: 0.4rem 0.6rem;
  margin: 0.5rem 0 0.25rem;
  border-left: 2px solid rgba(255, 85, 0, 0.3);
  opacity: 0;
  animation: detail-fade-in 0.3s forwards;
}

.deep-iteration-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--zech-primary);
  opacity: 0.7;
}

.deep-evaluation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  margin: 0.25rem 0 0.5rem;
  border-left: 2px solid rgba(255, 85, 0, 0.15);
  background: rgba(255, 85, 0, 0.02);
  opacity: 0;
  animation: detail-fade-in 0.3s forwards;
}

.deep-eval-icon {
  font-size: 0.75rem;
  color: var(--zech-primary);
  flex-shrink: 0;
}

.deep-eval-confidence {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--zech-primary);
  white-space: nowrap;
}

.deep-eval-detail {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  color: var(--zech-text-dim);
  opacity: 0.7;
}

.deep-eval-status {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--zech-text-dim);
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   History Page
   -------------------------------------------------------------------------- */

.history-section {
  width: 100%;
  max-width: 760px;
  align-self: flex-start;
  padding-top: 2rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 1rem;
}

.history-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  font-family: 'Rajdhani', sans-serif;
  color: var(--zech-text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.history-item:hover {
  color: var(--zech-text);
  border-left-color: var(--zech-primary);
  background: rgba(255, 85, 0, 0.03);
}

.history-item-title {
  font-size: 0.95rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-date {
  font-size: 0.75rem;
  opacity: 0.5;
  white-space: nowrap;
  flex-shrink: 0;
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.history-item-meta .tool-sources {
  padding-left: 0;
  margin-top: 0;
}


.history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 85, 0, 0.08);
}

.history-page-link {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--zech-primary);
  text-decoration: none;
  transition: opacity 0.2s;
}

.history-page-link:hover {
  opacity: 0.8;
}

.history-page-disabled {
  opacity: 0.3;
  pointer-events: none;
}

.history-page-info {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--zech-text-dim);
}

.history-empty {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  color: var(--zech-text-dim);
  opacity: 0.5;
  text-align: center;
  padding: 3rem 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .scan-input {
    font-size: 1rem;
    padding: 0.85rem 1.25rem;
  }

  .scan-mode-submit {
    padding: 0 0.6rem;
    font-size: 0.45rem;
    letter-spacing: 2px;
  }

  .scan-mode-toggle {
    width: 1.6rem;
  }

  .research-query {
    font-size: 1.2rem;
  }

  .research-response {
    font-size: 1rem;
  }

  .chat-user-query {
    font-size: 1.1rem;
  }

  .chat-assistant-response {
    font-size: 1rem;
  }

  .scan-suggest-item {
    font-size: 0.9rem;
    padding: 0.5rem 1.25rem;
  }
}

/* ==========================================================================
   Search Results
   ========================================================================== */

.search-results-section {
  width: 100%;
  max-width: 760px;
  align-self: flex-start;
  padding-top: 2rem;
}

.search-bar {
  width: 100%;
  margin-bottom: 2rem;
}

.search-bar .scan-form-row {
  display: flex;
  align-items: stretch;
  border: 1px solid rgba(255, 85, 0, 0.15);
  background: rgba(255, 85, 0, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}

.search-bar .scan-form-row:focus-within {
  border-color: var(--zech-primary);
  background: rgba(255, 85, 0, 0.06);
  box-shadow: 0 0 20px rgba(255, 85, 0, 0.1), inset 0 0 20px rgba(255, 85, 0, 0.03);
}

.search-bar .scan-input {
  border: none;
  background: transparent;
}

.search-bar .scan-input:focus {
  box-shadow: none;
}

.search-bar-submit {
  padding: 0.75rem 1.5rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--zech-primary);
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255, 85, 0, 0.15);
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.search-bar-submit:hover {
  background: rgba(255, 85, 0, 0.06);
}

/* AI Overview */
.search-overview {
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(255, 85, 0, 0.12);
  background: rgba(255, 85, 0, 0.02);
  position: relative;
}

.search-overview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--zech-primary);
  opacity: 0.4;
}

.search-overview-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--zech-primary);
  opacity: 0.7;
  margin-bottom: 0.75rem;
}

.search-overview-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--zech-text);
}

.search-overview-links {
  margin-top: 0.75rem;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.search-overview-links a {
  color: var(--zech-text-dim);
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.search-overview-links a:hover {
  opacity: 1;
}

.search-overview-links-sep {
  color: var(--zech-text-dim);
  opacity: 0.3;
  margin: 0 0.25rem;
}

.overview-loading {
  color: var(--zech-text-dim);
  animation: overview-pulse 1.5s ease-in-out infinite;
}

@keyframes overview-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* Results list */
.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result {
  display: block;
  padding: 0.85rem 1rem;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.search-result:hover {
  border-left-color: var(--zech-primary);
  background: rgba(255, 85, 0, 0.03);
}

.search-result-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--zech-primary);
  margin-bottom: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result:hover .search-result-title {
  color: var(--zech-text);
}

.search-result-favicon {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  vertical-align: text-bottom;
  margin-right: 0.4rem;
}

.search-result-url {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--zech-text-dim);
  opacity: 0.5;
  margin-bottom: 0.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-desc {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--zech-text-dim);
}

/* Pagination */
.search-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 85, 0, 0.08);
}

.search-page-link {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--zech-primary);
  text-decoration: none;
  transition: opacity 0.2s;
}

.search-page-link:hover {
  opacity: 0.8;
}

.search-page-disabled {
  opacity: 0.3;
  pointer-events: none;
}

.search-page-info {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--zech-text-dim);
}

.search-empty {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  color: var(--zech-text-dim);
  text-align: center;
  padding: 3rem 0;
}

/* ==========================================================================
   Agent Chat — Conversational AI mode
   ========================================================================== */

.agent-chat-section {
  width: 100%;
  max-width: 760px;
  align-self: flex-start;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 12rem);
}

.agent-chat-section .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scroll-behavior: smooth;
}

/* Welcome screen */
.agent-chat-section .chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem;
  opacity: 0;
  animation: detail-fade-in 0.6s 0.2s forwards;
}

.chat-welcome-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--zech-text);
  margin-bottom: 0.75rem;
}

.chat-welcome-desc {
  font-family: 'Rajdhani', sans-serif;
  color: var(--zech-text-dim);
  font-size: 0.95rem;
  max-width: 400px;
}

/* Message bubbles */
.agent-chat-section .chat-msg {
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: detail-fade-in 0.3s forwards;
}

.agent-chat-section .chat-msg-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 3px;
  margin-bottom: 0.4rem;
}

.agent-chat-section .chat-msg-user .chat-msg-label {
  color: var(--zech-text-dim);
}

.agent-chat-section .chat-msg-model .chat-msg-label {
  color: var(--zech-primary);
}

.agent-chat-section .chat-msg-content {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--zech-text-dim);
}

.agent-chat-section .chat-msg-user .chat-msg-content {
  padding: 0.8rem 1.2rem;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--zech-text);
  background: rgba(255, 85, 0, 0.03);
  border-left: 2px solid rgba(255, 85, 0, 0.15);
}

.agent-chat-section .chat-msg-model .chat-msg-content {
  padding: 0.5rem 0;
}

/* Markdown inside agent messages */
.agent-chat-section .chat-msg-content p { margin: 0 0 0.8em; }
.agent-chat-section .chat-msg-content h2,
.agent-chat-section .chat-msg-content h3,
.agent-chat-section .chat-msg-content h4 {
  font-family: 'Orbitron', sans-serif;
  color: var(--zech-text);
  margin: 1.5em 0 0.5em;
}
.agent-chat-section .chat-msg-content h2 { font-size: 1.1rem; letter-spacing: 2px; }
.agent-chat-section .chat-msg-content h3 { font-size: 0.95rem; letter-spacing: 1.5px; }
.agent-chat-section .chat-msg-content h4 { font-size: 0.85rem; letter-spacing: 1px; }
.agent-chat-section .chat-msg-content strong { color: var(--zech-text); font-weight: 600; }

.agent-chat-section .chat-msg-content a {
  color: var(--zech-primary);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 85, 0, 0.2);
  transition: border-color 0.2s;
}
.agent-chat-section .chat-msg-content a:hover { border-color: var(--zech-primary); }

.agent-chat-section .chat-msg-content code {
  font-family: monospace;
  font-size: 0.9em;
  background: rgba(255, 85, 0, 0.06);
  padding: 0.15em 0.4em;
  border: 1px solid rgba(255, 85, 0, 0.1);
}

.agent-chat-section .chat-msg-content pre {
  background: rgba(255, 85, 0, 0.03);
  border: 1px solid rgba(255, 85, 0, 0.1);
  padding: 1rem;
  overflow-x: auto;
  margin: 0.8em 0;
}

.agent-chat-section .chat-msg-content pre code {
  background: none;
  border: none;
  padding: 0;
}

.agent-chat-section .chat-msg-content ul,
.agent-chat-section .chat-msg-content ol {
  padding-left: 1.5em;
  margin: 0.5em 0 1em;
}

.agent-chat-section .chat-msg-content li { margin-bottom: 0.3em; }

.agent-chat-section .chat-msg-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 85, 0, 0.3) 20%,
    var(--zech-primary) 50%,
    rgba(255, 85, 0, 0.3) 80%,
    transparent
  );
  margin: 1.5em 0;
  box-shadow: 0 0 6px rgba(255, 85, 0, 0.15);
}

.agent-chat-section .chat-msg-content blockquote {
  border-left: 2px solid var(--zech-primary);
  padding-left: 1rem;
  margin: 0.8em 0;
  color: var(--zech-text-dim);
}

.agent-chat-section .chat-msg-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
  margin: 0.8em 0;
}

.agent-chat-section .chat-msg-content th,
.agent-chat-section .chat-msg-content td {
  padding: 0.5em 0.75em;
  border: 1px solid rgba(255, 85, 0, 0.15);
}

.agent-chat-section .chat-msg-content th {
  background: rgba(255, 85, 0, 0.06);
  color: var(--zech-text);
  font-weight: 600;
  font-size: 0.85em;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Tool pills (inline in completed messages) */
.agent-chat-section .chat-tool-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.agent-chat-section .chat-tool-pills:empty { display: none; }

.agent-chat-section .chat-tool-pill {
  display: flex;
  flex-direction: column;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  color: var(--zech-text-dim);
  background: rgba(255, 85, 0, 0.03);
  border: 1px solid rgba(255, 85, 0, 0.1);
  max-width: 100%;
  transition: border-color 0.2s;
}

.agent-chat-section .chat-tool-pill.is-expanded {
  border-color: rgba(255, 85, 0, 0.25);
}

.agent-chat-section .chat-tool-pill-header {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
}

.agent-chat-section .chat-tool-pill-header:hover {
  background: rgba(255, 85, 0, 0.04);
}

.agent-chat-section .chat-tool-pill-icon {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--zech-primary);
  opacity: 0.7;
  white-space: nowrap;
}

.agent-chat-section .chat-tool-pill-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-chat-section .chat-tool-pill-body {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--zech-text-dim);
  background: rgba(255, 85, 0, 0.02);
  border-top: 1px solid rgba(255, 85, 0, 0.08);
  padding: 0.5rem 0.6rem;
  max-height: 16rem;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-chat-section .chat-tool-pill-body[hidden] {
  display: none;
}

/* Status area — thinking + tool events */
.agent-chat-section .chat-status-area {
  padding: 0.8rem 0;
  border-top: 1px solid rgba(255, 85, 0, 0.06);
}

.agent-chat-section .chat-status-area[hidden] { display: none; }

.agent-chat-section .chat-thinking-pulse {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0.5rem 0;
}

.agent-chat-section .pulse-bar {
  width: 3px;
  height: 14px;
  background: var(--zech-primary);
  border-radius: 1px;
  animation: agent-pulse-bar 1.2s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(255, 85, 0, 0.4);
}

.agent-chat-section .pulse-bar:nth-child(2) {
  animation-delay: 0.15s;
  height: 20px;
}

.agent-chat-section .pulse-bar:nth-child(3) {
  animation-delay: 0.3s;
  height: 10px;
}

@keyframes agent-pulse-bar {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

.agent-chat-section .chat-status-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--zech-text-dim);
  padding: 0.25rem 0;
  min-height: 1.2rem;
}

.agent-chat-section .chat-tool-events {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.3rem 0;
}

.agent-chat-section .chat-tool-event {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  color: var(--zech-text-dim);
  opacity: 0;
  animation: detail-fade-in 0.25s forwards;
}

.agent-chat-section .chat-tool-event-icon {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.15rem 0.4rem;
  border: 1px solid rgba(255, 85, 0, 0.15);
  color: var(--zech-primary);
  white-space: nowrap;
}

.agent-chat-section .chat-tool-event.is-running .chat-tool-event-icon {
  animation: agent-tool-pulse 1.5s ease-in-out infinite;
}

.agent-chat-section .chat-tool-event.is-done .chat-tool-event-icon {
  border-color: rgba(255, 85, 0, 0.25);
  opacity: 0.7;
}

.agent-chat-section .chat-tool-event-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes agent-tool-pulse {
  0%, 100% { opacity: 0.5; box-shadow: none; }
  50% { opacity: 1; box-shadow: 0 0 8px rgba(255, 85, 0, 0.2); }
}

/* Usage display */
.agent-chat-section .chat-usage,
.chat-usage {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 85, 0, 0.06);
}

.chat-usage-tokens {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.7rem;
  color: var(--zech-text-dim);
  opacity: 0.5;
}

.chat-usage-cost {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--zech-primary);
  opacity: 0.5;
}

/* Compact notice */
.agent-chat-section .chat-compact-notice {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--zech-text-dim);
  text-align: center;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(255, 85, 0, 0.06);
  background: rgba(255, 85, 0, 0.02);
  opacity: 0;
  animation: detail-fade-in 0.4s forwards;
}

/* Input form */
.agent-chat-section .chat-input-form {
  padding: 0.5rem 0;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--zech-bg, #080c14) 80%, transparent);
  padding-top: 1.5rem;
  margin-top: auto;
}

.agent-chat-section .chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  border: 1px solid rgba(255, 85, 0, 0.15);
  background: rgba(255, 85, 0, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.5rem 0.75rem;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}

.agent-chat-section .chat-input-wrap:focus-within {
  border-color: var(--zech-primary);
  background: rgba(255, 85, 0, 0.06);
  box-shadow: 0 0 20px rgba(255, 85, 0, 0.1);
}

.agent-chat-section .chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--zech-text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  line-height: 1.5;
  resize: none;
  padding: 0.25rem 0;
  max-height: 150px;
  overflow-y: auto;
}

.agent-chat-section .chat-input:focus {
  outline: none;
  box-shadow: none;
}

.agent-chat-section .chat-input::placeholder {
  color: var(--zech-text-dim);
  opacity: 0.5;
}

.agent-chat-section .chat-send-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--zech-primary);
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255, 85, 0, 0.15);
  padding: 0 1rem;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  white-space: nowrap;
  align-self: stretch;
}

.agent-chat-section .chat-send-btn:hover { background: rgba(255, 85, 0, 0.06); }
.agent-chat-section .chat-send-btn:disabled { opacity: 0.2; cursor: not-allowed; }

/* Responsive */
@media (max-width: 768px) {
  .agent-chat-section .chat-welcome { padding: 3rem 1rem; }
  .agent-chat-section .chat-msg-user .chat-msg-content { padding: 0.6rem 0.8rem; }
  .agent-chat-section .chat-msg-content { font-size: 1rem; }
}
