/* =============================================================================
   AI ASSISTANT DRAWER
   Right-side chat drawer for AI interactions
   ============================================================================= */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 672px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  z-index: 100;
  will-change: transform;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 300ms;
  visibility: hidden;
}

.drawerOpen {
  transform: translateX(0);
  visibility: visible;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s;
}

/* Suppress transitions while the user is dragging the resize handle so
   width tracks the cursor without lag. */
.drawerResizing {
  transition: none !important;
}

/* Drag-to-resize handle on the inner (left) edge of the drawer. */
.resizeHandle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 6px;
  cursor: col-resize;
  background: transparent;
  z-index: 200;
  touch-action: none;
}

.resizeHandle:hover {
  background: var(--accent-primary, #3b82f6);
  opacity: 0.4;
}

/* =============================================================================
   HEADER
   ============================================================================= */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: nowrap;
  padding: var(--space-3) var(--space-4);
  /* RedAmon "world" background, matching redamon.org: the dotted world map (red
     dots on a dark red-to-black base) with a soft crimson glow blooming from the
     left. Top/bottom fade keeps the dots from touching the header edges. This is
     a branded strip, so it stays dark in both themes on purpose. */
  background:
    /* light top/bottom fade so the dots melt into the edges but stay vivid in the
       middle band (low veil opacity keeps the red dots opaque). */
    linear-gradient(to bottom, rgba(4, 2, 2, 0.6) 0%, rgba(4, 2, 2, 0.38) 45%, rgba(4, 2, 2, 0.48) 100%),
    /* dotted world map (muted dark-red dots) */
    url('/agent-worldmap.svg') 28% 42% / cover no-repeat,
    /* soft crimson glow blooming from the left */
    radial-gradient(70% 130% at 14% 45%, rgba(183, 28, 28, 0.28) 0%, transparent 55%),
    /* dark red to black base */
    linear-gradient(115deg, #140505 0%, #080202 55%, #030101 100%);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

/* The header is a permanently-dark branded strip (world-map background), so every
   element inside it uses fixed light-on-dark colors instead of theme variables
   (which flip in light mode) and gets small backdrops / shadows to stay legible
   over the busy dotted map. */
.header .title {
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.header .connectionStatus {
  /* Applies to the green/red status text and the icon glyphs alike. */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.header .subtitle {
  font-weight: var(--font-semibold);
}

.header .sessionCode {
  color: rgba(255, 255, 255, 0.82);
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.2);
}

.header .tokenTotal {
  color: #bfdbfe;
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(96, 165, 250, 0.5);
}

.header .headerIcon {
  /* Sits over the brightest part of the left glow, so it needs its own dark
     plate and a brighter crimson stroke to separate from the red bloom. */
  background: rgba(8, 3, 3, 0.55);
  border-color: rgba(255, 120, 120, 0.9);
  color: #ff6b6b;
  box-shadow: 0 0 12px rgba(229, 57, 53, 0.35);
}

.header .iconButton,
.header .closeButton {
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.header .iconButton:hover:not(:disabled),
.header .closeButton:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.32);
}

.header .iconButtonActive {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.6);
}

.header .iconButtonActive:hover {
  background: rgba(245, 158, 11, 0.32);
  color: #fbbf24;
}

/* ── Light mode: a red-and-white take on the same world background. White base,
   red dotted map + soft red glow, and every element re-tuned to dark/red for
   contrast on the light strip. ───────────────────────────────────────────── */
:global([data-theme="light"]) .header {
  background:
    /* light white veil: fades the dots at the edges but keeps them visible in the
       middle band so the red map reads clearly on white. */
    linear-gradient(to bottom, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 45%, rgba(255, 255, 255, 0.16) 100%),
    /* red dotted world map for the light background */
    url('/agent-worldmap-light.svg') 28% 42% / cover no-repeat,
    /* soft red glow from the left */
    radial-gradient(70% 130% at 14% 45%, rgba(229, 57, 53, 0.16) 0%, transparent 55%),
    /* white to pale-red base */
    linear-gradient(115deg, #ffffff 0%, #fff4f4 55%, #ffe9e9 100%);
}

:global([data-theme="light"]) .header .title {
  color: #b71c1c;
  text-shadow: none;
}

:global([data-theme="light"]) .header .connectionStatus {
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
}

:global([data-theme="light"]) .header .sessionCode {
  color: #7f1d1d;
  background: rgba(255, 245, 245, 0.92);
  border-color: rgba(183, 28, 28, 0.4);
}

:global([data-theme="light"]) .header .tokenTotal {
  color: #1d4ed8;
  background: rgba(239, 244, 255, 0.92);
  border-color: rgba(59, 130, 246, 0.5);
}

:global([data-theme="light"]) .header .headerIcon {
  background: rgba(255, 255, 255, 0.7);
  border-color: #d32f2f;
  color: #d32f2f;
  box-shadow: 0 0 10px rgba(229, 57, 53, 0.2);
}

:global([data-theme="light"]) .header .iconButton,
:global([data-theme="light"]) .header .closeButton {
  background: rgba(255, 255, 255, 0.72);
  color: #4a1414;
  border: 1px solid rgba(183, 28, 28, 0.22);
}

:global([data-theme="light"]) .header .iconButton:hover:not(:disabled),
:global([data-theme="light"]) .header .closeButton:hover {
  background: #ffffff;
  color: #b71c1c;
  border-color: rgba(183, 28, 28, 0.45);
}

.headerLeft {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  /* Allow the left cluster to absorb the width squeeze so the action
     buttons on the right never wrap to a second line. */
  flex: 1 1 auto;
  min-width: 0;
}

.headerIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid #d32f2f; /* RedAmon primary crimson */
  border-radius: var(--radius-lg);
  color: #d32f2f;
}

.headerText {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
  min-width: 0;
}

.stealthBadge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  font-size: 10px;
  font-weight: var(--font-semibold);
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.12);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(139, 92, 246, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.stealthToggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  font-size: 10px;
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition-all);
}

.stealthToggle:hover {
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.08);
}

.stealthToggleActive {
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.4);
}

.stealthToggleActive:hover {
  background: rgba(139, 92, 246, 0.2);
}

/* Settings dropdown */
.settingsWrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.settingsButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition-all);
}

.settingsButton:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.settingsDropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 160px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  overflow: hidden;
}

.settingsDropdownItem {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease;
}

.settingsDropdownItem:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.settingsDropdownItem + .settingsDropdownItem {
  border-top: 1px solid var(--border-default);
}

/* Settings Modal */
.settingsModalOverlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.settingsModal {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  width: calc(100% - 24px);
  max-height: 85%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.settingsModalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.settingsModalTitle {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

.settingsModalClose {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition-all);
}

.settingsModalClose:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.settingsModalBody {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.modelBadge {
  font-family: inherit;
  font-size: 10px;
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  line-height: 1;
  cursor: pointer;
  outline: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.modelBadge:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
}

/* Model Picker Modal */
.modelModal {
  max-height: 70%;
}

.modelModalBody {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modelModalSearch {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border: none;
  border-bottom: 1px solid var(--border-default);
  outline: none;
  color: var(--text-primary);
  font-size: var(--text-xs);
}

.modelModalSearch::placeholder {
  color: var(--text-tertiary);
}

.modelModalSearch:focus {
  background: var(--bg-secondary);
}

.modelModalManualInput {
  width: 100%;
  margin-top: var(--space-1);
  padding: var(--space-1-5) var(--space-2);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  outline: none;
  color: var(--text-primary);
  font-size: var(--text-xs);
}

.modelList {
  flex: 1;
  overflow-y: auto;
  max-height: 400px;
}

.modelListEmpty {
  padding: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.modelListGroup {
  border-bottom: 1px solid var(--border-subtle);
}

.modelListGroup:last-child {
  border-bottom: none;
}

.modelListGroupHeader {
  padding: var(--space-1-5) var(--space-2);
  font-size: 10px;
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  background: var(--bg-tertiary);
  position: sticky;
  top: 0;
}

.modelListOption {
  padding: var(--space-1-5) var(--space-2);
  cursor: pointer;
  transition: background 0.1s;
}

.modelListOption:hover {
  background: var(--bg-hover);
}

.modelListOptionSelected {
  background: color-mix(in srgb, var(--accent-secondary) 15%, transparent);
}

.modelListOptionMain {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.modelListOptionName {
  font-size: var(--text-xs);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modelListOptionCtx {
  flex-shrink: 0;
  font-size: 9px;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1px 4px;
}

.modelListOptionDesc {
  display: block;
  font-size: 9px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subtitle {
  font-size: 10px;
  color: var(--text-tertiary);
}

.connectionStatus {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  /* When the drawer is narrow, the status badges wrap onto their own line
     inside the left column instead of shoving the action buttons down. */
  flex-wrap: wrap;
  min-width: 0;
  row-gap: var(--space-1);
}

.sessionCode {
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  letter-spacing: 0.3px;
}

.tokenTotal {
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  color: var(--text-secondary);
  background: rgba(59, 130, 246, 0.08);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.25);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.connectionIcon {
  flex-shrink: 0;
}

.spinner {
  animation: spin 1s linear infinite;
}

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

.headerActions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  /* Keep every action button on a single row regardless of drawer width. */
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.iconButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-all);
}

.iconButton:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.iconButton:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.iconButtonActive {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.iconButtonActive:hover {
  background: rgba(245, 158, 11, 0.25);
  color: #f59e0b;
}

.closeButton {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-xl);
  cursor: pointer;
  transition: var(--transition-all);
}

.closeButton:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* =============================================================================
   MESSAGES AREA (Unified Chat)
   ============================================================================= */

.messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Empty State */
.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-4) var(--space-4);
  min-height: 100%;
  overflow-y: auto;
}

.emptyIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.emptyTitle {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-2) 0;
}

.emptyDescription {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-6) 0;
  max-width: 280px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  width: 100%;
}

.suggestion {
  padding: var(--space-1) var(--space-3);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-all);
  white-space: nowrap;
}

.suggestion:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* Template group accordion */

.templateGroups {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.templateGroup {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.templateGroupHeader {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border: none;
  color: var(--tg-color);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: background 0.15s ease;
}

.templateGroupHeader:hover {
  background: var(--bg-hover);
}

.templateGroupHeader svg {
  flex-shrink: 0;
}

.templateGroupChevron {
  margin-left: auto;
  transition: transform 0.2s ease;
}

.templateGroupHeaderOpen .templateGroupChevron {
  transform: rotate(180deg);
}

.templateGroupItems {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1-5);
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border-default);
  background: var(--bg-primary);
  max-height: 50vh;
  overflow-y: auto;
}

/* Sub-group accordion (nested inside social engineering) */

.templateSubGroupHeader {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1-5) var(--space-2);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  margin-top: var(--space-1);
}

.templateSubGroupHeader:first-child {
  margin-top: 0;
}

.templateSubGroupHeader:hover {
  background: var(--bg-hover);
}

.templateSubGroupHeaderOpen {
  color: var(--accent-primary);
}

.templateSubGroupChevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.templateSubGroupHeaderOpen .templateSubGroupChevron {
  transform: rotate(180deg);
}

.templateSubGroupItems {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1-5);
  padding: var(--space-1-5) 0;
}

.templateOsLabel {
  width: 100%;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: var(--space-1) 0 2px 0;
  margin-top: var(--space-1);
  border-bottom: 1px solid var(--border-default);
}

.templateOsLabel:first-child {
  margin-top: 0;
}

/* =============================================================================
   MESSAGE BUBBLES
   ============================================================================= */

.message {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  animation: fadeIn 200ms ease-out;
}

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

.messageUser {
  flex-direction: row-reverse;
}

.messageIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  background: transparent;
  border: 1px solid;
}

.messageUser .messageIcon {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

.messageAssistant .messageIcon {
  border-color: #d32f2f; /* RedAmon primary crimson */
  color: #d32f2f;
}

.messageContent {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 85%;
  min-width: 0;
  overflow: hidden;
}

.messageText {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  overflow-x: auto;
  min-width: 0;
}

/* Markdown content styling - minimal overrides for react-markdown */
.messageText p {
  margin: 0;
}

.messageText p + p {
  margin-top: var(--space-2);
}

/* Headings spacing */
.messageText h1,
.messageText h2,
.messageText h3,
.messageText h4,
.messageText h5,
.messageText h6 {
  margin: var(--space-3) 0 var(--space-2) 0;
  font-weight: 600;
}

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

/* Style lists to keep bullets inside container */
.messageText ul,
.messageText ol {
  margin: var(--space-2) 0;
  padding-left: var(--space-5, 1.25rem);
}

.messageText li {
  margin: var(--space-1) 0;
}

/* Style inline code (not in code blocks) */
.messageText code {
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.9em;
}

.messageUser .messageText code {
  background: rgba(255, 255, 255, 0.15);
}

/* Tables - horizontal scroll for wide tables */
.messageText table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: var(--space-2) 0;
  font-size: var(--text-xs);
}

.messageText thead {
  display: table;
  width: 100%;
  table-layout: auto;
}

.messageText tbody {
  display: table;
  width: 100%;
  table-layout: auto;
}

.messageText th,
.messageText td {
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border-default);
  text-align: left;
  white-space: nowrap;
}

.messageText th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: var(--font-semibold);
}

.messageText tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* Syntax Highlighter container styling */
.messageText :global(div[class*="language-"]) {
  border-radius: var(--radius-md);
  margin: var(--space-2) 0;
  font-size: var(--text-xs);
}

.messageUser .messageText {
  background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(59, 130, 246, 0.15) 100%);
  color: var(--text-primary);
  border-bottom-right-radius: var(--radius-sm);
}

.messageAssistant .messageText {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(211, 47, 47, 0.08) 100%);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
  font-size: var(--text-xs);
}

/* Error Badge */
.errorBadge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--status-error-bg);
  border-radius: var(--radius-sm);
  color: var(--status-error-text);
  font-size: 10px;
}

/* Loading Indicator */
.loadingIndicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.spinner {
  animation: spin 1s linear infinite;
}

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

.loadingEyeIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  width: auto !important;
  height: auto !important;
}

.eyeContainer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loadingEye {
  transform: scale(1);
}

.eyePupil {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% + 4px), calc(-50% - 2px));
  animation: pupilFlash 3s ease-in-out infinite;
}

@keyframes pupilFlash {
  0% { background: #facc15; box-shadow: 0 0 3px 1px #facc15; }
  8% { background: #22d3ee; box-shadow: 0 0 3px 1px #22d3ee; }
  16% { background: #f97316; box-shadow: 0 0 3px 1px #f97316; }
  24% { background: #a78bfa; box-shadow: 0 0 3px 1px #a78bfa; }
  32% { background: #4ade80; box-shadow: 0 0 3px 1px #4ade80; }
  40% { background: #f472b6; box-shadow: 0 0 3px 1px #f472b6; }
  48% { background: #38bdf8; box-shadow: 0 0 3px 1px #38bdf8; }
  56% { background: #ef4444; box-shadow: 0 0 3px 1px #ef4444; }
  64% { background: #2dd4bf; box-shadow: 0 0 3px 1px #2dd4bf; }
  72% { background: #e879f9; box-shadow: 0 0 3px 1px #e879f9; }
  80% { background: #84cc16; box-shadow: 0 0 3px 1px #84cc16; }
  88% { background: #fb923c; box-shadow: 0 0 3px 1px #fb923c; }
  100% { background: #facc15; box-shadow: 0 0 3px 1px #facc15; }
}

.hackerIcon {
  animation: hackerPulse 1.5s ease-in-out infinite;
  color: var(--accent-red, #ef4444);
}

@keyframes hackerPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.15);
  }
}

.loadingWord {
  animation: fadeInUp 0.4s ease-out;
  display: inline-block;
}

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

/* =============================================================================
   INPUT AREA
   ============================================================================= */

.inputContainer {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-primary);
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}

.inputWrapper {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: 4px 4px 4px var(--space-2);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: var(--transition-all);
}

.inputWrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.15);
}

.input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  resize: vertical;
  min-height: 20px;
  max-height: 50vh;
  line-height: var(--leading-normal);
  padding: 4px 0;
}

.input::placeholder {
  color: var(--text-tertiary);
}

.input:disabled {
  opacity: 0.6;
}

.sendButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-on-accent);
  cursor: pointer;
  transition: var(--transition-all);
  flex-shrink: 0;
}

.sendButton:hover:not(:disabled) {
  filter: brightness(1.1);
}

.sendButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================================================
   INPUT ACTIONS (send + stop/resume buttons)
   ============================================================================= */

.inputActions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.stopResumeButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 150ms ease;
  flex-shrink: 0;
}

.stopButton {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.stopButton:hover {
  background: rgba(239, 68, 68, 0.25);
}

.resumeButton {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.resumeButton:hover {
  background: rgba(16, 185, 129, 0.25);
}

/* =============================================================================
   GUIDANCE MESSAGES
   ============================================================================= */

.messageGuidance .messageText {
  background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(139, 92, 246, 0.15) 100%) !important;
  border: 1px dashed rgba(139, 92, 246, 0.4);
  font-style: italic;
  border-bottom-right-radius: var(--radius-sm);
}

.guidanceBadge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-sm);
  color: rgba(139, 92, 246, 0.9);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

/* =============================================================================
   REPORT HEADER & PDF DOWNLOAD
   ============================================================================= */

.reportHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 4px;
}

.reportBadge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: rgba(211, 47, 47, 0.12);
  border: 1px solid rgba(211, 47, 47, 0.3);
  border-radius: var(--radius-sm);
  color: #d32f2f;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summaryBadge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: rgba(25, 118, 210, 0.12);
  border: 1px solid rgba(25, 118, 210, 0.3);
  border-radius: var(--radius-sm);
  color: #1976d2;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reportDownloadButton {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(211, 47, 47, 0.1);
  border: 1px solid rgba(211, 47, 47, 0.25);
  border-radius: var(--radius-md);
  color: #d32f2f;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-all);
  white-space: nowrap;
}

.reportDownloadButton:hover {
  background: rgba(211, 47, 47, 0.2);
  border-color: rgba(211, 47, 47, 0.5);
}

.reportDownloadButton:active {
  transform: scale(0.96);
}

.copyButton {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin-top: 6px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-all);
  opacity: 0;
}

.message:hover .copyButton {
  opacity: 1;
}

.copyButton:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
}

.copyButton:active {
  transform: scale(0.96);
}

.copyButtonCopied {
  opacity: 1;
  color: #4caf50;
  border-color: rgba(76, 175, 80, 0.3);
}

/* --- Code block copy button --- */

.codeBlockWrapper {
  position: relative;
}

.codeBlockCopyButton {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition-all);
  opacity: 0;
  z-index: 1;
}

.codeBlockWrapper:hover .codeBlockCopyButton {
  opacity: 1;
}

.codeBlockCopyButton:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-secondary);
}

.codeBlockCopyButtonCopied {
  opacity: 1;
  color: #4caf50;
  border-color: rgba(76, 175, 80, 0.3);
  background: rgba(76, 175, 80, 0.1);
}

/* --- Table cell copy button --- */

.tableCellContent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tableCellCopyButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition-all);
  opacity: 0;
  flex-shrink: 0;
}

td:hover .tableCellCopyButton {
  opacity: 0.6;
}

.tableCellCopyButton:hover {
  opacity: 1 !important;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.08);
}

.tableCellCopyButtonCopied {
  opacity: 1 !important;
  color: #4caf50;
}

/* =============================================================================
   PHASE INDICATOR
   ============================================================================= */

.phaseIndicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.phaseBadge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.phaseToolsIcon {
  color: var(--accent-primary);
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.phaseToolsIcon:hover {
  opacity: 1;
}

.phaseToolsTooltip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 300px;
  overflow-y: auto;
  /* nicer scrollbar inside the dark tooltip */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.phaseToolsTooltip::-webkit-scrollbar {
  width: 6px;
}

.phaseToolsTooltip::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}

.phaseToolsHeader {
  font-size: 10px;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  color: var(--color-gray-500);
}

.phaseToolsItem {
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  color: var(--color-gray-100);
  padding: 1px 0;
}

.iterationCount {
  font-size: 10px;
  color: var(--text-tertiary);
}

/* Attack Skill badge tooltip */
.skillTooltip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
  /* nicer scrollbar inside the dark tooltip */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.skillTooltip::-webkit-scrollbar {
  width: 6px;
}

.skillTooltip::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}

.skillTooltipHeader {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-gray-400);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-gray-700);
}

.skillTooltipGroup {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.skillTooltipGroupLabel {
  font-size: 9px;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-gray-500);
  margin-bottom: 1px;
}

.skillTooltipItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--color-gray-200);
}

.skillTooltipItemActive {
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-gray-50);
}

.skillTooltipItemDisabled {
  opacity: 0.4;
}

.skillTooltipName {
  flex: 1;
  white-space: nowrap;
}

.skillTooltipCheck {
  color: var(--accent-primary, #3b82f6);
  flex-shrink: 0;
}

.skillTooltipOff {
  font-size: 9px;
  font-weight: var(--font-semibold);
  color: var(--color-gray-500);
  text-transform: uppercase;
}

/* Phase badge on individual messages */
.messagePhaseBadge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-1);
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: var(--space-1);
}

/* =============================================================================
   TODO LIST WIDGET CONTAINER
   ============================================================================= */

.todoWidgetContainer {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
  max-height: 200px;
  overflow-y: auto;
}

/* =============================================================================
   APPROVAL DIALOG
   ============================================================================= */

.approvalDialog {
  margin: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 2px solid var(--status-warning-text);
  border-radius: var(--radius-lg);
  animation: fadeIn 200ms ease-out;
  display: flex;
  flex-direction: column;
  flex-shrink: 1;
  min-height: 0;
  max-height: 60vh;
  overflow: hidden;
}

.approvalHeader {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-default);
}

.approvalHeader svg {
  color: var(--status-warning-text);
}

.approvalHeader h4 {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.approvalContent {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow-y: auto;
  min-height: 0;
}

.approvalTransition {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
}

.approvalFrom,
.approvalTo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
}

.approvalArrow {
  color: var(--text-tertiary);
  font-size: var(--text-lg);
}

.approvalDisclaimer {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
}

.approvalDisclaimerIcon {
  flex-shrink: 0;
  color: #ef4444;
  margin-top: 2px;
}

.approvalDisclaimerText {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

.approvalDisclaimerText strong {
  color: var(--text-primary);
}

.approvalReason {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin: 0;
}

.approvalSection {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.approvalSection h5 {
  margin: 0;
  font-size: 11px;
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.approvalSection ul {
  margin: 0;
  padding-left: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.approvalSection li {
  margin-bottom: var(--space-1);
}

.modificationInput {
  width: 100%;
  min-height: 80px;
  padding: var(--space-2);
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  resize: vertical;
  transition: var(--transition-all);
}

.modificationInput:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.15);
}

.modificationInput::placeholder {
  color: var(--text-tertiary);
}

.approvalActions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  flex-shrink: 0;
}

.approvalButton {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: var(--transition-all);
}

.approvalButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.approvalButtonApprove {
  background: var(--status-success-bg);
  border-color: var(--status-success-text);
  color: var(--status-success-text);
}

.approvalButtonApprove:hover:not(:disabled) {
  background: var(--status-success-text);
  color: var(--text-on-accent);
}

.approvalButtonModify {
  background: var(--status-warning-bg);
  border-color: var(--status-warning-text);
  color: var(--status-warning-text);
}

.approvalButtonModify:hover:not(:disabled) {
  background: var(--status-warning-text);
  color: var(--text-on-accent);
}

.approvalButtonAbort {
  background: var(--status-error-bg);
  border-color: var(--status-error-text);
  color: var(--status-error-text);
}

.approvalButtonAbort:hover:not(:disabled) {
  background: var(--status-error-text);
  color: var(--text-on-accent);
}

/* =============================================================================
   Q&A DIALOG
   ============================================================================= */

.questionDialog {
  margin: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 2px solid var(--accent-primary);
  border-radius: var(--radius-lg);
  animation: fadeIn 200ms ease-out;
  display: flex;
  flex-direction: column;
  flex-shrink: 1;
  min-height: 0;
  max-height: 60vh;
  overflow: hidden;
}

.questionHeader {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-default);
  font-weight: var(--font-semibold);
  color: var(--accent-primary);
}

.questionHeader svg {
  color: var(--accent-primary);
}

.questionContent {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 50vh;
  overflow-y: auto;
}

.questionText {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  line-height: var(--leading-relaxed);
}

.questionText p {
  margin: 0;
}

.questionText p + p {
  margin-top: var(--space-2);
}

.questionText ul,
.questionText ol {
  margin: var(--space-2) 0;
  padding-left: var(--space-5, 1.25rem);
}

.questionText li {
  margin: var(--space-1) 0;
}

.questionText code {
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.9em;
}

.questionText h1,
.questionText h2,
.questionText h3,
.questionText h4,
.questionText h5,
.questionText h6 {
  margin: var(--space-3) 0 var(--space-2) 0;
  font-weight: 600;
}

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

.questionText :global(div[class*="language-"]) {
  border-radius: var(--radius-md);
  margin: var(--space-2) 0;
  font-size: var(--text-xs);
}

.questionContext {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.questionContext p {
  margin: 0;
}

.questionContext p + p {
  margin-top: var(--space-1);
}

.answerInput {
  width: 100%;
  min-height: 80px;
  padding: var(--space-2);
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  resize: vertical;
}

.answerInput:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.answerInput::placeholder {
  color: var(--text-tertiary);
}

.optionsList {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.optionRadio,
.optionCheckbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-all);
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.optionRadio:hover,
.optionCheckbox:hover {
  border-color: var(--accent-primary);
  background: var(--bg-elevated);
}

.optionRadio input,
.optionCheckbox input {
  accent-color: var(--accent-primary);
}

.questionActions {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}

.answerButton {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: var(--transition-all);
}

.answerButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.answerButtonSubmit {
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--text-on-accent);
}

.answerButtonSubmit:hover:not(:disabled) {
  filter: brightness(1.1);
}

/* API Key quick-add modal (inside drawer) */
.apiKeyOverlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  animation: fadeIn 150ms ease-out;
}

.apiKeyModal {
  width: 380px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.apiKeyModalTitle {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.apiKeyInputWrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.apiKeyInputWrapper input {
  flex: 1;
  padding-right: 36px;
}

.apiKeyToggle {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
}

.apiKeyToggle:hover {
  color: var(--text-primary);
}

.apiKeyModalActions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Danger badge for disabled tool confirmation */
.dangerBadge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #ef4444;
  animation: dangerPulse 2s ease-in-out infinite;
  cursor: help;
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  background: rgba(239, 68, 68, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.3);
  letter-spacing: 0.3px;
  white-space: nowrap;
  align-self: center;
}

@keyframes dangerPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Graph scope selector bar */
/* Tool args preview in confirmation dialog */
.toolArgsPreview {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 6px 8px;
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.4;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-secondary);
  max-height: 120px;
  overflow-y: auto;
}

/* =============================================================================
   SKILL PICKER
   ============================================================================= */

.inputWrapperOuter {
  position: relative;
}

.skillPickerButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-all);
  flex-shrink: 0;
}

.skillPickerButton:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.skillDropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  z-index: 200;
  padding: var(--space-1) 0;
}

.skillDropdownEmpty {
  padding: var(--space-3);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.skillCategoryLabel {
  padding: var(--space-1-5) var(--space-3) var(--space-0-5);
  font-size: 10px;
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
}

.skillDropdownItem {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1-5) var(--space-3);
  cursor: pointer;
  transition: background-color 100ms ease;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.skillDropdownItem:hover {
  background: rgba(255, 255, 255, 0.06);
}

.skillDropdownItemActive {
  background: rgba(229, 57, 53, 0.12);
}

.skillDropdownItemActive:hover {
  background: rgba(229, 57, 53, 0.18);
}

.skillItemName {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skillCategoryBadge {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.skillDropdownHint {
  padding: var(--space-1) var(--space-3);
  font-size: 10px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-default);
  display: flex;
  gap: var(--space-2);
}

.skillDropdownHint kbd {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  font-size: 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-default);
  border-radius: 3px;
  font-family: inherit;
  color: var(--text-secondary);
}

/* Active skill badge */
.activeSkillBadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 6px;
  margin-bottom: 6px;
  background: rgba(229, 57, 53, 0.1);
  border: 1px solid rgba(229, 57, 53, 0.35);
  border-radius: var(--radius-md);
  font-size: 11px;
  color: #ef5350;
  line-height: 1;
  max-width: 100%;
}

.activeSkillBadgeName {
  font-weight: var(--font-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activeSkillBadgeCategory {
  font-size: 9px;
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid var(--border-default);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.activeSkillRemove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-left: 2px;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: rgba(229, 57, 53, 0.6);
  cursor: pointer;
  transition: var(--transition-all);
  flex-shrink: 0;
}

.activeSkillRemove:hover {
  background: rgba(229, 57, 53, 0.2);
  color: #ef5350;
}

.skillDropdownActions {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-default);
}

.skillDropdownActionBtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  transition: var(--transition-all);
  white-space: nowrap;
}

.skillDropdownActionBtn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.skillDropdownActionBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

