/* ══════════════════════════════════════════
   BREAKOUT RESEARCH — Trading Floor Noir
   Palette: Near-black · Gold · Warm white
   Type: Bebas Neue · Playfair Display
        Outfit · IBM Plex Mono
   ══════════════════════════════════════════ */

:root {
  --bg:         #07070E;
  --surface:    #0D0D1C;
  --surface2:   #131327;
  --surface3:   #191934;
  --border:     #1B1B32;
  --border2:    #24243E;
  --gold:       #C4912C;
  --gold2:      #DCA84A;
  --gold3:      #F0C56E;
  --gold-dim:   rgba(196,145,44,0.08);
  --gold-glow:  rgba(196,145,44,0.18);
  --up:         #2DD878;
  --down:       #F04545;
  --amber:      #F59E0B;
  --text:       #EDE9DF;
  --muted:      #70708A;
  --font:       'Outfit', system-ui, sans-serif;
  --display:    'Playfair Display', Georgia, serif;
  --brand:      'Bebas Neue', 'Arial Narrow', sans-serif;
  --mono:       'IBM Plex Mono', 'Courier New', monospace;
}

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

html { scroll-behavior: smooth; }

/* Visible focus ring for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--gold2);
  outline-offset: 2px;
  border-radius: 3px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Background depth layer */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 15% 10%, rgba(196,145,44,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 85% 90%, rgba(80,60,180,0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--gold) 20%,
    var(--gold2) 50%,
    var(--gold) 80%,
    transparent 100%
  );
  opacity: 0.5;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  font-family: var(--brand);
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--gold2);
  text-decoration: none;
  white-space: nowrap;
}

.logo em {
  font-style: normal;
  color: var(--text);
  opacity: 0.7;
}

.tagline {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding-left: 20px;
  border-left: 1px solid var(--border2);
  white-space: nowrap;
  font-family: var(--mono);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid var(--border2);
  transition: all 0.2s;
  white-space: nowrap;
  font-family: var(--mono);
}

.social-link:hover {
  color: var(--gold2);
  border-color: var(--gold);
  background: var(--gold-dim);
}

/* ── Layout ── */
.layout {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
  width: 196px;
  background: var(--surface);
  border-right: 1px solid var(--border2);
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
}

.sidebar-section-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 20px 6px;
  opacity: 0.6;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 20px;
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  letter-spacing: 0.01em;
  user-select: none;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}

.nav-item.active {
  color: var(--gold2);
  background: linear-gradient(90deg, var(--gold-dim) 0%, transparent 100%);
  border-left-color: var(--gold);
}

.nav-item .icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-item.active .icon { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .brand-name {
  font-family: var(--brand);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 10px;
  opacity: 0.8;
}

.sidebar-social {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-social a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 0;
  transition: color 0.15s;
  font-family: var(--font);
}

.sidebar-social a:hover { color: var(--gold2); }

/* ── Main content ── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.tab-panel { display: none; flex: 1; flex-direction: column; min-height: 0; }
.tab-panel.active { display: flex; }

/* ── Chat panel ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.message {
  max-width: 840px;
  width: 100%;
}

.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }

.message-bubble {
  padding: 13px 18px;
  border-radius: 10px;
  line-height: 1.75;
  font-size: 14px;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--gold) 0%, #A87820 100%);
  color: #1A1200;
  font-weight: 500;
  border-bottom-right-radius: 3px;
}

.message.assistant .message-bubble {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-bottom-left-radius: 3px;
}

.message.assistant .message-bubble h2,
.message.assistant .message-bubble h3 {
  font-family: var(--display);
  color: var(--gold2);
  margin: 14px 0 6px;
  font-size: 15px;
  font-style: italic;
}

.message.assistant .message-bubble h2:first-child,
.message.assistant .message-bubble h3:first-child { margin-top: 0; }

.message.assistant .message-bubble ul,
.message.assistant .message-bubble ol {
  padding-left: 20px;
  margin: 6px 0;
}

.message.assistant .message-bubble p { margin: 6px 0; }

.message.assistant .message-bubble strong {
  color: var(--text);
  font-weight: 600;
}

.message.assistant .message-bubble code {
  background: var(--gold-dim);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold2);
}

.message.assistant .message-bubble pre {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 10px 0;
}

.message.assistant .message-bubble pre code {
  background: none;
  padding: 0;
  color: var(--text);
}

/* Tool indicator */
.tool-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  background: var(--gold-dim);
  border: 1px solid rgba(196,145,44,0.3);
  border-radius: 20px;
  font-size: 11px;
  color: var(--gold2);
  margin-bottom: 8px;
  font-family: var(--mono);
  letter-spacing: 0.05em;
}

.tool-indicator .spinner {
  width: 10px;
  height: 10px;
  border: 2px solid rgba(196,145,44,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Typing cursor */
.cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--gold);
  border-radius: 1px;
  animation: blink 1s step-end infinite;
  vertical-align: middle;
  margin-left: 2px;
}

@keyframes blink { 50% { opacity: 0; } }

/* Chat input area */
.chat-input-area {
  padding: 16px 28px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border2);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  max-width: 860px;
}

.chat-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 16px;
  font-family: var(--font);
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 140px;
  overflow-y: auto;
  transition: border-color 0.2s;
}

.chat-input:focus { border-color: var(--gold); }
.chat-input::placeholder { color: var(--muted); }

.send-btn {
  background: var(--gold);
  color: #1A1000;
  border: none;
  border-radius: 8px;
  padding: 0 20px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--gold2);
  transform: translateX(1px);
}

.send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.suggestions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  max-width: 860px;
}

.suggestion-chip {
  padding: 5px 13px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.01em;
}

.suggestion-chip:hover {
  border-color: var(--gold);
  color: var(--gold2);
  background: var(--gold-dim);
}

/* ── Panel content ── */
.panel-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

.panel-content::-webkit-scrollbar { width: 4px; }
.panel-content::-webkit-scrollbar-track { background: transparent; }
.panel-content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.panel-title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 4px;
  position: relative;
  padding-bottom: 14px;
}

.panel-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 36px;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
}

.panel-subtitle {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 4px;
  margin-bottom: 24px;
  letter-spacing: 0.01em;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.text-input {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 14px;
  font-family: var(--font);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
  min-width: 180px;
}

.text-input:focus { border-color: var(--gold); }
.text-input::placeholder { color: var(--muted); }

.btn {
  background: var(--gold);
  color: #1A1000;
  border: none;
  border-radius: 6px;
  padding: 9px 22px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0.03em;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:hover { background: var(--gold2); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-weight: 500;
}

.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

/* Result box */
.result-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 22px 24px;
  min-height: 100px;
  line-height: 1.75;
}

.result-box.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  font-family: var(--display);
}

.result-content h2,
.result-content h3 {
  font-family: var(--display);
  color: var(--gold2);
  font-size: 15px;
  font-style: italic;
  margin: 14px 0 6px;
  font-weight: 600;
}

.result-content h2:first-child,
.result-content h3:first-child { margin-top: 0; }
.result-content p { margin: 6px 0; }
.result-content ul, .result-content ol { padding-left: 20px; margin: 6px 0; }
.result-content strong { color: var(--text); font-weight: 600; }

.result-content code {
  background: var(--gold-dim);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold2);
}

/* Portfolio holdings table */
.holdings-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 13px;
}

.holdings-table th {
  text-align: left;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border2);
  font-family: var(--mono);
}

.holdings-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}

.holdings-table .remove-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}

.holdings-table .remove-btn:hover { color: var(--down); }

/* Loading state */
.loading-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
  font-style: italic;
  font-family: var(--display);
}

.loading-dots span {
  animation: blink 1.2s step-end infinite;
  font-size: 22px;
  line-height: 1;
  color: var(--gold);
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Positive / negative */
.pos { color: var(--up); }
.neg { color: var(--down); }

/* ── Analyst Perspectives / Personas ── */
.personas-empty {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  font-family: var(--display);
  padding: 40px 0;
  text-align: center;
  grid-column: 1 / -1;
}

.personas-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 1200px) { .personas-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .personas-grid { grid-template-columns: 1fr; } }

.persona-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--pc, var(--gold));
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.persona-card:hover {
  background: color-mix(in srgb, var(--pc, var(--gold)) 6%, var(--surface));
}

.persona-card.selected {
  background: color-mix(in srgb, var(--pc, var(--gold)) 8%, var(--surface));
  box-shadow: 0 0 0 1px var(--pc, var(--gold));
}

.persona-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.persona-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1;
}

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

.persona-name {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
  color: var(--text);
}

.persona-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pc, var(--gold));
  background: color-mix(in srgb, var(--pc, var(--gold)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--pc, var(--gold)) 25%, transparent);
  font-family: var(--mono);
}

.persona-status { font-size: 13px; flex-shrink: 0; }

.persona-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--pc, var(--gold));
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.persona-philosophy {
  font-style: italic;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  border-left: 2px solid color-mix(in srgb, var(--pc, var(--gold)) 35%, transparent);
  padding-left: 10px;
  font-family: var(--display);
}

.persona-tools { display: flex; flex-wrap: wrap; gap: 5px; min-height: 0; }

.persona-result {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.75;
  overflow-y: auto;
  max-height: 520px;
}

.persona-result.empty {
  color: var(--muted);
  font-style: italic;
  font-family: var(--display);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
}

.persona-result h2,
.persona-result h3 {
  font-family: var(--display);
  color: var(--pc, var(--gold2));
  font-size: 13.5px;
  font-weight: 600;
  font-style: italic;
  margin: 12px 0 5px;
}

.persona-result h2:first-child,
.persona-result h3:first-child { margin-top: 0; }
.persona-result p { margin: 5px 0; }
.persona-result ul, .persona-result ol { padding-left: 18px; margin: 5px 0; }
.persona-result strong { color: var(--text); font-weight: 600; }

.persona-result code {
  background: color-mix(in srgb, var(--pc, var(--gold)) 12%, transparent);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--pc, var(--gold2));
}
