/* ==========================================================================
   Terminal CLI & Canvas Theme
   ========================================================================== */

:root {
  --term-bg: #090d16;
  --term-surface: #0f1523;
  --term-card: #131b2e;
  --term-border: #1e293b;

  --term-text: #e2e8f0;
  --term-dim: #64748b;
  --term-muted: #94a3b8;

  --cli-cyan: #38bdf8;
  --cli-green: #4ade80;
  --cli-magenta: #e879f9;
  --cli-yellow: #facc15;
  --cli-red: #f87171;
  --cli-blue: #60a5fa;

  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --font-sans: 'Inter', sans-serif;
}

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

html {
  height: 100%;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-mono);
  background-color: var(--term-bg);
  color: var(--term-text);
  line-height: 1.5;
  height: 100%;
  height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  position: fixed;
  inset: 0;
  -webkit-font-smoothing: antialiased;
}

/* Colors */
.cli-cyan {
  color: var(--cli-cyan);
}

.cli-green {
  color: var(--cli-green);
}

.cli-magenta {
  color: var(--cli-magenta);
}

.cli-yellow {
  color: var(--cli-yellow);
}

.cli-red {
  color: var(--cli-red);
}

.cli-dim {
  color: var(--term-dim);
}

/* Layout */
.terminal-layout {
  display: flex;
  height: 100%;
  height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  background: var(--term-bg);
}

.terminal-pane {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--term-bg);
  overflow: hidden;
  position: relative;
  width: 100%;
  min-width: 0;
}

/* Resizer */
.resizer {
  width: 5px;
  background: var(--term-border);
  cursor: col-resize;
  transition: background 0.15s ease;
  z-index: 30;
}

.resizer:hover,
.resizer.dragging {
  background: var(--cli-cyan);
}

/* --------------------------------------------------------------------------
   Ambient Cyber Tron Grid & Scanline FX
   -------------------------------------------------------------------------- */
.tron-bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(to right, rgba(56, 189, 248, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.1) 75%, transparent 100%);
  z-index: 1;
  opacity: 0;
  animation: gridPowerOn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes gridPowerOn {
  0% {
    opacity: 0;
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.tron-scanline-beam {
  position: fixed;
  top: -120px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, #38bdf8 20%, #ffffff 50%, #38bdf8 80%, transparent 100%);
  box-shadow: 0 0 16px #38bdf8, 0 0 35px #38bdf8, 0 0 70px rgba(56, 189, 248, 0.9);
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  animation: laserSweep 0.65s cubic-bezier(0.25, 1, 0.35, 1) forwards;
}

@keyframes laserSweep {
  0% {
    top: -20px;
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    top: 105vh;
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Hero / Initial Centered Screen
   -------------------------------------------------------------------------- */
.terminal-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  height: 100%;
  max-height: 100dvh;
  padding: 24px 20px;
  text-align: center;
  position: relative;
  z-index: 2;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  width: 100%;
}

/* --------------------------------------------------------------------------
   Glowing Tron Logo & Cyberpunk Header
   -------------------------------------------------------------------------- */
.hero-logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.hero-logo-glow {
  width: 230px;
  max-width: 70vw;
  height: auto;
  user-select: none;
  filter: none;
  transition: filter 0.8s ease;
  animation: logoFadeIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.1s backwards;
}

@keyframes logoFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-logo-glow.live-glow {
  animation: liveGlowPulse 3.6s ease-in-out infinite;
}

@keyframes liveGlowPulse {
  0%, 100% {
    filter: drop-shadow(0 0 14px rgba(56, 189, 248, 0.4)) drop-shadow(0 0 36px rgba(6, 182, 212, 0.22));
  }
  50% {
    filter: drop-shadow(0 0 28px rgba(56, 189, 248, 0.75)) drop-shadow(0 0 62px rgba(6, 182, 212, 0.45));
  }
}

.hero-logo-glow.live-glow:hover {
  filter: drop-shadow(0 0 32px rgba(56, 189, 248, 0.9)) drop-shadow(0 0 72px rgba(6, 182, 212, 0.65));
}

.hero-brand-title {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #f8fafc;
  margin-top: 14px;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
  animation: titleGlowIn 0.5s ease-out 0.15s backwards;
}

@keyframes titleGlowIn {
  0% {
    opacity: 0;
    transform: translateY(6px);
    letter-spacing: 7px;
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    letter-spacing: 4px;
    filter: blur(0);
  }
}

.hero-brand-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--cli-cyan);
  margin-top: 4px;
  opacity: 0.9;
  animation: subtitleIn 0.4s ease-out 0.25s backwards;
}

@keyframes subtitleIn {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  100% {
    opacity: 0.9;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Cyberpunk Data Source Chips
   -------------------------------------------------------------------------- */
.cyber-chips-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 920px;
  margin-bottom: 20px;
  padding: 0 10px;
}

.cyber-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), inset 0 0 8px rgba(56, 189, 248, 0.03);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: default;
  user-select: none;
  animation: chipBoot 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.cyber-chip:nth-child(1) { animation-delay: 0.15s; }
.cyber-chip:nth-child(2) { animation-delay: 0.22s; }
.cyber-chip:nth-child(3) { animation-delay: 0.29s; }
.cyber-chip:nth-child(4) { animation-delay: 0.36s; }
.cyber-chip:nth-child(5) { animation-delay: 0.43s; }

@keyframes chipBoot {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.92);
    border-color: rgba(56, 189, 248, 0.8);
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.4);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    border-color: rgba(56, 189, 248, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), inset 0 0 8px rgba(56, 189, 248, 0.03);
  }
}

.cyber-chip:hover {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.28), inset 0 0 10px rgba(56, 189, 248, 0.06);
  transform: translateY(-1.5px);
}

.cyber-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 6px #22c55e, 0 0 10px rgba(34, 197, 94, 0.8);
  animation: neon-pulse 2.2s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes neon-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 6px #22c55e, 0 0 12px rgba(34, 197, 94, 0.85);
  }
  50% {
    opacity: 0.65;
    transform: scale(0.85);
    box-shadow: 0 0 2px #22c55e, 0 0 5px rgba(34, 197, 94, 0.4);
  }
}

.cyber-chip-icon {
  font-size: 13px;
  line-height: 1;
}

.cyber-chip-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.15;
}

.cyber-chip-name {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: 0.2px;
}

.cyber-chip-detail {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--term-dim);
  letter-spacing: -0.2px;
}

/* --------------------------------------------------------------------------
   Terminal Stream Top Bar
   -------------------------------------------------------------------------- */
.terminal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: rgba(10, 15, 26, 0.92);
  border-bottom: 1px solid var(--term-border);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  width: 32px;
  height: auto;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.5));
}

.topbar-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #f8fafc;
}

.topbar-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--cli-cyan);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: 0.5px;
}

.topbar-chips {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-chip-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--term-muted);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 16px;
  padding: 4px 12px;
}

.topbar-scratchpad-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.topbar-scratchpad-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
  color: #ffffff;
}

.scratchpad-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulseLive 1.5s infinite;
}

@keyframes pulseLive {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #22c55e; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.cli-system-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--term-muted);
  margin-bottom: 28px;
}

.hero-input-box {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 820px;
  background: var(--term-surface);
  border: 1px solid var(--term-border);
  border-radius: 8px;
  padding: 10px 14px;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  animation: inputBoxBoot 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.48s backwards;
  box-sizing: border-box;
  flex-shrink: 0;
}

@keyframes inputBoxBoot {
  0% {
    opacity: 0;
    transform: translateY(12px);
    border-color: var(--cli-cyan);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-input-box .cli-prompt-label {
  margin-top: 1px;
  margin-right: 4px;
}

.hero-input-box:focus-within {
  border-color: var(--cli-magenta);
  box-shadow: 0 0 16px rgba(232, 121, 249, 0.25);
}

/* --------------------------------------------------------------------------
   Terminal Stream & Logs
   -------------------------------------------------------------------------- */
.terminal-stream {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 13.5px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.terminal-stream::-webkit-scrollbar {
  width: 8px;
}

.terminal-stream::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}

.terminal-log-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* User Prompt Row */
.cli-user-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 600;
  color: #fff;
  padding-top: 8px;
}

.cli-prompt-label {
  color: var(--cli-magenta);
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  margin-right: 5px;
}

.cli-prompt-text {
  color: #fff;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Agent Thinking & Reasoning */
.cli-thought {
  display: block;
  background: rgba(99, 102, 241, 0.08);
  border: 1px dashed rgba(168, 85, 247, 0.35);
  border-radius: 6px;
  padding: 6px 12px;
  animation: fadeIn 0.2s ease;
  margin-bottom: 6px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cli-thought:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(168, 85, 247, 0.5);
}

.cli-thought-details {
  width: 100%;
}

.cli-thought-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: #c084fc;
  transition: color 0.15s ease;
  outline: none;
}

.cli-thought-summary:hover {
  color: #e9d5ff;
}

.cli-thought-summary::-webkit-details-marker {
  color: #a855f7;
}

.cli-thought-summary::marker {
  color: #a855f7;
}

.cli-thought-icon {
  font-style: normal;
  flex-shrink: 0;
  font-size: 13px;
}

.cli-thought-title {
  color: #d8b4fe;
  font-weight: 600;
  flex-shrink: 0;
}

.cli-thought-colon {
  color: #d8b4fe;
  font-weight: 600;
  flex-shrink: 0;
  margin-right: 2px;
}

.cli-thought-preview {
  color: #94a3b8;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.cli-thought-details[open] .cli-thought-preview,
.cli-thought-details[open] .cli-thought-colon {
  display: none;
}

.cli-thought-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(168, 85, 247, 0.2);
  color: #cbd5e1;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}

/* Live Active Processing Indicator */
.cli-processing-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12.5px;
  color: var(--cli-cyan);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
  animation: fadeIn 0.15s ease;
}

.pulsing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pulsing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cli-cyan);
  box-shadow: 0 0 8px var(--cli-cyan);
  animation: pulse-ring 1.2s infinite ease-in-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px var(--cli-cyan); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.processing-text {
  color: #e2e8f0;
}

.live-timer-chip {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--cli-yellow);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(250, 204, 21, 0.2);
}

/* --------------------------------------------------------------------------
   Grok-Style Decluttered Execution Trace & Timeline
   -------------------------------------------------------------------------- */
.grok-trace {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 0 10px 0;
  width: 100%;
  animation: fadeIn 0.2s ease-out;
}

/* Header: "Worked for 33s ˅" or "Working for 12s ˄" */
.grok-trace-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 6px 8px;
  margin: 0;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  width: fit-content;
  max-width: 100%;
  transition: background 0.15s ease, opacity 0.15s ease;
  color: inherit;
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
  text-align: left;
}

.grok-trace-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Amber/Orange badge tag */
.grok-badge-tag {
  background: #f59e0b; /* Amber 500 */
  color: #090d16;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.2px;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.grok-badge-tag.working {
  background: #ea580c; /* Orange 600 */
  color: #ffffff;
  box-shadow: 0 0 12px rgba(234, 88, 12, 0.4);
  animation: grok-pulse 2s infinite ease-in-out;
}

@keyframes grok-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.98); }
}

/* Duration */
.grok-trace-time {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  flex-shrink: 0;
}

/* Chevron */
.grok-chevron {
  font-size: 11px;
  color: #64748b;
  transition: transform 0.2s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}

.grok-trace.collapsed .grok-chevron {
  transform: rotate(0deg);
}

.grok-trace:not(.collapsed) .grok-chevron {
  transform: rotate(180deg);
}

/* Active Sub-Status during execution */
.grok-trace-sub {
  font-size: 12px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  margin-left: 4px;
}

/* Timeline Container */
.grok-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 4px 0 6px 8px;
  margin-left: 6px;
  gap: 0;
  transition: all 0.2s ease-in-out;
}

.grok-trace.collapsed .grok-timeline {
  display: none;
}

/* Step Item in Timeline */
.grok-step {
  position: relative;
  display: flex;
  flex-direction: column;
  padding-left: 30px;
  padding-bottom: 12px;
  min-height: 24px;
}

.grok-step:last-child {
  padding-bottom: 2px;
}

/* Vertical Connecting Line */
.grok-step::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 18px;
  bottom: 0;
  width: 1.5px;
  background: rgba(148, 163, 184, 0.22);
}

.grok-step:last-child::before {
  display: none;
}

/* Icon Node */
.grok-step-icon-wrap {
  position: absolute;
  left: 0;
  top: 1px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  z-index: 2;
  background: var(--term-bg, #0b0f19);
  border-radius: 50%;
}

.grok-step.active .grok-step-icon-wrap {
  color: #38bdf8;
}

.grok-step.error .grok-step-icon-wrap {
  color: #f43f5e;
}

.grok-icon {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
  fill: none;
  stroke: currentColor;
}

/* Step Row Header / Summary */
.grok-step-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  line-height: 1.45;
  color: #94a3b8;
  transition: color 0.15s ease;
  width: 100%;
}

.grok-step-header:hover {
  color: #e2e8f0;
}

.grok-step-title {
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
  font-weight: 400;
  color: #94a3b8;
  word-break: break-word;
}

.grok-step-header:hover .grok-step-title {
  color: #e2e8f0;
}

.grok-step.thought .grok-step-title {
  color: #cbd5e1;
}

.grok-step-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #64748b;
  flex-shrink: 0;
  margin-left: auto;
}

.grok-step-meta.status-running {
  display: inline-flex;
  align-items: center;
}

.grok-step-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.06);
  color: #38bdf8;
  padding: 1px 5px;
  border-radius: 3px;
}

/* Active Pulsing Ring */
.grok-pulse-ring {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #38bdf8;
  display: inline-block;
  animation: grok-ring 1.2s infinite ease-in-out;
}

@keyframes grok-ring {
  0% { transform: scale(0.85); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.85); opacity: 0.6; }
}

/* Expandable Step Details */
.grok-step-detail {
  display: none;
  margin-top: 6px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: #cbd5e1;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow-y: auto;
  animation: fadeIn 0.15s ease;
}

.grok-step.expanded .grok-step-detail {
  display: block;
}

.grok-detail-args {
  color: #94a3b8;
  margin-bottom: 4px;
}

.grok-detail-res {
  color: #34d399;
  font-weight: 500;
}

.grok-detail-res.error {
  color: #f87171;
}

/* Action Container (Staged Email Card, Staged Files) */
.grok-trace-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Legacy Tool Call Fallback (preserves compatibility if called standalone)
   -------------------------------------------------------------------------- */
.cli-tool-call {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--term-surface);
  border: 1px solid var(--term-border);
  border-left: 3px solid var(--cli-cyan);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
}

.cli-tool-call.postgres_db {
  border-left-color: var(--cli-blue);
}

.cli-tool-call.gmail_search {
  border-left-color: var(--cli-red);
}

.cli-tool-call.dispatch_sheet {
  border-left-color: var(--cli-green);
}

.cli-tool-call.google_maps_route {
  border-left-color: var(--cli-yellow);
}

.cli-tool-call.send_email {
  border-left-color: var(--cli-magenta);
}

.cli-tool-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--cli-cyan);
  font-weight: 600;
}

.cli-tool-detail {
  color: var(--term-muted);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 10px;
  border-radius: 4px;
}

.cli-tool-result {
  color: var(--cli-green);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cli-tool-result.error {
  color: var(--cli-red);
}

/* --------------------------------------------------------------------------
   Agent Response Output Box (Decluttered, Modern Typography)
   -------------------------------------------------------------------------- */
.cli-agent-output {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
  margin-top: 2px;
  animation: fadeIn 0.2s ease;
}

.cli-agent-header {
  display: none; /* Removed header clutter; trace and assistant bubble flow naturally */
}

.cli-divider {
  display: none; /* Eliminated harsh ASCII divider lines */
}

.cli-body-markdown {
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 14px;
  line-height: 1.65;
  color: #f1f5f9;
  overflow-x: auto;
}

.cli-body-markdown p {
  margin-top: 0;
  margin-bottom: 0.85em;
}

.cli-body-markdown p:last-child {
  margin-bottom: 0;
}

.cli-body-markdown code {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.cli-footer-info {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 11.5px;
  font-family: var(--font-mono);
  padding-top: 2px;
}

/* Canvas Trigger Pill Button */
.cli-canvas-trigger {
  margin-top: 6px;
}

.btn-canvas-pill {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid var(--cli-cyan);
  color: var(--cli-cyan);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-canvas-pill:hover {
  background: rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}

/* Floating Jump to Latest Button */
.cli-scroll-bottom-btn {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(15, 23, 42, 0.94);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65), 0 0 14px rgba(56, 189, 248, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.cli-scroll-bottom-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.cli-scroll-bottom-btn:hover {
  background: rgba(30, 41, 59, 0.98);
  border-color: #38bdf8;
  color: #7dd3fc;
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.75), 0 0 18px rgba(56, 189, 248, 0.4);
}

.cli-scroll-bottom-btn .btn-arrow {
  font-size: 13px;
  display: inline-block;
  animation: bounceDown 1.5s infinite ease-in-out;
}

@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(2px); }
}

/* --------------------------------------------------------------------------
   Docked Bottom Input Bar
   -------------------------------------------------------------------------- */
.docked-input-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 24px max(14px, env(safe-area-inset-bottom));
  background: var(--term-surface);
  border-top: 1px solid var(--term-border);
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 50;
}

.docked-input-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.docked-input-inner .cli-prompt-label {
  margin-top: 1px;
}

.cli-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--cli-cyan);
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.15s ease;
  user-select: none;
}

.cli-send-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--cli-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  transform: scale(1.05);
}

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

.cli-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  max-height: 380px;
  min-height: 24px;
  overflow-y: auto;
  padding-right: 4px;
}

.cli-textarea::-webkit-scrollbar {
  width: 6px;
}

.cli-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.cli-textarea::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

.cli-textarea::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.cli-textarea::placeholder {
  color: var(--term-dim);
}

/* --------------------------------------------------------------------------
   Right Canvas Pane
   -------------------------------------------------------------------------- */
.canvas-pane {
  flex: 1 1 50%;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #080c14;
  border-left: 1px solid var(--term-border);
  position: relative;
  z-index: 20;
}

.canvas-pane.collapsed {
  display: none !important;
}

.canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--term-surface);
  border-bottom: 1px solid var(--term-border);
  flex-shrink: 0;
}

.canvas-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-icon {
  font-size: 18px;
}

.canvas-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.canvas-type-tag {
  font-size: 10px;
  color: var(--cli-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

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

.canvas-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--term-border);
  border-radius: 4px;
  padding: 2px;
}

.canvas-tab {
  background: transparent;
  border: none;
  color: var(--term-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.canvas-tab.active {
  background: var(--term-surface);
  color: var(--cli-cyan);
}

.cli-btn {
  background: var(--term-card);
  border: 1px solid var(--term-border);
  color: var(--term-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cli-btn:hover {
  background: #1e293b;
  border-color: var(--cli-cyan);
  color: #fff;
}

.cli-btn.close-btn:hover {
  border-color: var(--cli-red);
  color: var(--cli-red);
}

.canvas-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: #080c14;
}

.canvas-body::-webkit-scrollbar {
  width: 8px;
}

.canvas-body::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}

.canvas-view {
  display: none;
}

.canvas-view.active {
  display: block;
}

.canvas-html-frame {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border: none;
  background: #fff;
  border-radius: 6px;
}

/* Markdown Rendering in Canvas */
.markdown-body {
  font-family: var(--font-sans);
  color: #cbd5e1;
  font-size: 13.5px;
  line-height: 1.6;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  color: #fff;
  margin-top: 18px;
  margin-bottom: 10px;
}

.markdown-body h1 {
  font-size: 20px;
  border-bottom: 1px solid var(--term-border);
  padding-bottom: 6px;
}

.markdown-body h2 {
  font-size: 16px;
}

.markdown-body h3 {
  font-size: 14px;
  color: var(--cli-cyan);
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  margin-bottom: 12px;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 20px;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border: 1px solid var(--term-border);
  font-size: 12.5px;
  font-family: var(--font-mono);
}

.markdown-body th {
  background: var(--term-card);
  color: #fff;
  padding: 8px 12px;
  border-bottom: 1px solid var(--term-border);
  text-align: left;
}

.markdown-body td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.markdown-body tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.markdown-body tr:hover {
  background: rgba(56, 189, 248, 0.05);
}

.markdown-body pre {
  background: #050811;
  border: 1px solid var(--term-border);
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  margin: 12px 0;
}

.markdown-body code {
  font-family: var(--font-mono);
  color: var(--cli-cyan);
  font-size: 12px;
}

.source-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #cbd5e1;
  white-space: pre-wrap;
}

/* ── Session History ────────────────────────────────────────────────────── */
.hero-sessions-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.hero-files-btn {
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.hero-files-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #7dd3fc;
}

.sessions-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(6px);
}

.sessions-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.5);
  color: #e2e8f0;
  transform: translateY(-1px);
}

.sessions-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: flex-start;
  align-items: stretch;
}

.sessions-overlay.open {
  display: flex;
}

.sessions-drawer {
  width: min(380px, 85vw);
  height: 100%;
  background: rgba(10, 15, 30, 0.97);
  border-right: 1px solid rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  animation: slideInLeft 0.25s ease-out;
  overflow: hidden;
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.sessions-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
  flex-shrink: 0;
}

.sessions-drawer-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #e2e8f0;
  font-family: var(--font-mono);
}

.sessions-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.sessions-close-btn:hover {
  background: rgba(248, 113, 113, 0.25);
}

.sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.sessions-loading {
  text-align: center;
  color: #64748b;
  padding: 40px 0;
  font-family: var(--font-mono);
  font-size: 13px;
}

.sessions-empty {
  text-align: center;
  color: #475569;
  padding: 40px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

.session-card {
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid rgba(56, 189, 248, 0.08);
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.5);
  cursor: pointer;
  transition: all 0.2s;
}

.session-card:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateX(3px);
}

.session-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-card-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #64748b;
  font-family: var(--font-mono);
}

.session-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.session-card.active {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.06);
}

.session-card.active .session-card-title {
  color: var(--cli-cyan);
}

/* ── Unauthenticated State: Center LS Logo Only ──────────────────────────── */
body.unauthenticated {
  overflow: hidden;
}

body.unauthenticated .terminal-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
}

body.unauthenticated .hero-logo-container {
  margin-bottom: 0;
}

body.unauthenticated .hero-brand-title,
body.unauthenticated .hero-brand-subtitle,
body.unauthenticated .cyber-chips-container,
body.unauthenticated .hero-sessions-row,
body.unauthenticated .hero-input-box,
body.unauthenticated .terminal-topbar,
body.unauthenticated .terminal-stream,
body.unauthenticated .docked-input-bar,
body.unauthenticated .canvas-pane,
body.unauthenticated .resizer,
body.unauthenticated .sessions-overlay {
  display: none !important;
}

/* ==========================================================================
   Mobile & Responsive Enhancements (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Hero Viewport Fit & Bottom Input Anchoring */
  .terminal-hero {
    justify-content: space-between;
    padding: 12px 14px max(14px, env(safe-area-inset-bottom));
    height: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
  }

  .hero-logo-container {
    margin-top: 4px;
    margin-bottom: 10px;
  }

  .hero-logo-glow {
    width: 110px;
    max-width: 38vw;
  }

  .hero-brand-title {
    font-size: 15px;
    letter-spacing: 2px;
    margin-top: 6px;
  }

  .hero-brand-subtitle {
    font-size: 9.5px;
    letter-spacing: 1px;
    margin-top: 2px;
  }

  .cyber-chips-container {
    gap: 4px;
    margin-bottom: 10px;
    padding: 0;
    max-width: 100%;
  }

  .cyber-chip {
    padding: 3px 8px;
    gap: 5px;
    border-radius: 14px;
  }

  .cyber-chip-icon {
    font-size: 11px;
  }

  .cyber-chip-name {
    font-size: 9.5px;
  }

  .hero-sessions-row {
    margin-bottom: 10px;
  }

  .sessions-toggle-btn {
    padding: 6px 14px;
    font-size: 11.5px;
  }

  .hero-input-box {
    margin-top: auto;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
  }

  .hero-input-box .cli-prompt-label {
    font-size: 12px;
  }

  /* Conversation Topbar */
  .terminal-topbar {
    padding: 8px 12px;
    max-width: 100vw;
    overflow: hidden;
  }

  .topbar-left {
    gap: 8px;
  }

  .topbar-logo {
    width: 24px;
  }

  .topbar-title {
    font-size: 12px;
    letter-spacing: 1px;
  }

  .topbar-badge {
    display: none;
  }

  .topbar-chips {
    gap: 4px;
  }

  .topbar-chip-status {
    display: none;
  }

  .topbar-scratchpad-btn {
    padding: 3px 7px;
    font-size: 10.5px;
    gap: 3px;
    border-radius: 12px;
  }

  .topbar-scratchpad-btn .btn-label {
    display: none;
  }

  /* Stream & Messages */
  .terminal-stream {
    padding: 12px 12px 8px;
    gap: 12px;
    font-size: 12.5px;
  }

  .cli-user-row {
    font-size: 12.5px;
    gap: 6px;
  }

  .cli-prompt-label {
    font-size: 12px;
  }

  .grok-trace-header {
    padding: 8px 4px;
    min-height: 40px;
  }

  .grok-step {
    padding-left: 26px;
    padding-bottom: 10px;
  }

  .grok-step-header {
    font-size: 12.5px;
  }

  .grok-step-detail {
    font-size: 11px;
    padding: 6px 10px;
  }

  .cli-thought {
    padding: 6px 10px;
    font-size: 11.5px;
  }

  .cli-thought-summary {
    font-size: 11.5px;
  }

  .cli-thought-preview {
    font-size: 11px;
  }

  .cli-thought-body {
    max-height: 220px;
    font-size: 11.5px;
  }

  .cli-processing-bar {
    padding: 6px 10px;
    font-size: 11.5px;
  }

  .cli-tool-call {
    padding: 6px 10px;
    font-size: 11.5px;
  }

  .cli-tool-detail {
    font-size: 11px;
    padding: 4px 8px;
  }

  .cli-agent-output {
    font-size: 12.5px;
  }

  .cli-body-markdown {
    font-size: 13.5px;
  }

  .markdown-body table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 11px;
  }

  .markdown-body pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
  }

  .cli-scroll-bottom-btn {
    bottom: 64px;
    font-size: 11px;
    padding: 5px 12px;
  }

  /* Docked Input Bar on Mobile */
  .docked-input-bar {
    padding: 8px 10px max(12px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  .cli-textarea {
    font-size: 16px; /* 16px is required by iOS Safari / Chrome to prevent auto-zooming on focus */
  }

  .cli-send-btn {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  /* Full Screen Canvas Drawer on Mobile */
  .canvas-pane {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100%;
    height: 100dvh;
    min-width: 0;
    z-index: 1000;
    border-left: none;
  }

  .resizer {
    display: none !important;
  }

  .canvas-header {
    padding: 8px 12px;
  }

  .canvas-title {
    font-size: 12.5px;
  }

  .canvas-body {
    padding: 12px;
  }

  .cli-attach-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .cli-file-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .file-card-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .cli-email-card {
    padding: 10px 12px;
  }

  .email-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .email-card-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-email-action {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   Workspace & File Attachment Elements
   -------------------------------------------------------------------------- */
.hero-input-wrapper,
.docked-input-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-input-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

.cli-attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.15s ease;
  user-select: none;
}

.cli-attach-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--cli-cyan);
  color: var(--cli-cyan);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
  transform: scale(1.05);
}

.attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 4px;
}

.attachment-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.attachment-tag .att-icon {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
}

.attachment-tag .att-thumb {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  flex-shrink: 0;
  background: #0f172a;
  display: block;
}

.attachment-tag.has-thumb {
  padding: 3px 8px 3px 4px;
}

.attachment-tag:hover {
  border-color: var(--cli-cyan);
  background: rgba(15, 23, 42, 0.95);
}

.attachment-tag .att-name {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #38bdf8;
}

.attachment-tag .att-size {
  font-size: 10.5px;
  color: #64748b;
}

.attachment-tag .att-workspace-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 2px;
  white-space: nowrap;
}

.attachment-tag .att-remove {
  cursor: pointer;
  color: #94a3b8;
  margin-left: 4px;
  font-weight: bold;
  font-size: 13px;
  line-height: 1;
  transition: color 0.15s, transform 0.15s;
}

.attachment-tag .att-remove:hover {
  color: #f87171;
  transform: scale(1.15);
}

.attachment-tag.uploading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--cli-cyan);
  animation: attProgress 1.2s infinite ease-in-out;
  width: 100%;
}

@keyframes attProgress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Drag & Drop Full Viewport Overlay */
.drag-drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.88);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drop-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 60px;
  border: 2px dashed var(--cli-cyan);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.35);
  text-align: center;
  gap: 12px;
}

.drop-icon {
  font-size: 48px;
}

.drop-title {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--cli-cyan);
  letter-spacing: 1.5px;
}

.drop-sub {
  font-size: 13px;
  color: #94a3b8;
  max-width: 320px;
}

/* File Card in Chat Messages */
.cli-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0;
  gap: 12px;
  font-family: var(--font-mono);
  transition: all 0.2s ease;
}

.cli-file-card:hover {
  border-color: var(--cli-cyan);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.18);
}

.file-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.file-card-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.file-card-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.file-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #38bdf8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card-meta {
  font-size: 11px;
  color: #64748b;
}

.file-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.file-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.file-card-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--cli-cyan);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

/* --------------------------------------------------------------------------
   Interactive Human-in-the-Loop Email Approval Card
   -------------------------------------------------------------------------- */
.cli-email-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(236, 72, 153, 0.4);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  font-family: var(--font-mono);
  position: relative;
  overflow: hidden;
}

.cli-email-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--cli-magenta);
}

.email-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.email-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cli-magenta);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.email-card-icon {
  font-size: 16px;
}

.email-status-badge {
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.email-status-badge.status-pending {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.email-status-badge.status-sent {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.6);
  color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.email-status-badge.status-discarded {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
}

.email-meta-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: rgba(0, 0, 0, 0.35);
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.email-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}

.email-meta-label {
  color: var(--term-muted);
  font-weight: 600;
  min-width: 55px;
  flex-shrink: 0;
}

.email-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.email-pill {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  word-break: break-all;
}

.email-pill.from {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.email-pill.to {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.email-pill.cc,
.email-pill.bcc {
  background: rgba(100, 116, 139, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(100, 116, 139, 0.35);
}

.email-subject-text {
  color: #f8fafc;
  font-weight: 600;
  font-size: 13px;
  word-break: break-word;
}

.email-attachments-row {
  align-items: center;
}

.email-attachment-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.email-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.3);
  color: #facc15;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.email-preview-collapsible {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
}

.email-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(30, 41, 59, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-email-preview-toggle {
  background: none;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  font-family: inherit;
}

.btn-email-preview-toggle:hover {
  color: #ffffff;
}

.toggle-icon {
  font-size: 9px;
  color: var(--cli-cyan);
}

.btn-email-canvas-open {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.btn-email-canvas-open:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--cli-cyan);
}

.email-preview-content {
  max-height: 380px;
  transition: max-height 0.25s ease-in-out;
  overflow: hidden;
}

.email-preview-content.collapsed {
  max-height: 0;
}

.email-preview-frame {
  width: 100%;
  height: 300px;
  border: none;
  background: #ffffff;
  display: block;
}

.email-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.btn-email-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
  min-height: 38px;
}

.btn-email-action.send {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  border: 1px solid #34d399;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.btn-email-action.send:hover:not(:disabled) {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

.btn-email-action.send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-email-action.gmail {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.btn-email-action.gmail:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.btn-email-action.discard {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-email-action.discard:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

.email-success-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.5);
  border-radius: 6px;
  padding: 10px 14px;
  color: #34d399;
  width: 100%;
}

.email-success-banner .success-icon {
  font-size: 20px;
}

.email-success-banner .success-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.email-success-banner .message-id-tag {
  font-size: 11px;
  color: #a7f3d0;
  opacity: 0.8;
}

.email-discarded-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 6px;
  padding: 10px 14px;
  color: #fca5a5;
  font-size: 12px;
  width: 100%;
}

.email-card-status-message {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  margin-top: 4px;
}

.email-card-status-message.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

/* ==========================================================================
   Email Triage Panel
   ========================================================================== */

.triage-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.triage-overlay.active {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.triage-panel {
  width: 100%;
  max-width: 820px;
  background: var(--term-surface);
  border-left: 1px solid var(--term-border);
  border-right: 1px solid var(--term-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.triage-view {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.triage-view.active {
  display: flex;
}

/* Header */
.triage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--term-border);
  background: var(--term-bg);
  flex-shrink: 0;
}

.triage-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.triage-header-icon {
  font-size: 1.4em;
}

.triage-header h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--term-text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.triage-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.triage-close-btn {
  background: none;
  border: none;
  color: var(--term-dim);
  font-size: 1.5em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.triage-close-btn:hover {
  color: var(--cli-red);
  background: rgba(248, 113, 113, 0.1);
}

.triage-refresh-btn {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--cli-cyan);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.triage-refresh-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--cli-cyan);
}

.triage-refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.triage-back-btn {
  background: none;
  border: none;
  color: var(--cli-cyan);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.triage-back-btn:hover {
  background: rgba(56, 189, 248, 0.1);
}

.triage-ask-cyborg-btn {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--cli-cyan);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.triage-ask-cyborg-btn:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(139, 92, 246, 0.25));
  border-color: var(--cli-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

/* Meta line */
.triage-meta {
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--term-dim);
  border-bottom: 1px solid var(--term-border);
  flex-shrink: 0;
}

/* ── Category Tiles Grid ── */
.triage-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.triage-tile {
  background: var(--term-card);
  border: 1px solid var(--term-border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.triage-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--tile-color, var(--cli-cyan));
  border-radius: 12px 12px 0 0;
}

.triage-tile:hover {
  border-color: var(--tile-color, var(--cli-cyan));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 20px color-mix(in srgb, var(--tile-color, var(--cli-cyan)) 15%, transparent);
}

.triage-tile-icon {
  font-size: 1.8em;
  margin-bottom: 10px;
}

.triage-tile-name {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--term-text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.triage-tile-count {
  font-family: var(--font-mono);
  font-size: 1.8em;
  font-weight: 700;
  color: var(--tile-color, var(--cli-cyan));
  line-height: 1;
}

.triage-tile-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: var(--term-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Email List ── */
.triage-email-list {
  overflow-y: auto;
  flex: 1;
}

.triage-email-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--term-border);
  cursor: pointer;
  transition: background 0.15s;
}

.triage-email-row:hover {
  background: rgba(56, 189, 248, 0.04);
}

.triage-email-row.unread {
  background: rgba(56, 189, 248, 0.06);
}

.triage-email-row.unread .triage-email-subject {
  font-weight: 700;
}

.triage-email-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--term-card);
  border: 1px solid var(--term-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cli-cyan);
  flex-shrink: 0;
  text-transform: uppercase;
}

.triage-email-body {
  flex: 1;
  min-width: 0;
}

.triage-email-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.triage-email-sender {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--term-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.triage-email-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--term-dim);
  flex-shrink: 0;
  margin-left: 10px;
}

.triage-email-subject {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--term-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.triage-email-snippet {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--term-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.triage-email-badges {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.triage-attachment-badge {
  font-size: 0.7rem;
  color: var(--term-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ── Thread View ── */
.triage-thread-content {
  overflow-y: auto;
  flex: 1;
  padding: 0;
}

.triage-thread-message {
  padding: 20px;
  border-bottom: 1px solid var(--term-border);
}

.triage-thread-message:last-child {
  border-bottom: none;
}

.triage-msg-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.triage-msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--term-card);
  border: 1px solid var(--term-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cli-cyan);
  flex-shrink: 0;
  text-transform: uppercase;
}

.triage-msg-meta {
  flex: 1;
  min-width: 0;
}

.triage-msg-from {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--term-text);
}

.triage-msg-to {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--term-dim);
  margin-top: 2px;
}

.triage-msg-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--term-dim);
  flex-shrink: 0;
}

.triage-msg-body {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--term-text);
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.triage-msg-attachments {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.triage-msg-attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--term-card);
  border: 1px solid var(--term-border);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--cli-cyan);
  cursor: default;
}

/* ── Loading Skeleton ── */
.triage-skeleton-tile {
  background: var(--term-card);
  border: 1px solid var(--term-border);
  border-radius: 12px;
  padding: 20px;
  animation: pulse 1.5s ease-in-out infinite;
}

.triage-skeleton-line {
  height: 14px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  margin-bottom: 10px;
}

.triage-skeleton-line.short { width: 60%; }
.triage-skeleton-line.long { width: 90%; }
.triage-skeleton-line.number {
  height: 32px;
  width: 40%;
  margin-top: 12px;
}

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

/* ── Triage button active state ── */
.topbar-triage-btn.active {
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: var(--cli-cyan) !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

/* ── Loading overlay ── */
.triage-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--term-dim);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.triage-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--cli-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
  .triage-panel {
    max-width: 100%;
  }

  .triage-tiles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 14px;
  }

  .triage-tile {
    padding: 14px;
  }

  .triage-tile-count {
    font-size: 1.4em;
  }

  .triage-header {
    padding: 12px 14px;
  }

  .triage-email-row {
    padding: 12px 14px;
  }

  .triage-thread-message {
    padding: 14px;
  }

  .triage-header-actions .triage-ask-cyborg-btn .btn-label-text {
    display: none;
  }
}

/* ── Empty state ── */
.triage-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--term-dim);
  font-family: var(--font-sans);
}

.triage-empty-icon {
  font-size: 3em;
  margin-bottom: 16px;
  opacity: 0.5;
}

.triage-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--term-muted);
  margin-bottom: 8px;
}

.triage-empty-desc {
  font-size: 0.82rem;
  max-width: 360px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ==========================================================================
   CYBORG OPERATIONAL INBOX & WORKSTATION (GMAIL FIDELITY)
   ========================================================================== */

/* ── Global App Topbar ── */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  min-height: 56px;
  padding: 0 16px;
  background: #0f1523;
  border-bottom: 1px solid #1e293b;
  position: relative;
  z-index: 50;
  gap: 16px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand-text-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #38bdf8;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

/* Center Search Bar */
.topbar-search-wrapper {
  flex: 1;
  max-width: 680px;
}

.search-input-box {
  display: flex;
  align-items: center;
  background: #182235;
  border: 1px solid #283548;
  border-radius: 8px;
  padding: 6px 12px;
  gap: 8px;
  transition: all 0.2s ease;
}

.search-input-box:focus-within {
  background: #1b263b;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.search-icon {
  font-size: 0.85rem;
  opacity: 0.7;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
}

.search-input::placeholder {
  color: #64748b;
}

.search-clear-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
}

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

.topbar-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #131b2e;
  border: 1px solid #1e293b;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar-action-btn:hover {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

.topbar-action-btn .btn-icon.spinning {
  animation: spin 1s linear infinite;
}

.google-auth-btn.connected {
  border-color: rgba(74, 222, 128, 0.3);
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

.view-switch-btn {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.view-switch-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #bae6fd;
}

/* ── App Container ── */
.app-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  width: 100%;
  overflow: hidden;
  position: relative;
  background: #090d16;
}

/* ── View 1: Inbox View ── */
.inbox-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #0c111d;
}

.inbox-toolbar-panel {
  display: flex;
  flex-direction: column;
  padding: 10px 16px 8px 16px;
  background: #0f1523;
  border-bottom: 1px solid #1e293b;
  gap: 10px;
}

.inbox-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inbox-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px 4px 0 0;
}

.inbox-tab:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.04);
}

.inbox-tab.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.inbox-tab .tab-badge {
  background: #38bdf8;
  color: #090d16;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.inbox-category-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.category-pill {
  background: #131b2e;
  border: 1px solid #1e293b;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.category-pill:hover {
  background: #1e293b;
  color: #e2e8f0;
}

.category-pill.active {
  background: #38bdf8;
  color: #090d16;
  border-color: #38bdf8;
  font-weight: 600;
}

/* Action Subbar */
.inbox-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: #0f1523;
  border-bottom: 1px solid #1e293b;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: #94a3b8;
}

.subbar-left,
.subbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inbox-checkbox-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.inbox-checkbox-label input {
  cursor: pointer;
  accent-color: #38bdf8;
  width: 15px;
  height: 15px;
}

.subbar-icon-btn,
.page-nav-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.subbar-icon-btn:hover,
.page-nav-btn:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.page-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── High Density Email List Rows (Gmail Parity) ── */
.inbox-list-container {
  flex: 1;
  overflow-y: auto;
  background: #0c111d;
}

.inbox-rows-table {
  display: flex;
  flex-direction: column;
}

.inbox-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid #182235;
  background: #0d1322;
  cursor: pointer;
  transition: background 0.1s ease;
  font-family: var(--font-sans);
  position: relative;
  gap: 12px;
}

.inbox-row:hover {
  background: #131b2e;
}

.inbox-row.unread {
  background: #101728;
}

.inbox-row.unread .row-subject {
  font-weight: 700;
  color: #f8fafc;
}

.inbox-row.unread .row-senders-text {
  font-weight: 700;
  color: #f8fafc;
}

.row-select {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.row-select input[type="checkbox"] {
  accent-color: #38bdf8;
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.star-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  transition: color 0.15s ease;
}

.star-btn:hover {
  color: #facc15;
}

.star-btn.starred {
  color: #facc15;
}

/* Senders Column */
.row-senders {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  color: #cbd5e1;
  flex-shrink: 0;
}

.row-senders-count {
  font-size: 0.78rem;
  color: #64748b;
  margin-left: 4px;
  font-weight: 400;
}

/* Cyborg Pill Badge (from user screenshot) */
.row-badge-cyborg {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* Category Badge */
.row-badge-cat {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

.row-badge-cat.po {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.25);
}

.row-badge-cat.rfq {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.25);
}

.row-badge-cat.shipping {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.row-badge-cat.vendor {
  background: rgba(232, 121, 249, 0.15);
  color: #e879f9;
  border: 1px solid rgba(232, 121, 249, 0.25);
}

/* Content (Subject + Snippet) */
.row-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  font-size: 0.88rem;
}

.row-subject {
  color: #e2e8f0;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-dash {
  color: #475569;
  flex-shrink: 0;
}

.row-snippet {
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Attachments Chips Column */
.row-attachments {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  background: #182235;
  border: 1px solid #283548;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.att-chip:hover {
  background: #233149;
  border-color: #38bdf8;
  color: #38bdf8;
  transform: translateY(-1px);
}

.att-chip.pdf {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.att-chip.pdf:hover {
  border-color: #ef4444;
  color: #fee2e2;
}

.att-chip.excel {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
}

.att-chip.image {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
  color: #fde68a;
}

.att-chip-icon {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.att-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.att-chip-more {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: #182235;
  color: #94a3b8;
  border: 1px solid #283548;
}

/* Date Column */
.row-date {
  font-size: 0.78rem;
  color: #64748b;
  flex-shrink: 0;
  text-align: right;
  min-width: 75px;
}

/* Row Hover Action Buttons */
.row-actions {
  display: none;
  align-items: center;
  gap: 6px;
  position: absolute;
  right: 16px;
  background: #131b2e;
  padding: 0 4px;
}

.inbox-row:hover .row-actions {
  display: flex;
}

.row-action-btn {
  background: #182235;
  border: 1px solid #283548;
  color: #94a3b8;
  font-size: 0.85rem;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.row-action-btn:hover {
  background: #233149;
  color: #e2e8f0;
}

/* Loading & Empty States */
.inbox-loading-state,
.inbox-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #64748b;
  gap: 12px;
  font-family: var(--font-sans);
}

.inbox-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(56, 189, 248, 0.15);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ══════════════════════════════════════════════════════════════════════
   VIEW 2: DEDICATED CLEAN EMAIL THREAD VIEWER (AUTHENTIC GMAIL INTERFACE)
   ══════════════════════════════════════════════════════════════════════ */
body.view-workstation,
body.view-workstation .app-container {
  background: #ffffff !important;
}

.workstation-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: #ffffff;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.thread-viewport {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 100% !important;
  margin: 0 !important;
  overflow: hidden;
  background: #ffffff;
  border: none !important;
  border-radius: 0 !important;
  position: relative;
}

/* ── Thread Top Header (Gmail Style) ── */
.thread-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  gap: 16px;
  z-index: 5;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.nav-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 6px;
  color: #3c4043;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.nav-back-btn:hover {
  background: #f1f3f4;
  color: #202124;
  border-color: #bdc1c6;
}

.thread-header-meta {
  min-width: 0;
  flex: 1;
}

.thread-header-subject {
  font-family: Roboto, 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 1.35rem;
  font-weight: 500;
  color: #202124;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.thread-tags-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.thread-category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #e8f0fe;
  color: #1967d2;
  border: 1px solid #d2e3fc;
}

.thread-message-count-badge {
  font-size: 0.75rem;
  color: #5f6368;
  font-weight: 500;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 6px;
  color: #5f6368;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-action-btn:hover {
  background: #f1f3f4;
  color: #202124;
  border-color: #bdc1c6;
}

.star-toggle-btn {
  font-size: 1.15rem;
  padding: 3px 8px;
  color: #5f6368;
  line-height: 1;
}

.star-toggle-btn.active,
.star-toggle-btn:hover {
  color: #f29900;
}

/* ── Unified Scrollable Thread Body (Pre-Flight Card + Message Stream) ── */
.thread-body-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  width: 100%;
  box-sizing: border-box;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #dadce0 transparent;
}

.thread-body-scroll::-webkit-scrollbar {
  width: 8px;
}

.thread-body-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.thread-body-scroll::-webkit-scrollbar-thumb {
  background: #dadce0;
  border-radius: 4px;
}

.thread-body-scroll::-webkit-scrollbar-thumb:hover {
  background: #bdc1c6;
}

/* ── Full Width Thread Messages Stream ── */
.thread-messages-stream {
  flex: 1;
  overflow: visible !important;
  padding: 0 28px 24px 28px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  box-sizing: border-box;
  width: 100%;
}

/* ── Gmail Message Card (Flat Stacking, No Border Box!) ── */
.clean-message-card {
  background: #ffffff !important;
  border: none !important;
  border-bottom: 1px solid #e0e0e0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  width: 100%;
  margin: 0;
  padding: 14px 0 18px 0;
  box-sizing: border-box;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  transition: background 0.12s ease;
}

.clean-message-card:last-child {
  border-bottom: none !important;
}

/* Expanded Header Row */
.msg-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 2px 0 4px 0;
  background: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
  gap: 12px;
}

.msg-header-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.msg-sender-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.05rem;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  letter-spacing: normal;
}

.msg-sender-info {
  min-width: 0;
  flex: 1;
}

.msg-sender-name-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.msg-sender-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #202124;
}

.msg-sender-email {
  font-size: 0.8rem;
  color: #5f6368;
}

.msg-to-line {
  font-size: 0.78rem;
  color: #5f6368;
  margin-top: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-radius: 3px;
  padding: 1px 4px;
  transition: background 0.12s ease;
}

.msg-to-line:hover {
  background: #f1f3f4;
  color: #202124;
}

.msg-to-dropdown {
  display: none;
  margin-top: 6px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 0.8rem;
  color: #3c4043;
  line-height: 1.6;
  max-width: 480px;
}

.msg-to-dropdown.open {
  display: block;
}

.msg-to-dropdown div {
  margin-bottom: 2px;
}

.msg-to-dropdown strong {
  color: #5f6368;
  font-weight: 500;
  width: 60px;
  display: inline-block;
}

.msg-snippet-preview {
  display: none;
}

.msg-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.msg-date-stamp {
  font-size: 0.8rem;
  color: #5f6368;
  white-space: nowrap;
}

.msg-collapse-chevron {
  color: #5f6368;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  background: transparent;
  border: none;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.msg-collapse-chevron:hover {
  background: #f1f3f4;
  color: #202124;
}

/* ── Gmail Collapsed 1-Line Preview Row (Image 3) ── */
.clean-message-card.collapsed {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
}

.clean-message-card.collapsed:hover {
  background: #f8f9fa !important;
}

.clean-message-card.collapsed .msg-card-header {
  align-items: center;
  padding: 0;
}

.clean-message-card.collapsed .msg-sender-avatar {
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
}

.clean-message-card.collapsed .msg-header-left {
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.clean-message-card.collapsed .msg-sender-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.clean-message-card.collapsed .msg-sender-name-row {
  flex-shrink: 0;
}

.clean-message-card.collapsed .msg-sender-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #202124;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 4px;
}

.clean-message-card.collapsed .msg-sender-email {
  display: none;
}

.clean-message-card.collapsed .msg-to-line {
  display: none;
}

.clean-message-card.collapsed .msg-to-dropdown {
  display: none !important;
}

.clean-message-card.collapsed .msg-snippet-preview {
  display: block;
  font-size: 0.85rem;
  color: #5f6368;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  margin: 0;
}

.clean-message-card.collapsed .msg-collapse-chevron {
  display: none;
}

.clean-message-card.collapsed .msg-body-host,
.clean-message-card.collapsed .msg-clean-body,
.clean-message-card.collapsed .msg-attachments-section,
.clean-message-card.collapsed .msg-quoted-wrapper {
  display: none !important;
}

/* ── Message Body Host (Aligned Under Sender Text) ── */
.msg-body-host,
.msg-clean-body {
  padding: 10px 0 16px 52px;
  color: #202124;
  font-size: 0.92rem;
  line-height: 1.55;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  word-break: break-word;
  box-sizing: border-box;
}

.msg-clean-body p {
  margin: 0 0 12px 0;
}

.msg-clean-body p:last-child {
  margin-bottom: 0;
}

/* ── Collapsible Quoted History (Gmail ...) ── */
.msg-quoted-wrapper {
  margin: 0 0 12px 52px;
}

.btn-toggle-quoted {
  background: #f1f3f4;
  border: 1px solid #dadce0;
  color: #5f6368;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.btn-toggle-quoted:hover {
  background: #e8eaed;
  color: #202124;
}

.msg-quoted-content {
  display: none;
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 2px solid #dadce0;
  color: #5f6368;
  font-size: 0.84rem;
  line-height: 1.5;
  background: #f8f9fa;
  border-radius: 0 4px 4px 0;
  white-space: pre-wrap;
}

.msg-quoted-content.open {
  display: block;
}

/* ── Gmail Attachments Block (Indented 52px, Image 2) ── */
.msg-attachments-section {
  padding: 10px 0 16px 52px;
  border-top: none;
  background: transparent;
  box-sizing: border-box;
}

.msg-attachments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.84rem;
  color: #5f6368;
}

.att-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #3c4043;
}

.att-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.att-header-btn {
  background: none;
  border: none;
  color: #5f6368;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.att-header-btn:hover {
  background: #f1f3f4;
  color: #202124;
}

.msg-attachments-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.msg-attachment-card {
  width: 190px;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
  transition: all 0.2s ease;
  position: relative;
  text-decoration: none;
}

.msg-attachment-card:hover {
  border-color: #bdc1c6;
  box-shadow: 0 1px 4px 1px rgba(60, 64, 67, 0.18);
}

.msg-att-thumb {
  width: 100%;
  height: 95px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  user-select: none;
}

.msg-att-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* PDF Card Preview - Matching Image 2 with red ribbon */
.pdf-card-preview {
  position: relative;
  width: 52px;
  height: 64px;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
  box-sizing: border-box;
}

.pdf-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  background: #ea4335;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 0 4px 0 4px;
  letter-spacing: 0.04em;
  line-height: 1;
}

.doc-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.doc-line {
  height: 2px;
  background: #dadce0;
  border-radius: 1px;
}

.doc-line.l1 { width: 100%; }
.doc-line.l2 { width: 80%; }
.doc-line.l3 { width: 55%; }

/* Excel Card Preview */
.excel-thumb {
  background: #f1f8f5;
}

.excel-card-preview {
  position: relative;
  width: 52px;
  height: 64px;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
  box-sizing: border-box;
}

.excel-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  background: #1e8e3e;
  color: #ffffff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 0 4px 0 4px;
  letter-spacing: 0.04em;
  line-height: 1;
}

/* Generic / Other Thumbnail */
.generic-thumb {
  background: #f8f9fa;
}

.generic-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 1.5rem;
  color: #5f6368;
}

.generic-badge .ext-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: #5f6368;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Card Footer */
.att-card-footer {
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-top: 1px solid #f1f3f4;
  min-width: 0;
  height: 44px;
  box-sizing: border-box;
}

.att-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 6px;
}

.att-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.att-meta .att-filename {
  font-size: 0.8rem;
  font-weight: 500;
  color: #3c4043;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.att-meta .att-filesize {
  font-size: 0.7rem;
  color: #5f6368;
  margin-top: 2px;
}

.att-download-action {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  color: #5f6368;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: all 0.15s ease;
  margin-left: 6px;
}

.att-download-action:hover {
  background: #f1f3f4;
  color: #202124;
}

/* ── Clean Gmail-Style Reply Section ── */
.thread-reply-section {
  padding: 16px 28px 24px 28px;
  background: #ffffff;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
  box-sizing: border-box;
}

.reply-card {
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reply-card:focus-within {
  border-color: #1a73e8;
  box-shadow: 0 1px 3px 1px rgba(26, 115, 232, 0.2);
}

.reply-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #5f6368;
}

.reply-label {
  font-weight: 500;
  color: #3c4043;
}

.reply-textarea {
  width: 100%;
  min-height: 70px;
  max-height: 220px;
  background: #ffffff;
  border: none;
  outline: none;
  padding: 0;
  color: #202124;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.55;
  resize: vertical;
  box-sizing: border-box;
}

.reply-textarea::placeholder {
  color: #80868b;
}

.reply-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-discard-reply {
  background: transparent;
  border: none;
  color: #5f6368;
  font-family: inherit;
  font-size: 0.84rem;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-discard-reply:hover {
  color: #ea4335;
  background: #fce8e6;
}

.btn-send-reply {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1a73e8;
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 8px 24px;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3);
}

.btn-send-reply:hover {
  background: #1557b0;
  box-shadow: 0 1px 3px 1px rgba(60, 64, 67, 0.35);
}

.btn-send-reply:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Lightbox Attachment Modal ── */
.attachment-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 101;
  width: 90vw;
  max-width: 960px;
  height: 85vh;
  background: #0f1523;
  border: 1px solid #1e293b;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #1e293b;
  background: #131b2e;
}

.modal-header h3 {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: #f1f5f9;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-btn-download {
  background: #38bdf8;
  color: #090d16;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 5px;
  text-decoration: none;
  cursor: pointer;
}

.modal-btn-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.modal-btn-close:hover {
  color: #f8fafc;
}

.modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #090d16;
}

.modal-body iframe,
.modal-body img {
  width: 100%;
  height: 100%;
  border: none;
  object-fit: contain;
}

/* ── Mobile Layout Adjustments ── */
@media (max-width: 768px) {
  .thread-viewport {
    max-width: 100% !important;
    border: none !important;
  }

  .thread-nav-header {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .thread-header-subject {
    font-size: 1.05rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .thread-attachments-strip {
    padding: 8px 12px;
  }

  .thread-messages-stream {
    padding: 0 12px 18px 12px !important;
    gap: 0 !important;
  }

  .clean-message-card {
    padding: 12px 0 14px 0 !important;
  }

  .msg-card-header {
    padding: 2px 0 4px 0;
  }

  .msg-sender-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
  }

  .msg-clean-body,
  .msg-body-host,
  .msg-attachments-section,
  .msg-quoted-wrapper {
    padding-left: 0 !important;
  }

  .clean-message-card.collapsed {
    padding: 8px 6px !important;
  }

  .clean-message-card.collapsed .msg-sender-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .clean-message-card.collapsed .msg-snippet-preview {
    font-size: 0.82rem;
  }

  .msg-attachment-card {
    width: calc(100% - 4px);
    max-width: 280px;
  }

  .thread-reply-section {
    padding: 12px 12px 18px 12px;
  }

  .row-senders {
    width: 110px;
    min-width: 110px;
  }

  .row-subject {
    max-width: 55%;
  }
}

@media (max-width: 480px) {
  .thread-nav-header {
    padding: 8px 10px;
  }

  .nav-action-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .msg-attachment-card {
    width: 100%;
    max-width: 100%;
  }

  .msg-sender-name {
    font-size: 0.88rem;
  }

  .msg-date-stamp {
    font-size: 0.72rem;
  }
}

/* ══════════════════════════════════════════════════════════════════════ */
/* CYBORG RFQ PRE-FLIGHT & ESTIMATE CARD                                  */
/* ══════════════════════════════════════════════════════════════════════ */
.rfq-preflight-container {
  margin: 16px 28px 8px 28px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0284c7;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  font-family: inherit;
  animation: fadeInPreflight 0.25s ease-out;
  flex-shrink: 0;
  transition: padding 0.2s ease;
}

.rfq-preflight-container.inline-preflight-container {
  margin: 14px 0 16px 0;
  width: 100%;
  box-sizing: border-box;
}

/* ── Inline Collapsed Milestone Pill for Earlier Runs ── */
.preflight-inline-pill-wrapper {
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0 14px 0;
}

.preflight-inline-pill {
  width: 100%;
  box-sizing: border-box;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #6366f1;
  border-radius: 6px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.preflight-inline-pill:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.preflight-inline-pill.is-open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
  background: #eef2ff;
}

.preflight-inline-pill .pill-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preflight-inline-pill .pill-badge {
  font-size: 0.68rem;
  background: #e0e7ff;
  color: #3730a3;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.preflight-inline-pill .pill-run {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e293b;
}

.preflight-inline-pill .pill-meta {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 500;
}

.preflight-inline-pill .pill-toggle {
  font-size: 0.76rem;
  color: #4338ca;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.preflight-inline-expanded {
  margin-bottom: 12px;
  animation: fadeInPreflight 0.2s ease-out;
}

.btn-toggle-preflight-card {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-toggle-preflight-card:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.rfq-preflight-container.card-collapsed {
  padding: 10px 18px;
  margin-bottom: 6px;
}

.rfq-preflight-container.card-collapsed .preflight-header {
  margin-bottom: 0;
}

.rfq-preflight-container.card-collapsed .preflight-collapsible-body {
  display: none !important;
}

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

.preflight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.preflight-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preflight-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
}

.preflight-meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.84rem;
  color: #64748b;
  flex-wrap: wrap;
}

.preflight-meta-item strong {
  color: #1e293b;
  font-weight: 600;
}

.preflight-subtotal-badge {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

/* ── Pre-flight Execution Trace & Reasoning (Cyborg Grok Style) ── */
.preflight-trace-wrapper,
.preflight-active-trace {
  margin: 6px 0 10px 0;
  width: 100%;
}

.rfq-preflight-container .grok-trace {
  margin: 0;
  width: 100%;
}

.rfq-preflight-container .grok-trace-header {
  padding: 5px 10px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.rfq-preflight-container .grok-trace-header:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.rfq-preflight-container .grok-trace-time {
  color: #475569;
  font-weight: 600;
}

.rfq-preflight-container .grok-trace-sub {
  color: #64748b;
}

.rfq-preflight-container .grok-timeline {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 6px;
  margin-top: 6px;
  margin-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.rfq-preflight-container .grok-timeline::-webkit-scrollbar {
  width: 5px;
}

.rfq-preflight-container .grok-timeline::-webkit-scrollbar-track {
  background: transparent;
}

.rfq-preflight-container .grok-timeline::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.rfq-preflight-container .grok-step-icon-wrap {
  background: #f8fafc;
  color: #64748b;
}

.rfq-preflight-container .grok-step.active .grok-step-icon-wrap {
  color: #0284c7;
}

.rfq-preflight-container .grok-step.error .grok-step-icon-wrap {
  color: #e11d48;
}

.rfq-preflight-container .grok-step::before {
  background: #cbd5e1;
}

.rfq-preflight-container .grok-step-title {
  color: #334155;
  font-size: 13px;
  line-height: 1.4;
}

.rfq-preflight-container .grok-step-header:hover .grok-step-title {
  color: #0f172a;
}

.rfq-preflight-container .grok-step.thought .grok-step-title {
  color: #475569;
  font-weight: 500;
}

.rfq-preflight-container .grok-pulse-ring {
  border-color: #0284c7;
}

.rfq-preflight-container .grok-step-detail {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  max-height: 180px;
}

.rfq-preflight-container .grok-detail-args {
  color: #334155;
}

.rfq-preflight-container .grok-detail-res {
  color: #0284c7;
  font-weight: 600;
}

.rfq-preflight-container .grok-detail-res.error {
  color: #e11d48;
}

/* ── Customer Follow-up Question & Stock Check Banner ── */
.preflight-inquiry-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-left: 4px solid #0284c7;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 10px 0 12px 0;
  font-size: 0.84rem;
}

.inquiry-q-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}

.inquiry-q-title {
  font-weight: 700;
  color: #0369a1;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.inquiry-q-text {
  color: #0f172a;
  font-style: italic;
  font-weight: 600;
}

.inquiry-ans-row {
  color: #334155;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Preflight Items Table ── */
.preflight-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 360px;
  margin: 12px 0;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.preflight-table-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.preflight-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.preflight-table-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.preflight-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}


.preflight-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.preflight-table th {
  background: #f8fafc;
  padding: 8px 12px;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}

.preflight-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.preflight-table tr:last-child td {
  border-bottom: none;
}

.preflight-table tr:hover {
  background: #f8fafc;
}

.sku-pill {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  margin-top: 2px;
}

.stock-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  white-space: nowrap;
}

.stock-tag.in-stock {
  background: #dcfce7;
  color: #15803d;
}

.stock-tag.partial-stock {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.stock-tag.powder-coat {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.stock-tag.inbound {
  background: #fef3c7;
  color: #b45309;
}

.stock-tag.out-stock {
  background: #fee2e2;
  color: #b91c1c;
}

.bundle-advisory {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
}

/* ── Preflight Actions Bar ── */
.preflight-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.preflight-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-generate-estimate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
}

.btn-generate-estimate:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-1px);
}

.btn-generate-estimate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-insert-draft {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-insert-draft:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-refresh-preflight {
  padding: 7px 10px;
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
}

.btn-refresh-preflight:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.estimate-created-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .rfq-preflight-container {
    margin: 10px 12px;
    padding: 12px;
  }
}