/* ================================
   SEARCH PARAMETERS & RESULTS - Split Panel Layout
   ================================ */

@import url("color_palette.css");

/* Panel Content Override - Search Parameters */
#querying-panel .panel-content.querying-panel-content {
  display: flex;
  flex-direction: row;
  padding: 0 !important;
  gap: 0;
  height: calc(
    100vh - var(--menu-bar-height, 48px) - var(--panel-header-height, 48px) -
      4rem
  );
  max-height: none;
  overflow: hidden;
}

/* Panel Content Override - Search Results */
#search-results-panel .panel-content.search-results-panel-content {
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  gap: 0;
  height: calc(
    100vh - var(--menu-bar-height, 48px) - var(--panel-header-height, 48px) -
      4rem
  );
  max-height: none;
  overflow: hidden;
}

/* ================================
   LEFT COLUMN: INPUTS (always visible)
   ================================ */

.querying-inputs-column {
  width: 350px;
  min-width: 350px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary, #fff);
  border-right: 1px solid var(--border-light, #d1d5db);
  overflow: hidden;
  transition:
    width 0.18s ease,
    min-width 0.18s ease,
    border-right-width 0.18s ease;
}
/* Collapse to ~2% (8px) instead of 0 so the divider sits inset from the column
   edge — prevents accidental sidebar clicks when expanding. Shared by every
   collapsible column (inputs column, entities/master list). */
.querying-inputs-column.collapsed,
.results-detailed-view .master-list-col.collapsed {
  width: 8px !important;
  min-width: 8px !important;
  border-right: none !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Unified column divider: one strip per collapsible column that both
   click-collapses and drag-resizes its previous sibling (see panel_resize.js).
   The hit target is 14px wide for an easy click/hover, but the visible strip is
   a 4px orange ::before — always shown so the control reads clearly, brighter on
   hover/drag. No transform on hover so the strip never shifts. */
.column-divider {
  position: relative;
  width: 14px;
  min-width: 14px;
  flex-shrink: 0;
  align-self: stretch;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: col-resize;
  z-index: 5;
}
.column-divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--gd-rim);
  transition: background var(--gd-t);
  pointer-events: none;
}
.column-divider:hover::before,
.column-divider:focus::before,
.column-divider:focus-visible::before,
.column-divider.dragging::before {
  width: 2px;
  background: var(--gd-amber);
}
.column-divider:focus,
.column-divider:focus-visible {
  outline: none;
}

.querying-inputs-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
}

.querying-inputs-content .collapsible-section {
  margin-bottom: 4px;
}

/* ================================
   MIDDLE COLUMN: METHOD (AI / Manual)
   ================================ */

.querying-method-column {
  width: 350px;
  min-width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary, #fff);
  overflow: hidden;
}

/* Manual mode placeholder */
#querying-manual-mode,
#querying-manual-config-content {
  height: 100%;
}

.manual-mode-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  color: var(--text-muted, #6b7280);
  text-align: center;
  padding: 20px;
}

.manual-mode-placeholder i {
  font-size: 24px;
  opacity: 0.4;
}

/* Same voice as the assistant's empty-state greeting. */
.manual-mode-placeholder p {
  font-size: calc(var(--font-size-base) * 1.4);
  font-weight: 500;
  margin: 0;
  line-height: 1.4;
}

/* Manual mode config title */
.manual-config-header {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-secondary, #4b5563);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
  background: var(--bg-secondary, #f8f9fa);
}

.manual-config-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Reuse config column compact styles in manual config */
#querying-manual-config-content .collapsible-section {
  margin-bottom: 6px;
  border-radius: 4px;
  border: 1px solid var(--border-light, #d1d5db);
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

#querying-manual-config-content .section-header {
  padding: 6px 8px !important;
  min-height: unset !important;
}

#querying-manual-config-content .section-header h4 {
  font-size: var(--gd-sz-xs) !important;
  margin: 0 !important;
}

#querying-manual-config-content .section-content.expanded {
  padding: 8px !important;
  border-top: 1px solid var(--border-light, #e5e7eb);
}

#querying-manual-config-content .filter-group {
  margin-bottom: 6px;
}

#querying-manual-config-content .filter-group label {
  font-size: var(--font-size-xs);
  margin-bottom: 2px;
}

#querying-manual-config-content .filter-group input,
#querying-manual-config-content .filter-group select {
  padding: 4px 6px;
  font-size: var(--font-size-xs);
}

#querying-manual-config-content .filter-box {
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-light, #d1d5db);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
}

#querying-manual-config-content .filter-box h4 {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted, #6c7380);
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.section-content .text-match-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px 9px;
  color: var(--text-secondary, #475569) !important;
  font-size: var(--font-size-xs) !important;
  line-height: 1.35 !important;
  background: color-mix(
    in srgb,
    var(--accent-primary, #f59e0b) 10%,
    transparent
  );
  border: 1px solid
    color-mix(in srgb, var(--accent-primary, #f59e0b) 35%, transparent);
  border-radius: 4px;
}

.section-content .text-match-info span,
.section-content .text-match-info button {
  font-size: var(--font-size-xs) !important;
  line-height: 1.35 !important;
}

.text-match-info i {
  color: var(--accent-primary, #f59e0b);
}

.text-match-help-link {
  margin-inline-start: auto;
  padding: 0;
  color: var(--accent-primary, #d97706);
  font: inherit;
  text-decoration: underline;
  white-space: nowrap;
  background: none;
  border: 0;
  cursor: pointer;
}

.text-match-help-link:hover,
.text-match-help-link:focus-visible {
  color: var(--text-primary, #111827);
}

/* Content Area */
.querying-content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.querying-mode-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

#cohort-filter-section .section-header h4 span {
  color: inherit;
}

#cohort-filter-list {
}

.querying-action-bar {
  flex-shrink: 0;
  padding: 8px 16px;
  border-top: none;
  background: transparent;
}

/* Unified steady state for both AI and Manual buttons — adopts the
   matched-hue triple (faint amber wash + full accent border + accent
   text/icon) that geodesy_panel_redesign.css applies on hover, but
   uses it as the resting style. !important throughout because both
   panel_redesign.css and geodesy_panel_redesign.css set
   `.panel-content .action-button { ... !important }` rules that would
   otherwise win the cascade despite our tighter selector. */
.querying-action-bar .action-button,
.querying-action-bar .action-button.mode-ai,
.querying-action-bar .action-button.mode-manual {
  width: 100% !important;
  padding: 8px 14px !important;
  font-weight: var(--font-weight-medium, 500) !important;
  letter-spacing: 0.02em !important;
  background: rgba(224, 123, 0, 0.15) !important;
  border: 1px solid #e07b00 !important;
  color: #e07b00 !important;
  box-shadow: none !important;
  transform: none !important;
  transition:
    background 0.15s ease,
    border-color 0.15s ease !important;
}
.querying-action-bar .action-button i,
.querying-action-bar .action-button.mode-ai i,
.querying-action-bar .action-button.mode-manual i {
  color: #e07b00 !important;
}
.querying-action-bar .action-button:hover,
.querying-action-bar .action-button.mode-ai:hover,
.querying-action-bar .action-button.mode-manual:hover {
  background: rgba(224, 123, 0, 0.22) !important;
  border-color: #e07b00 !important;
  color: #e07b00 !important;
  transform: none !important;
  box-shadow: none !important;
}
.querying-action-bar .action-button:active,
.querying-action-bar .action-button.mode-ai:active,
.querying-action-bar .action-button.mode-manual:active {
  background: rgba(224, 123, 0, 0.28) !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ================================
   CONSISTENT COLUMN HEADER BARS
   All columns use the same header bar style for alignment
   ================================ */

.column-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  background: var(--bg-secondary, #f8f9fa);
  border-bottom: 1px solid var(--border-light, #d1d5db);
  min-height: 32px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.column-header-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary, #4b5563);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-close-btn {
  padding: 6px 8px;
  background: none;
  border: none;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.header-close-btn:hover {
  background: var(--bg-tertiary, #f3f4f6);
  color: var(--text-primary, #1a1d23);
}

/* Mode toggle should match header bar height */
.querying-mode-toggle {
  display: flex;
  padding: 4px 12px;
  background: var(--bg-secondary, #f8f9fa);
  border-bottom: 1px solid var(--border-light, #d1d5db);
  gap: 4px;
  min-height: 32px;
  box-sizing: border-box;
}

.querying-mode-toggle .mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border-light, #d1d5db);
  border-radius: 4px;
  background: var(--bg-primary, #fff);
  color: var(--text-secondary, #4b5563);
  font-size: var(--font-size-md);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.querying-mode-toggle .mode-btn:hover {
  background: var(--bg-tertiary, #f3f4f6);
}

.querying-mode-toggle .mode-btn.active[data-mode="ai"] {
  background: var(--color-accent-orange, #cc6600);
  border-color: var(--color-accent-orange, #cc6600);
  color: #fff;
}
.querying-mode-toggle .mode-btn.active[data-mode="manual"] {
  background: var(--color-primary-dark, #1a1f2e);
  border-color: var(--color-primary-dark, #1a1f2e);
  color: #fff;
}

.querying-mode-toggle .mode-btn i {
  font-size: var(--font-size-md);
}

/* Mode content visibility */
.querying-mode-content.hidden {
  display: none !important;
}

/* AI Mode Styles */
#querying-ai-mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

/* Consistent box styling for both input and output */
.ai-input-box,
.ai-output-box {
  border-radius: 6px;
  padding: 12px;
  font-size: var(--font-size-sm);
  font-family: inherit;
  line-height: 1.5;
}

.ai-input-box {
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-medium, #9ca3af);
  min-height: 60px;
  resize: none;
  flex-shrink: 0;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.ai-input-box:focus {
  outline: none;
  border-color: var(--color-accent-orange, #cc6600);
  box-shadow: 0 0 0 2px rgba(204, 102, 0, 0.15);
}

.ai-input-box::placeholder {
  color: var(--text-secondary, #374151);
}

/* The wrapper IS the visual input box (carries .ai-input-box skin); the
   textarea inside is transparent and auto-grows, and the actions bar sits
   BELOW it, so the +/send buttons stay anchored one line under the last
   line of text and can never be overlapped, however tall the box gets. */
.ai-input-row {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.ai-input-inner {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5;
  padding: 4px 2px;
}

.ai-input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
}

.ai-plus-btn {
  background: none;
  border: 1px solid var(--border-medium, #9ca3af);
  border-radius: 6px;
  color: var(--text-secondary, #4b5563);
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.ai-plus-btn:hover,
.ai-plus-btn.open {
  border-color: var(--gd-amber, #e07b00);
  color: var(--gd-amber, #e07b00);
}

/* Send affordance shared by the assistant composer (lights up on text) and
   the manual action bar (lights up on data-source selection). Two-class
   selectors so the global `button:disabled { position: relative }` in
   button_styles.css cannot restyle the disabled state. */
.querying-action-bar {
  display: flex;
  justify-content: flex-end;
}

.ai-input-row .ai-send-btn,
.ai-input-row .ai-send-btn:disabled,
.querying-action-bar .ai-send-btn,
.querying-action-bar .ai-send-btn:disabled {
  position: static;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: var(--gd-amber, #e07b00);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.ai-input-row .ai-send-btn:disabled,
.querying-action-bar .ai-send-btn:disabled {
  background: none;
  border: 1px solid var(--border-medium, #9ca3af);
  color: var(--text-muted, #6b7280);
  cursor: default;
}

.ai-send-btn:not(:disabled):hover {
  filter: brightness(1.15);
}

.ai-plus-menu[hidden] {
  display: none;
}

/* Model and effort: a chip beside Send opening its menu. */
.ai-input-actions-end {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-mode-btn[hidden],
.ai-mode-menu[hidden] {
  display: none;
}

.ai-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  background: none;
  border: 1px solid var(--border-medium, #9ca3af);
  border-radius: var(--gd-r, 2px);
  color: var(--text-secondary, #4b5563);
  font-size: var(--font-size-xs);
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-mode-btn:hover,
.ai-mode-btn.open {
  border-color: var(--gd-amber, #e07b00);
  color: var(--gd-amber, #e07b00);
}

.ai-mode-effort {
  color: var(--gd-text-low, #4d6078);
}

.ai-mode-btn i {
  font-size: 9px;
}

.ai-mode-menu {
  /* Fixed and anchored by _popupMenu, as the + menu is. */
  position: fixed;
  width: min(280px, 90vw);
  background: var(--gd-surface, #131a24);
  border: 1px solid var(--gd-rim, #212d3f);
  border-radius: var(--gd-r, 2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 4px;
  display: flex;
  flex-direction: column;
  z-index: 10010;
}

.ai-mode-heading {
  padding: 6px 8px 2px;
  font-size: var(--font-size-xs);
  color: var(--gd-text-low, #4d6078);
}

#ai-mode-models + .ai-mode-heading {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--gd-rim, #212d3f);
}

.ai-mode-note {
  margin: 0;
  padding: 0 8px 4px;
  font-size: var(--font-size-xs);
  color: var(--gd-text-low, #4d6078);
}

.ai-mode-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  background: none;
  border: none;
  border-radius: var(--gd-r, 2px);
  color: var(--gd-text-hi, #c8d2e0);
  font-size: var(--font-size-sm);
  text-align: start;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}

.ai-mode-item:hover {
  background: var(--gd-elevated, #1a2333);
}

/* Set for the deployment: shown, not changeable. */
.ai-mode-item:disabled {
  cursor: default;
  color: var(--gd-text-mid, #8fa3bd);
  background: none;
}

.ai-mode-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-mode-desc {
  font-size: var(--font-size-xs);
  color: var(--gd-text-mid, #8fa3bd);
}

.ai-mode-item i {
  margin-inline-start: auto;
  font-size: var(--font-size-xs);
  color: var(--gd-amber, #e07b00);
  visibility: hidden;
}

.ai-mode-item[aria-checked="true"] i {
  visibility: visible;
}

.ai-plus-menu {
  /* Fixed so no panel overflow context can truncate it when the panel is
     small; the JS anchors it to the + button's viewport rect on open. */
  position: fixed;
  width: min(380px, 90vw);
  background: var(--gd-surface, #131a24);
  border: 1px solid var(--gd-rim, #212d3f);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10010;
}

.ai-plus-section {
  border: 1px solid var(--gd-rim, #212d3f);
  border-radius: 4px;
  background: var(--gd-elevated, #1a2333);
  overflow: hidden;
}

.ai-plus-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  font-size: var(--font-size-xs);
  color: var(--gd-text-mid, #8fa3bd);
  background: none;
  border: none;
  cursor: pointer;
  text-align: start;
  transition: color 0.15s;
}

.ai-plus-section-header:hover {
  color: var(--gd-text-hi, #c8d2e0);
}

.ai-plus-section-header i {
  font-size: var(--font-size-xs);
  color: var(--gd-text-low, #4d6078);
}

.ai-plus-caret {
  margin-inline-start: auto;
  transition: transform 0.15s;
}

.ai-plus-section.open .ai-plus-caret {
  transform: rotate(90deg);
}

.ai-plus-section:not(.open) .ai-saved-queries-list {
  display: none;
}

/* Clear conversation as a flat menu row, matching the section headers. */
.ai-plus-menu .ai-clear-context-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  background: var(--gd-elevated, #1a2333);
  border: 1px solid var(--gd-rim, #212d3f);
  border-radius: 4px;
  text-align: start;
  text-transform: none;
  letter-spacing: normal;
}

.ai-plus-menu .ai-clear-context-btn i {
  font-size: var(--font-size-xs);
  color: var(--gd-text-low, #4d6078);
}

.ai-plus-menu .ai-clear-context-btn .info-icon {
  margin-inline-start: auto;
}

.ai-plus-section.open .ai-plus-section-header {
  border-bottom: 1px solid var(--gd-rim, #212d3f);
}

.ai-clear-context-btn {
  background: none;
  border: 1px solid var(--border-light, #e5e7eb);
  color: var(--text-muted, #6b7280);
  font-size: var(--font-size-xs);
  padding: 2px 8px;
  border-radius: 2px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: all 0.2s;
}

.ai-clear-context-btn:hover {
  border-color: var(--border-medium, #9ca3af);
  color: var(--text-primary, #1f2937);
}

.ai-saved-queries-list {
  display: flex;
  flex-direction: column;
  max-height: 180px;
  overflow-y: auto;
}

.ai-saved-query-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--gd-rim, #212d3f);
  transition: background 0.15s;
}

.ai-saved-query-item:last-child {
  border-bottom: none;
}

.ai-saved-query-item:hover {
  background: var(--gd-elevated, #1a2333);
}

.ai-saved-query-item i {
  color: var(--gd-text-low, #4d6078);
  font-size: var(--font-size-xs);
  flex-shrink: 0;
}

.ai-saved-query-item-text {
  font-size: var(--font-size-xs);
  color: var(--gd-text-hi, #e8edf5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-saved-queries-empty {
  padding: 10px;
  font-size: var(--font-size-xs);
  color: var(--gd-text-low, #4d6078);
  text-align: center;
}

.ai-saved-query-delete {
  background: none;
  border: none;
  color: var(--gd-text-low, #4d6078);
  font-size: var(--font-size-md);
  cursor: pointer;
  padding: 0 2px;
  margin-left: auto;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s;
}

.ai-saved-query-delete:hover {
  color: var(--gd-red, #d94040);
}

.ai-output-box {
  background: var(--bg-secondary, #f8f9fa);
  border: 1px solid var(--border-light, #e5e7eb);
  flex: 1;
  min-height: 150px;
  overflow-y: auto;
}

.ai-output-box:empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-output-box:empty::before {
  content: attr(data-empty-hint);
  color: var(--gd-text-mid, #8fa3bd);
  font-size: calc(var(--font-size-base) * 1.4);
  font-weight: 500;
  text-align: center;
}

/* Selectable items */
#querying-panel .selectable-list-item {
  padding: 8px 10px;
  margin-bottom: 4px;
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 4px;
  font-size: var(--font-size-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#querying-panel .selectable-list-item:hover {
  background: var(--bg-secondary, #f9fafb);
}

#querying-panel .selectable-list-item.selected {
  background: rgba(204, 102, 0, 0.08);
  border-color: var(--color-accent-orange, #cc6600);
}

/* Data type items */
#querying-panel .data-type-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
}

#querying-panel .data-type-item .config-btn {
  background: none;
  border: none;
  color: var(--text-muted, #6c7380);
  cursor: pointer;
  padding: 4px 6px;
  opacity: 0.6;
}

#querying-panel .data-type-item .config-btn:hover {
  opacity: 1;
  color: var(--color-accent-orange, #cc6600);
}

/* Hide ellipsis config button in querying panel — clicking the item itself opens config */
#querying-panel .filter-config-btn {
  display: none;
}

/* Datasets section: let the list grow with content — outer column handles scroll */
#general-data-types-section .section-content.expanded,
#data-types-multiselect {
  max-height: none !important;
  overflow-y: visible !important;
}

/* Data type groups — minimal, label-only, no borders */
.data-types-sort-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 2px 4px;
  font-size: var(--font-size-xs);
  color: var(--text-muted, #6b7280);
}

.data-types-sort-toggle .sort-pill {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  opacity: 0.55;
  transition:
    opacity 0.15s,
    color 0.15s;
}

.data-types-sort-toggle .sort-pill:hover {
  opacity: 1;
}

.data-types-sort-toggle .sort-pill.selected {
  color: var(--color-accent-orange, #cc6600);
  opacity: 1;
}

.data-types-sort-toggle .sort-sep {
  opacity: 0.3;
}

.data-type-group {
  margin-bottom: 8px;
}

.data-type-group:last-child {
  margin-bottom: 0;
}

.data-type-group-header {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 0 2px 2px;
  font-size: var(--font-size-2xs);
  color: var(--gd-text-low);
}

.data-type-group-header .group-label,
.data-type-group-header .group-count {
  color: var(--gd-text-low);
  font-size: var(--font-size-2xs) !important;
}

.data-type-group-header .group-label {
  color: var(--gd-amber);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.data-type-group-header .group-count {
  font-variant-numeric: tabular-nums;
}

.data-type-group-header .group-select-all {
  margin-left: auto;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.15s,
    color 0.15s;
}

.data-type-group:hover .group-select-all {
  opacity: 0.5;
}

.data-type-group .group-select-all:hover {
  opacity: 1;
  color: var(--color-accent-orange, #cc6600);
}

.data-type-group-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.data-type-group-body .selectable-list-item {
  margin-bottom: 0;
}

/* ================================
   CONFIG COLUMN
   ================================ */

/* Base styles now in geodesy_panel_redesign.css */

#querying-config-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
}

#querying-config-content > div {
  width: 100%;
  box-sizing: border-box;
}

/* Compact collapsible sections in config */
#querying-config-content .collapsible-section {
  margin-bottom: 6px;
  border-radius: 4px;
  border: 1px solid var(--border-light, #d1d5db);
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

#querying-config-content .section-header {
  padding: 6px 8px !important;
  min-height: unset !important;
  width: 100%;
  box-sizing: border-box;
}

#querying-config-content .section-header h4 {
  font-size: var(--gd-sz-xs) !important;
  margin: 0 !important;
}

#querying-config-content .section-content.expanded {
  padding: 8px !important;
  border-top: 1px solid var(--border-light, #e5e7eb);
  width: 100%;
  box-sizing: border-box;
}

/* Compact filter groups */
#querying-config-content .filter-group {
  margin-bottom: 6px;
}

#querying-config-content .filter-group label {
  font-size: var(--font-size-xs);
  margin-bottom: 2px;
}

#querying-config-content .filter-group input,
#querying-config-content .filter-group select {
  padding: 4px 6px;
  font-size: var(--font-size-xs);
}

/* Compact time range */
#querying-config-content .time-range {
  margin-bottom: 4px;
  gap: 6px;
}

#querying-config-content .time-range label {
  flex: 0 0 70px;
  font-size: var(--font-size-xs);
}

#querying-config-content .time-range span {
  flex: 0 0 55px;
  font-size: var(--font-size-xs);
}

/* Restore .filter-box styling in config column */
#querying-config-content .filter-box {
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-light, #d1d5db);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
}

#querying-config-content .filter-box:last-child {
  margin-bottom: 0;
}

#querying-config-content .filter-box h4 {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted, #6c7380);
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
}

/* Time range output display */
#querying-config-content .output-container,
.querying-config-column .output-container {
  background: var(--bg-tertiary, #f3f4f6);
  border-left: 2px solid var(--color-accent-orange, #cc6600);
  border-radius: 3px;
  padding: 4px 8px;
  margin-top: 6px;
}

#querying-config-content .output-container p,
.querying-config-column .output-container p {
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--text-primary, #1a1d23);
}

#querying-config-content .output-container span,
.querying-config-column .output-container span {
  font-weight: 600;
  color: var(--color-accent-orange, #cc6600);
}

#querying-panel.config-open {
  width: min(95vw, 1388px);
}

/* ================================
   RESIZE HANDLES
   ================================ */

.resize-handle,
.panel-resize-edge {
  width: 8px;
  min-width: 8px;
  background: var(--border-medium, #9ca3af);
  cursor: ew-resize;
  position: relative;
}

.resize-handle::after,
.panel-resize-edge::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 40px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
}

.resize-handle:hover,
.resize-handle.dragging,
.panel-resize-edge:hover,
.panel-resize-edge.dragging {
  background: var(--color-accent-orange, #cc6600);
}

.resize-handle:hover::after,
.resize-handle.dragging::after,
.panel-resize-edge:hover::after,
.panel-resize-edge.dragging::after {
  background: rgba(255, 255, 255, 0.6);
}

.resize-handle {
  cursor: col-resize;
}
.panel-resize-edge {
  right: 0;
  top: 0;
  bottom: 0;
  position: absolute;
  z-index: 10;
}
.panel[style*="display: none"] .panel-resize-edge,
.panel[style*="display:none"] .panel-resize-edge {
  display: none;
}

/* ================================
   RIGHT COLUMN: RESULTS (collapsible)
   ================================ */

/* When no config is open, let method column expand */
.querying-panel-content:not(:has(.querying-config-column:not(.collapsed)))
  .querying-method-column {
  flex: 1;
  width: auto;
}

/* Table view */
.results-table-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px;
}

/* Documents showing: the table view holds only the run's source sub-tabs above them */
.results-table-view.subtabs-only {
  flex: 0 0 auto;
}

.results-table-view #data-source-tabs {
  display: flex;
  gap: 4px;
  padding-bottom: 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-light, #d1d5db);
  margin-bottom: 10px;
  flex-shrink: 0;
}

.results-table-view #tab-contents-container {
  flex: 1;
  overflow-y: auto !important; /* Override panel_redesign.css overflow:visible */
  min-height: 0;
}

/* A table grows to its rows: its set's body (or an entity's detail) scrolls them, and
   its sideways scroll stays inside the table (.dt-x) */
.results-table-view .table-container,
.results-table-view .dataTables_wrapper,
.detail-records-body .table-container,
.detail-records-body .dataTables_wrapper {
  max-height: none !important;
  overflow: visible !important;
}

/* Hide table/cards toggle inside results panel - replaced by Table/Detailed toggle */
#search-results-panel .view-toggle {
  display: none !important;
}

/* Detailed view layout - master list + detail panel side by side */
.results-detailed-view {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  position: relative;
}

/* Master list column (toolbar + bar list). Resizable via adjacent
   .resize-handle; default 320px, min 220px, no max so drag can widen.
   overflow:visible lets the filter dropdown escape; scroll lives on
   the inner .master-list instead. */
.results-detailed-view .master-list-col {
  /* Wide enough for ID, source, criteria, records and last seen side by side. */
  width: clamp(360px, 42%, 520px);
  min-width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
  background: var(--gd-base);
}

/* Detail panel takes remaining ~75%. min-width:0 overrides the flex item's
   automatic min-content floor — without it nowrap entity ids would stop the
   column shrinking and push content past the panel edge. */
.results-detailed-view .querying-detail-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Empty state for results */
.results-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--color-accent-orange, #cc6600);
  opacity: 0.2;
  text-align: center;
  padding: 40px 20px;
}

.results-empty-state i {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: 16px;
}

.results-empty-state p {
  margin: 0 0 8px 0;
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-secondary, #4b5563);
}

.results-empty-state span {
  font-size: var(--font-size-sm);
  max-width: 280px;
  line-height: 1.5;
}

/* Hide empty state when tabs exist (tabs now in header bar) */
#search-results-panel:has(#data-source-tabs:not(:empty)) #results-empty-state {
  display: none;
}

/* ================================
   AI MESSAGE STYLES
   ================================ */

.ai-msg {
  padding: 8px 10px;
  margin: 4px 0;
  border-radius: 4px;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.ai-msg.user {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  white-space: normal;
  background: var(--bg-tertiary, #d9dce1);
  margin: 12px 0 12px 20%;
  font-weight: 500;
  border-left: 2px solid #9ca3af;
  box-sizing: border-box;
  max-width: 80%;
  overflow-wrap: anywhere;
}

.user-query-text {
  flex: 1;
  min-width: 0;
}

.user-query-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: auto;
  padding: 4px 12px;
  background: transparent;
  border: 1px solid #3b82f6;
  border-radius: 4px;
  color: #3b82f6;
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.user-query-save-btn:hover {
  background: rgba(59, 130, 246, 0.1);
}

.user-query-save-btn:disabled {
  border-color: #059669;
  color: #059669;
  background: transparent;
  cursor: default;
}

.ai-msg.assistant {
  background: var(--bg-secondary, #f0f1f3);
  border-left: 2px solid var(--color-accent-orange, #cc6600);
}

.ai-msg.answer {
  white-space: normal;
  line-height: 1.5;
}

.ai-prose {
  white-space: normal;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ai-prose :is(p, ul, ol, pre, h1, h2, h3, h4, h5, h6) {
  margin: 0;
}

.ai-prose > :not(:first-child) {
  margin-block-start: 8px;
}

.ai-prose p {
  font-size: inherit;
  line-height: inherit;
}

.ai-prose strong {
  color: inherit;
  font-weight: 600;
}

.ai-prose :is(h1, h2, h3, h4, h5, h6) {
  padding: 0;
  font-size: 1em;
  font-weight: 600;
  color: inherit;
  line-height: 1.35;
}

.ai-prose :is(h1, h2) {
  font-size: 1.08em;
}

.ai-prose :is(ul, ol) {
  padding-block: 0;
  padding-inline-start: 1.25em;
}

.ai-prose ul {
  list-style: disc;
}

.ai-prose li {
  padding-inline-start: 2px;
}

.ai-prose li + li {
  margin-block-start: 4px;
}

.ai-prose li::marker {
  color: var(--gd-amber, var(--color-accent-orange, #cc6600));
}

.ai-prose pre {
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

/* .ai-source-link rules → moved to styles/evidence.css */

.ai-msg.answer .ask-how-row {
  padding: 2px 0 0;
}

/* Reset styling for preview container */
.ai-msg.preview-container {
  padding: 0;
  margin: 8px 0;
  background: transparent;
  border-left: none;
  border-radius: 0;
  white-space: normal;
  font-size: inherit;
}

/* A plan's run output slot: no box of its own, so its lines space as any
   chat line and an empty slot takes no room. */
.ai-run-output {
  display: contents;
}

.ai-msg.loading {
  color: var(--text-muted, #6b7280);
  font-style: italic;
}

/* The assistant's live trace: one line per step, each opening on its own to its reasoning
   and its result. */
.ai-msg.ai-trace {
  padding: 0;
  margin: 4px 0;
  white-space: normal;
  font-size: var(--font-size-xs, 11px);
  color: var(--text-muted, #6b7280);
}

/* The line the steps fold under once the loop has ended: hidden while it runs. */
.ai-trace.running > .ai-trace-summary {
  display: none;
}

.ai-trace-summary {
  cursor: pointer;
  list-style: none;
}

.ai-trace-summary::-webkit-details-marker {
  display: none;
}

.ai-trace-summary::after {
  content: "\203A";
  display: inline-block;
  margin-left: 6px;
}

.ai-trace[open] > .ai-trace-summary::after {
  transform: rotate(90deg);
}

.ai-trace-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 2px 0;
  cursor: pointer;
  list-style: none;
}

.ai-trace-line::-webkit-details-marker {
  display: none;
}

.ai-trace-line::after {
  content: "\203A";
  display: inline-block;
}

.ai-trace-step[open] > .ai-trace-line::after {
  transform: rotate(90deg);
}

.ai-trace-what {
  flex: none;
}

.ai-trace-on {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-color, #111827);
}

.ai-trace-outcome {
  flex: none;
  margin-left: auto;
}

.ai-trace-step.running .ai-trace-what,
.ai-trace-step.failed .ai-trace-outcome {
  color: var(--color-accent-orange, #cc6600);
}

/* A step still running turns a small ring before its name, until it ends. */
.ai-trace-step.running .ai-trace-what::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border: 1px solid var(--color-accent-orange, #cc6600);
  border-top-color: transparent;
  border-radius: 50%;
  animation: ai-trace-turn 0.8s linear infinite;
}

@keyframes ai-trace-turn {
  to {
    transform: rotate(360deg);
  }
}

.ai-trace-why,
.ai-trace-result {
  margin: 0;
  padding: 2px 0 2px 14px;
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: inherit;
}

.building-plan {
  display: flex;
  align-items: center;
  gap: 8px;
  font-style: normal;
  color: var(--color-accent-orange, #cc6600);
}

.building-plan i {
  font-size: var(--font-size-sm);
}

.ai-msg.error {
  background: #fef2f2;
  border-left-color: #ef4444;
  color: #991b1b;
}

.ai-msg.warning {
  background: #fffbeb;
  border-left-color: #f59e0b;
  color: #92400e;
}

/* Evidence popup + items + ids → moved to styles/evidence.css */

/* ================================
   DETAILED VIEW: Master List as bar plot
   Aesthetic: dense intel-console rows, monochrome + orange accent.
   ================================ */

.master-list {
  flex: 1;
  min-height: 0; /* allow flex child to shrink so overflow-y works */
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Body-portal dropdown for the source filter menu. Inherits .col-menu
   styling; only adds icon+label row formatting. */
.master-list-col-menu .col-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.master-list-col-menu .col-menu-item > i {
  width: 12px;
  font-size: 11px;
  flex-shrink: 0;
}
.master-list-col-menu .col-menu-item.disabled {
  cursor: default;
  opacity: 0.6;
}

.master-list-empty {
  padding: 16px 12px;
  font-size: var(--font-size-xs);
  font-style: italic;
  color: var(--text-muted, #6b7280);
  text-align: center;
}

/* ================================
   NEW: DETAIL PANEL
   ================================ */

/* Detail panel styling */
.querying-detail-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary, #fff);
  overflow: hidden;
  border-left: 1px solid var(--border-light, #d1d5db);
}

/* Beside the detail tabs: the Records count. */
#detail-tabs {
  align-items: center;
  min-width: 0;
}

#detail-records-count {
  margin-inline-start: 4px;
  font-family: var(--gd-font-mono);
  font-weight: 400;
}

/* Detail content - full height for plots */
.detail-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px;
  background: var(--bg-primary, #fff);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Plots tab content should take full height */
.plot-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.detail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 150px;
  color: var(--text-muted, #6b7280);
  font-size: var(--font-size-sm);
}

/* ================================
   Detail Panel Sections
   ================================ */

.detail-section {
  margin-bottom: 12px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section-header {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted, #6b7280);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.detail-item {
  padding: 8px 10px;
  margin-bottom: 6px;
  background: var(--bg-secondary, #f8f9fa);
  border-radius: 4px;
  font-size: var(--font-size-sm);
}

.detail-item:last-child {
  margin-bottom: 0;
}

.detail-item.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid #22c55e;
}

.detail-item.evidence {
  border-left: 3px solid var(--color-accent-orange, #cc6600);
}

.detail-item-id {
  font-family: var(--gd-font-mono);
  font-weight: 500;
}

.detail-item-type {
  font-size: var(--font-size-xs);
  color: var(--text-muted, #6b7280);
}

/* Raw Data Preview (for manual query results) */
.raw-data-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.data-field {
  display: flex;
  gap: 8px;
  font-size: var(--font-size-xs);
  padding: 4px 8px;
  background: var(--bg-secondary, #f8f9fa);
  border-radius: 3px;
}

.field-key {
  font-weight: 600;
  color: var(--text-secondary, #4b5563);
  min-width: 96px;
  flex-shrink: 0;
}

/* A retrieval result's triage table (Summary): section rows, criteria with their records,
   days and last time met; counts in amber; criteria not met dimmed. */
.triage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-xs);
}

.triage-table th {
  padding: 6px 8px 3px;
  text-align: start;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #6b7280);
  border-bottom: 1px solid var(--border-light, #e5e7eb);
  white-space: nowrap;
}

.triage-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--gd-rim, #2a3546);
  color: var(--text-primary, #1f2937);
}

/* A field's label stays beside the first line of a long value list. */
.triage-table.field-values td {
  vertical-align: top;
}

.triage-table .fit {
  width: 1%;
  white-space: nowrap;
  font-family: var(--gd-font-mono);
}

.triage-table b {
  font-family: var(--gd-font-mono);
  font-weight: 400;
  color: var(--gd-amber, #d97706);
}

.triage-table tr.unmet td,
.triage-table tr.unmet b {
  color: var(--text-muted, #6b7280);
}

.triage-link {
  padding: 0;
  margin-inline-start: 6px;
  background: none;
  border: none;
  color: var(--text-muted, #6b7280);
  font: inherit;
  cursor: pointer;
}

.triage-link:hover {
  color: var(--gd-amber, #d97706);
}

/* Values in the triage and field tables: separators, quiet notes, mono numbers */
.triage-table .sep {
  margin: 0 6px;
  color: var(--text-muted, #6b7280);
}

.triage-table .muted {
  color: var(--text-muted, #6b7280);
}

.triage-table .mono {
  font-family: var(--gd-font-mono);
}

/* Activity plots: one strip per criterion on one shared scale; neutral bars, amber on
   hover, square ends; the clock they are on at the top, a table view behind the link. */
.activity-plot {
  align-self: stretch;
  width: 100%;
  padding: 4px 0;
}

.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 6px;
  font-size: var(--font-size-xs);
  color: var(--text-muted, #6b7280);
}

.activity-strip {
  display: grid;
  grid-template-columns: minmax(80px, 160px) 1fr;
  gap: 8px;
  align-items: end;
  padding: 2px 8px;
}

.activity-label {
  align-self: center;
  font-size: var(--font-size-xs);
  color: var(--text-secondary, #4b5563);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  unicode-bidi: plaintext;
}

.activity-bars {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 44px;
  border-bottom: 1px solid var(--gd-rim, #2a3546);
}

.activity-col {
  flex: 1;
  min-width: 2px;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.activity-bar {
  width: 100%;
  background: var(--gd-text-mid, #8fa3bd);
}

.activity-col:hover .activity-bar {
  background: var(--gd-amber, #d97706);
}

.activity-axis {
  display: flex;
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted, #6b7280);
}

.activity-axis span {
  flex: 1;
  min-width: 2px;
  max-width: 28px; /* in step with the bars above */
  white-space: nowrap;
}

/* Days: the span's first and last date at either end of the bars */
.activity-axis.days {
  justify-content: space-between;
}

.activity-axis span.range {
  flex: none;
  max-width: none;
}

/* An entity's records: one section per source, under its name and count (and a document
   source's Table | Documents switch) */
.detail-records-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0 3px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #6b7280);
}

.detail-records-source b {
  font-family: var(--gd-font-mono);
  font-weight: 400;
  color: var(--gd-amber, #d97706);
}

/* A document source's records as documents: cards beside the preview, at a fixed height */
.detail-records-body.detail-docs {
  display: flex;
  flex: none;
  height: 420px;
  border: 1px solid var(--gd-rim, #2a3546);
}

/* The detail is narrow: a slimmer card list leaves the preview room */
.detail-docs .doc-view-list {
  flex-basis: 220px;
  min-width: 180px;
}

.triage-note {
  padding: 4px 8px;
  font-size: var(--font-size-xs);
  color: var(--text-muted, #6b7280);
}

/* Criteria and field values are data: each keeps its own direction in either UI language. */
.triage-table td,
.field-value {
  unicode-bidi: plaintext;
}

.field-value {
  color: var(--text-primary, #1f2937);
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ================================
   RISK PROFILE ANALYSIS
   ================================ */

.risk-profile-content {
  background: transparent;
  padding: 0;
}

/* A Summary section with an action on request (the AI summary; field values: load, hide,
   show): a section row like the triage table's, its action an amber link at the right. */
.detail-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 4px;
  padding: 6px 8px 4px;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #6b7280);
}

.detail-action-row .triage-link {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--gd-amber, #d97706);
}

.detail-action-row .triage-link:hover {
  text-decoration: underline;
}

.risk-profile-content:first-child .detail-action-row {
  margin-top: 0;
}

.analysis-text {
  font-size: var(--font-size-sm);
  color: var(--text-primary, #374151);
  line-height: 1.75;
  padding: 4px 0 8px;
}

/* Evidence panel (.evi-*), uniform item layout, popup chrome, mini pills,
   map button → moved to styles/evidence.css */

/* ================================
   CONNECTIONS LIST
   ================================ */

.connections-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.connection-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 4px;
}

.connection-id {
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-primary, #1f2937);
}

.connection-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted, #6b7280);
  flex: 1;
}

.connection-threat {
  font-size: var(--font-size-2xs);
  font-weight: 600;
  text-transform: uppercase;
}

.more-connections {
  font-size: var(--font-size-xs);
  color: var(--text-muted, #6b7280);
  text-align: center;
  padding: 6px;
}

.network-stats {
  display: flex;
  gap: 16px;
  padding: 12px;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-accent-orange, #cc6600);
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.network-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #6b7280);
  gap: 8px;
  padding: 40px;
}

.network-placeholder i {
  font-size: 32px;
  opacity: 0.3;
}

/* Ego Network Visualization */
.ego-network {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 20px;
}

.ego-center {
  display: flex;
  justify-content: center;
}

.ego-node {
  padding: 8px 12px;
  background: var(--bg-tertiary, #f3f4f6);
  border: 1px solid var(--border-light, #d1d5db);
  border-radius: 4px;
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-secondary, #4b5563);
}

.ego-node.center {
  background: var(--color-accent-orange, #cc6600);
  border-color: var(--color-accent-orange, #cc6600);
  color: white;
  font-weight: 600;
}

.ego-connections {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.ego-more {
  padding: 6px 10px;
  background: var(--bg-secondary, #f8f9fa);
  border-radius: 4px;
  font-size: var(--font-size-xs);
  color: var(--text-muted, #6b7280);
}

/* ================================
   LOADING/ERROR/EMPTY STATES
   ================================ */

.error-state,
.empty-state {
  padding: 16px;
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-muted, #6b7280);
}

.error-state {
  color: #dc2626;
}

.error-state i {
  margin-right: 6px;
}

/* Evidence modal enhancements (meta-header, label, quote, meta) → moved to styles/evidence.css */

/* Section header icons */

/* ================================
   PLOTS TAB - Plot Selector
   ================================ */

/* Compact plot selector */
.plot-selector {
  display: flex;
  gap: 4px;
  padding: 0 0 4px 0;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
  margin-bottom: 4px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.plot-type-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-light, #d1d5db);
  border-radius: 4px;
  color: var(--text-secondary, #4b5563);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.plot-type-btn:hover {
  background: var(--bg-tertiary, #f3f4f6);
  border-color: var(--border-medium, #9ca3af);
}

.plot-type-btn.active {
  background: var(--color-accent-orange, #cc6600);
  border-color: var(--color-accent-orange, #cc6600);
  color: white;
}

/* Plot Render Area - takes full remaining height */
.plot-render-area {
  flex: 1;
  min-height: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.plot-render-area > * {
  flex: 1;
  min-height: 0;
}

/* The activity views stack at their own height, top-aligned, scrolling if tall; so does
   the loading box, the same size as everywhere else. */
.plot-render-area:has(> .activity-day) {
  overflow-y: auto;
}

.plot-render-area > .activity-day,
.plot-render-area > .activity-hour,
.plot-render-area > .loading-state {
  flex: none;
}

.plot-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: #dc2626;
  text-align: center;
  padding: 20px;
}

.plot-error i {
  font-size: 32px;
  opacity: 0.5;
  margin-bottom: 12px;
}

.error-detail {
  font-size: var(--font-size-xs);
  color: var(--text-muted, #6b7280);
  margin-top: 8px;
}

.plots-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: var(--text-muted, #6b7280);
  text-align: center;
  padding: 40px;
}

.plots-empty-state i {
  font-size: 48px;
  opacity: 0.2;
  margin-bottom: 16px;
}

.plots-empty-state .empty-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-secondary, #4b5563);
  margin-bottom: 8px;
}

.plots-empty-state .empty-desc {
  font-size: var(--font-size-sm);
  max-width: 300px;
  line-height: 1.5;
}

/* Network Plot Header */
.network-plot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
  background: var(--bg-secondary, #f8f9fa);
}

.network-actions {
  display: flex;
  gap: 4px;
}

.network-action-btn {
  padding: 6px 8px;
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-light, #d1d5db);
  border-radius: 4px;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  transition: all 0.15s ease;
}

.network-action-btn:hover {
  background: var(--bg-tertiary, #f3f4f6);
  color: var(--text-primary, #1f2937);
}

/* Network Graph Container - uses existing D3 network renderer */
#querying-network-graph {
  width: 100%;
  height: 100%;
}

#querying-network-graph svg {
  width: 100%;
  height: 100%;
}

/* Network graph wrapper with floating controls */
.querying-network-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Floating network controls - matches investigation panel style */
.querying-network-controls {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.querying-network-controls button {
  padding: 4px 8px;
  font-size: var(--font-size-xs);
  background: white;
  border: 1px solid var(--color-accent-orange, #cc6600);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  color: var(--text-secondary, #4b5563);
  transition: all 0.15s ease;
}

.querying-network-controls button:hover {
  background: var(--bg-secondary, #f8f9fa);
}

.querying-network-controls button span:first-child {
  color: var(--color-accent-orange, #cc6600);
}

/* ================================
   AI PLAN PREVIEW
   ================================ */

.ai-plan {
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-medium, #d1d5db);
  border-left: 3px solid var(--color-accent-orange, #cc6600);
  border-radius: 6px;
  padding: 0;
  overflow: visible;
  min-width: 0;
}

.ai-plan .plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
  background: var(--bg-secondary, #f8f9fa);
  border-radius: 0 6px 0 0;
}

.ai-plan .plan-label {
  font-size: var(--font-size-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted, #9ca3af);
}

.ai-plan .plan-step-count {
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-placeholder, #b8bfc9);
}

/* Plan steps container - timeline gutter on left */
.ai-plan ol.plan-steps {
  list-style: none;
  margin: 0;
  padding: 12px 14px 8px 14px;
  border: none;
  background: none;
}

/* Each step: positioned for timeline elements */
.ai-plan .plan-step {
  position: relative;
  margin: 0;
  padding: 0 0 0 28px;
  border: none;
  background: none;
}

/* Timeline vertical line */
.ai-plan .plan-step::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--orange-overlay-20, rgba(204, 102, 0, 0.2));
}

/* Hide line below last step's circle */
.ai-plan .plan-step:last-child::before {
  bottom: 50%;
}

.ai-plan .plan-step + .plan-step {
  margin-top: 0;
}

/* Step row - the clickable header */
.ai-plan .step-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm, 4px);
  background: none;
  min-width: 0;
  transition: background 0.15s ease;
}

/* Step number - circle on the timeline */
.ai-plan .step-num {
  position: absolute;
  left: 0;
  top: 14px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--color-accent-orange, #cc6600);
  background: var(--bg-primary, #fff);
  box-shadow: 0 0 0 2px var(--bg-primary, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--gd-font-mono);
  color: var(--color-accent-orange, #cc6600);
  font-size: var(--font-size-2xs);
  font-weight: 800;
  z-index: 1;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

/* Filled circle when step detail is expanded */
.ai-plan .plan-step.step-expanded .step-num {
  background: var(--color-accent-orange, #cc6600);
  color: var(--bg-primary, #fff);
}

.ai-plan .step-text {
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-sm);
  color: var(--text-primary, #374151);
  line-height: 1.6;
  overflow-wrap: break-word;
}

.ai-plan .step-chevron {
  color: var(--border-medium, #d1d5db);
  font-size: var(--font-size-2xs);
  flex-shrink: 0;
  margin-top: 4px;
  transition: all 0.2s ease;
  opacity: 0.5;
}

.ai-plan .step-chevron.expanded {
  transform: rotate(90deg);
  color: var(--text-secondary, #6b7280);
  opacity: 1;
}

/* Step detail - expandable metadata beneath each step */
.ai-plan .step-detail {
  margin: 0 0 6px 10px;
  padding: 6px 12px;
  border-left: 1px solid var(--border-light, #e5e7eb);
  overflow-wrap: break-word;
  min-width: 0;
}

.ai-plan .step-detail p,
.ai-plan .step-detail-item {
  margin: 0;
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted, #9ca3af);
  line-height: 1.6;
}

.ai-plan .detail-data,
.ai-plan .detail-method {
  color: var(--text-placeholder, #b8bfc9);
  font-weight: 600;
  text-transform: uppercase;
  font-size: var(--font-size-2xs);
  letter-spacing: 0.5px;
}

.ai-plan .branch-detail {
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted, #9ca3af);
  line-height: 1.6;
  overflow-wrap: break-word;
}

.ai-plan .branch-section {
  margin-bottom: 3px;
}

.ai-plan .detail-label {
  color: var(--text-placeholder, #b8bfc9);
  font-weight: 600;
  text-transform: uppercase;
  font-size: var(--font-size-2xs);
  letter-spacing: 0.5px;
}

.ai-plan .branch-ops {
  margin: 2px 0 0 16px;
  padding: 0;
  list-style: disc;
}

.ai-plan .branch-ops li {
  margin-bottom: 2px;
}

/* Clickable elements with eye icon */
.ai-plan .hi-clickable {
  cursor: pointer;
}

.ai-plan .hi-clickable .fa-eye {
  font-size: var(--font-size-xs);
  opacity: 0.5;
  margin-left: 2px;
}

.ai-plan .hi-clickable:hover .fa-eye {
  opacity: 1;
}

/* Nested connection criteria (relational profiles) */
.ai-plan ol.conn-crit-list {
  list-style: none;
  margin: 6px 0 4px 0;
  padding: 0 0 0 16px;
}

.ai-plan .conn-crit-item {
  margin: 6px 0;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  cursor: pointer;
}

.ai-plan .conn-crit-chevron {
  color: var(--border-medium, #d1d5db);
  font-size: var(--font-size-2xs);
  margin-left: 6px;
  opacity: 0.5;
  transition: all 0.2s ease;
}

.ai-plan .conn-crit-chevron.expanded {
  transform: rotate(90deg);
  opacity: 1;
  color: var(--text-secondary, #6b7280);
}

.ai-plan .conn-crit-id {
  font-family: var(--gd-font-mono);
  font-weight: 700;
  font-size: var(--font-size-xs);
  color: var(--text-muted, #9ca3af);
  margin-right: 5px;
}

.ai-plan .conn-crit-detail {
  margin-left: 16px;
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted, #9ca3af);
}

.ai-plan .conn-logic {
  margin: 6px 0 0 16px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary, #6b7280);
}

.ai-plan .conn-logic code {
  background: var(--bg-secondary, #f3f4f6);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: var(--font-size-xs);
}

/* Connection criteria groups (visual OR/AND separation) */
.ai-plan .conn-group {
  margin: 0;
}

.ai-plan .conn-group .conn-crit-list {
  margin: 0;
  padding-left: 16px;
}

.ai-plan .conn-op {
  margin: 8px 0 8px 8px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--accent, #3b82f6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ================================
   PLAN POPOVER
   ================================ */

.plan-popover {
  animation: popover-in 0.15s ease-out;
  position: absolute;
  z-index: 100;
  min-width: 200px;
  max-width: 320px;
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

/* A popover on the page itself, above the chat's scroller (placed by PreviewViewer). */
.plan-popover.plan-popover-floating {
  position: fixed;
  z-index: 10000;
}

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

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-secondary, #f8f9fa);
  border-bottom: 1px solid var(--border-light, #e5e7eb);
}

/* Type-specific header colors */
.plan-popover.type-geo .popover-header {
  background: #ecfdf5;
  border-bottom-color: #a7f3d0;
}
.plan-popover.type-geo .popover-title {
  color: #059669;
}

.plan-popover.type-phrases .popover-header {
  background: #faf5ff;
  border-bottom-color: #e9d5ff;
}
.plan-popover.type-phrases .popover-title {
  color: #7c3aed;
}

.plan-popover.type-threshold .popover-header {
  background: #fffbeb;
  border-bottom-color: #fde68a;
}
.plan-popover.type-threshold .popover-title {
  color: #d97706;
}

.plan-popover.type-languages .popover-header {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
}
.plan-popover.type-languages .popover-title {
  color: #2563eb;
}

.plan-popover.type-variable .popover-header,
.plan-popover.type-connections .popover-header {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}
.plan-popover.type-variable .popover-title,
.plan-popover.type-connections .popover-title {
  color: #475569;
}

.popover-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-secondary, #4b5563);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.popover-close {
  background: none;
  border: none;
  padding: 2px 4px;
  color: var(--text-muted, #9ca3af);
  cursor: pointer;
  font-size: var(--font-size-sm);
  line-height: 1;
}

.popover-close:hover {
  color: var(--text-primary, #374151);
}

.popover-content {
  padding: 10px;
}

/* Popover details rows */
.popover-details {
  font-size: var(--font-size-sm);
  color: var(--text-secondary, #4b5563);
}

.popover-row {
  margin-bottom: 4px;
  line-height: 1.4;
}

.popover-row:last-child {
  margin-bottom: 0;
}

.row-label {
  color: var(--text-muted, #9ca3af);
  margin-right: 4px;
}

/* Popover action buttons */
.popover-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid #10b981;
  border-radius: 4px;
  color: #10b981;
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.popover-action:hover {
  background: #10b981;
  color: white;
}

.popover-action i {
  font-size: var(--font-size-xs);
}

/* Pill-style phrases */
.popover-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.popover-pill {
  display: inline-block;
  padding: 4px 8px;
  background: #f3e8ff;
  color: #7c3aed;
  border-radius: 12px;
  font-size: var(--font-size-xs);
  font-weight: 500;
}

/* Tag-style items */
.popover-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.popover-tag {
  display: inline-block;
  padding: 3px 6px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 3px;
  font-size: var(--font-size-xs);
  font-weight: 500;
}

/* Value display (thresholds) */
.popover-value {
  font-size: 24px;
  font-weight: 600;
  color: #d97706;
  text-align: center;
  padding: 8px 0;
  font-family: var(--gd-font-mono);
}

.popover-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted, #9ca3af);
  text-align: center;
  margin-top: 4px;
}

/* Code in popover */
.popover-content code {
  background: var(--bg-tertiary, #e5e7eb);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs);
}

/* Criteria items */
.popover-crit {
  padding: 6px 8px;
  background: #faf5ff;
  border-left: 2px solid #8b5cf6;
  border-radius: 0 4px 4px 0;
  font-size: var(--font-size-xs);
  margin-bottom: 4px;
}

.popover-crit:last-child {
  margin-bottom: 0;
}

.crit-cat {
  color: #7c3aed;
  font-weight: 500;
}

.crit-chars {
  color: var(--text-muted, #9ca3af);
  margin-left: 6px;
  font-size: var(--font-size-xs);
}

/* JSON fallback */
.popover-json {
  font-size: var(--font-size-xs);
  font-family: var(--gd-font-mono);
  background: var(--bg-tertiary, #f3f4f6);
  padding: 8px;
  border-radius: 4px;
  margin: 0;
  overflow-x: auto;
  max-height: 150px;
}

/* Inline interactive elements - tag/pill style with subtle tints */
.ai-plan .hi-emerald,
.ai-plan .hi-purple,
.ai-plan .hi-amber,
.ai-plan .hi-blue,
.ai-plan .hi-cyan,
.ai-plan .hi-slate {
  display: inline;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.ai-plan .hi-emerald:hover,
.ai-plan .hi-purple:hover,
.ai-plan .hi-amber:hover,
.ai-plan .hi-blue:hover,
.ai-plan .hi-cyan:hover,
.ai-plan .hi-slate:hover {
  opacity: 0.8;
}

.ai-plan .hi-emerald {
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.ai-plan .hi-purple {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.ai-plan .hi-amber {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.ai-plan .hi-blue {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.ai-plan .hi-cyan {
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.ai-plan .hi-slate {
  color: var(--text-secondary, #64748b);
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.ai-plan .hi-muted {
  color: var(--text-muted, #9ca3af);
}

/* Inline logic chip inside branch-detail */
.ai-plan .branch-section code {
  background: var(--bg-primary, #fff);
  padding: 1px 6px;
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 3px;
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
}

/* Plan footer */
.ai-plan .plan-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 14px;
  border-top: 1px solid var(--border-light, #e5e7eb);
  background: var(--bg-secondary, #f8f9fa);
}

.ai-plan .plan-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-plan .plan-run {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: #10b981;
  border: 1px solid transparent;
  border-radius: 4px;
  color: white;
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ai-plan .plan-run:hover {
  background: #059669;
}

.ai-plan .plan-run i {
  font-size: var(--font-size-2xs);
}

/* ================================
   DOCUMENT TAB
   ================================ */

.document-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.document-tab-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  margin-bottom: 8px;
}

.document-tab-sources-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
  flex-shrink: 0;
}

.doc-nav-btn {
  background: none;
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 3px;
  padding: 1px 5px;
  cursor: pointer;
  color: var(--text-secondary, #4b5563);
  font-size: var(--font-size-2xs);
  flex-shrink: 0;
}
.doc-nav-btn:hover:not(:disabled) {
  color: var(--color-accent-orange, #cc6600);
  border-color: var(--color-accent-orange, #cc6600);
}
.doc-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.doc-nav-counter {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-secondary, #4b5563);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.document-tab-title {
  flex: 1;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-primary, #111);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-open-btn {
  background: none;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  font-size: var(--font-size-xs);
}

.doc-open-btn:hover {
  color: var(--accent-color, #3b82f6);
  border-color: var(--accent-color, #3b82f6);
}

.document-tab-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.document-tab-iframe {
  flex: 1;
  width: 100%;
  min-height: 300px;
  border: none;
  border-radius: 3px;
  background: var(--bg-secondary, #f9fafb);
}

.document-tab-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.document-tab-html {
  flex: 1;
  overflow-y: auto;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--text-primary, #111);
}

/* Doc view button in AI results table */
.doc-view-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted, #6b7280);
  padding: 2px 4px;
  font-size: var(--font-size-sm);
}

.doc-view-btn:hover {
  color: var(--accent-color, #3b82f6);
}

/* .evidence-cell + .evidence-content-excerpt → moved to styles/evidence.css */
