/* ═══════════════════════════════════════════════════════════════
   AVA MISSION CONTROL — Design System
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #050508;
  --surface: #0d0d14;
  --surface-2: #12121c;
  --border: #1a1a2e;
  --border-2: #252538;
  --cyan: #00f5d4;
  --cyan-dim: rgba(0, 245, 212, 0.15);
  --cyan-glow: rgba(0, 245, 212, 0.4);
  --amber: #f5a623;
  --amber-dim: rgba(245, 166, 35, 0.15);
  --red: #ff4757;
  --red-dim: rgba(255, 71, 87, 0.15);
  --green: #2ed573;
  --green-dim: rgba(46, 213, 115, 0.15);
  --text: #e8e4df;
  --text-2: #8a8a9a;
  --text-3: #4a4a5a;
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 6px;
  --radius-lg: 12px;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ═══ UTILITIES ═══════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ═══ SCANLINES ══════════════════════════════════════════════════ */
.scanlines {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
}

/* ═══ BACKGROUND PARTICLES ═══════════════════════════════════════ */
.bg-particles {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}

/* ═══ AUTH OVERLAY ═══════════════════════════════════════════════ */
.auth-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}

.auth-particles {
  position: absolute; inset: 0; z-index: 0;
}

.auth-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 48px;
  text-align: center;
}

.auth-logo {
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}

.auth-orb {
  position: relative; width: 100px; height: 100px;
  display: flex; align-items: center; justify-content: center;
}

.auth-orb-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 245, 212, 0.3);
  animation: ring-rotate 8s linear infinite;
}

.auth-orb-ring-2 {
  inset: 10px;
  border-color: rgba(0, 245, 212, 0.15);
  animation-duration: 12s;
  animation-direction: reverse;
}

@keyframes ring-rotate {
  from { transform: rotateX(60deg) rotateZ(0deg); }
  to { transform: rotateX(60deg) rotateZ(360deg); }
}

.auth-orb-core {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(0,245,212,0.2), transparent 70%);
  border: 1px solid var(--cyan);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px var(--cyan-glow), inset 0 0 20px rgba(0,245,212,0.05);
}

.auth-orb-letter {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan-glow);
}

.auth-brand {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}

.auth-title {
  font-family: var(--font-head);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--text);
  text-shadow: 0 0 30px rgba(0,245,212,0.3);
}

.auth-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.25em;
  color: var(--text-2);
}

.auth-form-wrap {
  width: 320px;
  display: flex; flex-direction: column; gap: 20px; align-items: center;
}

.auth-status-text {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--cyan);
  opacity: 0;
  animation: fade-in-text 0.5s 0.5s ease forwards;
}

@keyframes fade-in-text {
  to { opacity: 0.7; }
}

.auth-form {
  width: 100%;
  opacity: 0;
  animation: slide-up 0.5s 1.5s ease forwards;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-field {
  display: flex; align-items: center; gap: 0;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan-glow), 0 0 20px var(--cyan-dim);
}

.auth-input {
  flex: 1; padding: 14px 16px;
  background: transparent;
  border: none; outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.15em;
}

.auth-input::placeholder { color: var(--text-3); letter-spacing: 0.1em; }

.auth-submit {
  padding: 14px 16px;
  background: transparent;
  border: none; border-left: 1px solid var(--border-2);
  color: var(--cyan);
  cursor: pointer;
  display: flex; align-items: center;
  transition: background 0.2s;
}

.auth-submit:hover { background: var(--cyan-dim); }

.auth-error {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--red);
  text-align: center;
  min-height: 16px;
  letter-spacing: 0.05em;
}

/* ═══ BOOT OVERLAY ═══════════════════════════════════════════════ */
.boot-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}

.boot-lines {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  opacity: 0.7;
  line-height: 2;
  max-width: 500px;
  width: 100%;
}

.boot-line {
  opacity: 0;
  animation: boot-appear 0.1s forwards;
}

@keyframes boot-appear {
  to { opacity: 1; }
}

/* ═══ MAIN APP ═══════════════════════════════════════════════════ */
.app {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ═══ TOPBAR ═════════════════════════════════════════════════════ */
.topbar {
  position: relative; z-index: 10;
  height: 52px;
  display: flex; align-items: center;
  padding: 0 20px;
  background: rgba(5, 5, 8, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  gap: 20px;
  flex-shrink: 0;
}

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

.logo-mark {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 10px var(--cyan-glow);
}

.logo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}

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

.logo-text {
  display: flex; flex-direction: column; gap: 0;
}

.logo-ava {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text);
  line-height: 1;
}

.logo-mc {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--text-2);
  line-height: 1;
  margin-top: 2px;
}

.topbar-center { flex: 1; display: flex; justify-content: center; }

.main-nav {
  display: flex; gap: 4px;
  background: var(--surface);
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.nav-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 16px;
  background: transparent;
  border: none; border-radius: 4px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn.active {
  background: var(--cyan-dim);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(0,245,212,0.2);
}

.nav-btn:hover:not(.active) {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.topbar-right { min-width: 200px; display: flex; justify-content: flex-end; }

.system-indicators {
  display: flex; align-items: center; gap: 16px;
}

.sys-indicator {
  display: flex; align-items: center; gap: 7px;
}

.sys-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  transition: all 0.5s;
}

.sys-dot.online {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 3s ease-in-out infinite;
}

.sys-dot.offline { background: var(--red); }

#sys-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-2);
}

.clock {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: 0.08em;
}

/* ═══ TAB SYSTEM ═════════════════════════════════════════════════ */
.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
  position: relative; z-index: 1;
}

.tab-content.active { display: flex; flex-direction: column; }

/* ═══ INTEL FEED ════════════════════════════════════════════════ */
.intel-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 20px;
  gap: 20px;
}

.intel-sidebar {
  width: 200px;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 16px;
}

.sidebar-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-3);
  margin-bottom: 12px;
}

.filter-btns {
  display: flex; flex-direction: column; gap: 4px;
}

.filter-btn {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--cyan-dim);
  border-color: rgba(0,245,212,0.2);
  color: var(--cyan);
}

.filter-btn:hover:not(.active) {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.priority-legend {
  display: flex; flex-direction: column; gap: 8px;
}

.legend-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--text-2);
}

.legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
}

.legend-dot.critical { background: var(--red); box-shadow: 0 0 6px var(--red); }
.legend-dot.high { background: var(--amber); }
.legend-dot.medium { background: var(--cyan); }
.legend-dot.low { background: var(--text-3); }

.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

.stat-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  text-align: center;
}

.stat-num {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.stat-num.critical-text { color: var(--red); text-shadow: 0 0 10px rgba(255,71,87,0.5); }

.stat-key {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--text-3);
  margin-top: 4px;
}

.intel-feed {
  flex: 1;
  min-width: 0;   /* critical: prevents flex child from overflowing */
  display: flex; flex-direction: column;
  overflow: hidden;
}

.feed-header {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.feed-title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text);
}

.feed-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

.feed-list {
  flex: 1;
  width: 100%;
  min-width: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-right: 4px;
  align-content: start;
}

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

.feed-loading {
  display: flex; align-items: center; gap: 12px;
  padding: 40px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.loading-orb {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--cyan);
  animation: spin 1s linear infinite;
}

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

/* ═══ BRIEF CARDS ════════════════════════════════════════════════ */
.brief-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-lg);
  padding: 0;
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s;
  animation: card-in 0.5s ease both;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;   /* let grid control the width */
}

/* All card content below hero gets padding */
.card-body {
  padding: 12px 14px 12px;
  display: flex; flex-direction: column; gap: 0;
  flex: 1;
  min-height: 0;
}

@keyframes card-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.brief-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  opacity: 0;
  transition: opacity 0.3s;
}

.brief-card:hover {
  border-color: transparent;
  transform: translateY(-1px);
}

.brief-card:hover::before { opacity: 1; }

.brief-card.priority-critical {
  border-left-color: var(--red);
  box-shadow: inset 0 0 30px rgba(255,71,87,0.03);
}

.brief-card.priority-critical::before {
  background: linear-gradient(90deg, var(--red), transparent);
}

.brief-card.priority-critical:hover {
  box-shadow: 0 4px 20px rgba(255,71,87,0.15), inset 0 0 30px rgba(255,71,87,0.05);
}

.brief-card.priority-high {
  border-left-color: var(--amber);
}

.brief-card.priority-high::before {
  background: linear-gradient(90deg, var(--amber), transparent);
}

.brief-card.priority-high:hover {
  box-shadow: 0 4px 20px rgba(245,166,35,0.15);
}

.brief-card.priority-medium {
  border-left-color: var(--cyan);
}

.brief-card.priority-medium::before {
  background: linear-gradient(90deg, var(--cyan), transparent);
}

.brief-card.priority-medium:hover {
  box-shadow: 0 4px 20px rgba(0,245,212,0.15);
}

.brief-card.priority-low {
  border-left-color: var(--text-3);
}

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

.card-meta {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}

.card-type-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  padding: 3px 7px;
  border-radius: 3px;
  font-weight: 400;
}

.type-pipeline { background: var(--cyan-dim); color: var(--cyan); }
.type-intelligence { background: rgba(245,166,35,0.12); color: var(--amber); }
.type-workspace { background: rgba(46,213,115,0.12); color: var(--green); }
.type-email { background: rgba(255,255,255,0.06); color: var(--text-2); }

.priority-badge {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.priority-badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
}

.priority-critical .priority-badge-dot {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
  animation: pulse-critical 1.5s ease-in-out infinite;
}

@keyframes pulse-critical {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--red); }
  50% { opacity: 0.5; box-shadow: 0 0 3px var(--red); }
}

.priority-high .priority-badge-dot { background: var(--amber); }
.priority-medium .priority-badge-dot { background: var(--cyan); }
.priority-low .priority-badge-dot { background: var(--text-3); }

.priority-critical .priority-badge { color: var(--red); }
.priority-high .priority-badge { color: var(--amber); }
.priority-medium .priority-badge { color: var(--cyan); }
.priority-low .priority-badge { color: var(--text-3); }

.card-timestamp {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}

.card-title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.card-summary {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px;
}

.card-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-3);
}

.card-expand-toggle {
  display: flex; align-items: center; gap: 6px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-3);
  transition: color 0.2s;
}

.card-expand-icon {
  transition: transform 0.25s;
}

.brief-card.expanded .card-expand-icon { transform: rotate(180deg); }
.brief-card.expanded .card-expand-toggle { color: var(--cyan); }

.card-details {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.brief-card.expanded .card-details { display: block; }

.card-detail-list {
  list-style: none; display: flex; flex-direction: column; gap: 8px;
}

.card-detail-list li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

.card-detail-list li::before {
  content: '→';
  color: var(--cyan);
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 1px;
}

/* ═══ AVA INTERFACE ══════════════════════════════════════════════ */
.ava-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 20px;
  gap: 20px;
}

.ava-sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto;
}

.hud-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.hud-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 2px; height: 20px;
  background: var(--cyan);
  border-radius: 0 0 2px 2px;
}

.hud-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-3);
  margin-bottom: 12px;
}

.status-row-hud {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}

.status-dot-hud {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  transition: all 0.5s;
}

.status-dot-hud.online {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 3s ease-in-out infinite;
}

.hud-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

.hud-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}

.hud-key {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--text-3);
  margin-bottom: 3px;
}

.hud-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-options {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}

.mode-opt {
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-opt.active {
  background: var(--cyan-dim);
  border-color: rgba(0,245,212,0.2);
  color: var(--cyan);
}

.presence-text {
  font-size: 12px;
  color: var(--text-2);
  font-style: italic;
  line-height: 1.4;
}

.clear-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: auto;
}

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

/* ═══ AVA MAIN ═══════════════════════════════════════════════════ */
.ava-main {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  gap: 0;
  min-width: 0;
}

.orb-stage {
  display: flex; justify-content: center; align-items: center;
  height: 200px;
  flex-shrink: 0;
  position: relative;
}

.orb-shell {
  position: relative;
  width: 100%;
  height: 200px;
  display: flex; align-items: center; justify-content: center;
}

#orb-canvas {
  display: block;
  width: 100%;
  height: 200px;
  position: absolute;
  top: 0; left: 0;
}

.orb-state-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  opacity: 0.7;
  z-index: 2;
  white-space: nowrap;
}

/* ═══ TRANSCRIPT ═════════════════════════════════════════════════ */
.transcript-container {
  flex: 1;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  display: flex; flex-direction: column;
}

.transcript-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}

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

.transcript-welcome {
  display: flex; align-items: center; justify-content: center;
  flex: 1;
  opacity: 0.4;
}

.welcome-text {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-2);
  text-align: center;
}

.msg {
  display: flex; gap: 12px; align-items: flex-start;
  animation: msg-in 0.3s ease;
}

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

.msg.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 600;
}

.msg.user .msg-avatar {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border-2);
  color: var(--text);
}

.msg.assistant .msg-avatar {
  background: var(--cyan-dim);
  border: 1px solid rgba(0,245,212,0.2);
  color: var(--cyan);
}

.msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 10px;
  line-height: 1.6;
  font-size: 13px;
}

.msg.user .msg-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-2);
  color: var(--text);
}

.msg.assistant .msg-bubble {
  background: rgba(0,245,212,0.05);
  border: 1px solid rgba(0,245,212,0.12);
  color: var(--text);
}

.msg-time {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
  margin-top: 4px;
}

.msg.user .msg-time { text-align: right; }

.typing-indicator {
  display: flex; gap: 5px; align-items: center;
  padding: 12px 14px;
}

.typing-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  opacity: 0.4;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* ═══ INPUT BAR ══════════════════════════════════════════════════ */
.input-bar {
  display: flex; align-items: flex-end; gap: 10px;
  flex-shrink: 0;
}

.mic-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.mic-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.mic-btn.recording {
  background: rgba(255,71,87,0.12);
  border-color: var(--red);
  color: var(--red);
  animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,71,87,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255,71,87,0); }
}

.input-wrap {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 22px;
  padding: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.input-wrap:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan-dim);
}

.chat-input {
  width: 100%;
  background: transparent;
  border: none; outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  padding: 12px 18px;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  display: block;
}

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

.send-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 1px solid rgba(0,245,212,0.3);
  color: var(--cyan);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.send-btn:hover {
  background: var(--cyan);
  color: var(--bg);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.send-btn:disabled {
  opacity: 0.3; cursor: default;
}

/* ═══ RICH BRIEF CARDS ══════════════════════════════════════════ */

/* Hero — photo or chart, top of card */
.card-hero {
  width: 100%;
  height: 150px;
  overflow: hidden;
  border-radius: 0;
  position: relative;
  flex-shrink: 0;
  background: var(--surface-2);
}

/* Chart hero: dark bg, no overlay needed */
.card-hero-chart {
  background: #0a0a12;
  display: flex; align-items: center; justify-content: center;
  padding: 6px 10px;
  height: 150px;
}

.card-hero-chart svg {
  width: 100%; height: 100%;
  overflow: visible;
}

.card-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.75;
  transition: opacity 0.3s;
  display: block;
}

.brief-card:hover .card-hero img { opacity: 0.9; }

.card-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(5,5,8,0.9) 100%);
}

.card-hero-label {
  position: absolute; bottom: 10px; left: 14px;
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.15em; color: var(--text-2);
}

/* Metrics bar strip — always visible */
.card-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.metric-item {
  display: flex; flex-direction: column; gap: 5px;
}

.metric-label {
  font-family: var(--font-mono); font-size: 8px;
  letter-spacing: 0.12em; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.metric-value {
  font-family: var(--font-head); font-size: 15px; font-weight: 600;
  line-height: 1;
}

.metric-value.color-cyan   { color: var(--cyan);  text-shadow: 0 0 8px rgba(0,245,212,0.4); }
.metric-value.color-red    { color: var(--red);   text-shadow: 0 0 8px rgba(255,71,87,0.4); }
.metric-value.color-green  { color: var(--green); text-shadow: 0 0 8px rgba(46,213,115,0.4); }
.metric-value.color-amber  { color: var(--amber); text-shadow: 0 0 8px rgba(245,166,35,0.4); }

.metric-bar-track {
  height: 4px; background: rgba(255,255,255,0.1);
  border-radius: 2px; overflow: hidden;
  margin-top: 2px;
}

.metric-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width 1.2s cubic-bezier(0.4,0,0.2,1);
  min-width: 2px;
}

.metric-bar-fill.color-cyan  { background: linear-gradient(90deg, var(--cyan), rgba(0,245,212,0.6)); box-shadow: 0 0 8px rgba(0,245,212,0.6); }
.metric-bar-fill.color-red   { background: linear-gradient(90deg, var(--red), rgba(255,71,87,0.6)); box-shadow: 0 0 8px rgba(255,71,87,0.4); }
.metric-bar-fill.color-green { background: linear-gradient(90deg, var(--green), rgba(46,213,115,0.6)); box-shadow: 0 0 8px rgba(46,213,115,0.5); }
.metric-bar-fill.color-amber { background: linear-gradient(90deg, var(--amber), rgba(245,166,35,0.6)); box-shadow: 0 0 8px rgba(245,166,35,0.4); }

/* Data table */
.card-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.card-table {
  width: 100%; border-collapse: collapse;
  font-size: 11px; font-family: var(--font-mono);
  white-space: nowrap;
}

.card-table th {
  padding: 7px 10px;
  background: rgba(255,255,255,0.04);
  color: var(--text-3); font-weight: 400;
  letter-spacing: 0.1em; font-size: 9px;
  text-align: left; border-bottom: 1px solid var(--border);
}

.card-table td {
  padding: 7px 10px;
  color: var(--text-2);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
  font-family: var(--font-mono), 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.card-table tr:last-child td { border-bottom: none; }
.card-table tr:hover td { background: rgba(0,245,212,0.03); color: var(--text); }
.card-table td:first-child { color: var(--text); font-weight: 400; }

/* ═══════════════════════════════════════════════════════════════
   FILE BROWSER — complete redesign
   ═══════════════════════════════════════════════════════════════ */

.files-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 16px 20px 20px;
  gap: 0;          /* no gap — drag handle is the visual separator */
}

/* ── Left sidebar ── */
.files-sidebar {
  width: 190px;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto;
  padding-right: 14px;
}

/* ── Center: grid ── */
.files-main {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 0;
  padding-right: 0;
}

.files-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.breadcrumb {
  display: flex; flex-wrap: wrap; gap: 2px; align-items: center;
}

.bc-item {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em;
  color: var(--text-3); cursor: pointer; padding: 3px 7px;
  border-radius: 4px; transition: all 0.15s;
}
.bc-item:hover { color: var(--cyan); background: var(--cyan-dim); }
.bc-item.bc-root { color: var(--text-2); }
.bc-sep { color: var(--text-3); font-size: 10px; padding: 0 1px; }

.files-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
  align-content: start;
  align-items: start;
  padding: 2px 2px 4px;
}

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

/* ── File Card ── */
.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  display: flex; flex-direction: column; gap: 6px;
  animation: card-in 0.25s ease both;
  min-width: 0;
}

.file-card:hover {
  border-color: rgba(0,245,212,0.35);
  box-shadow: 0 2px 14px rgba(0,245,212,0.07);
  transform: translateY(-1px);
}
.file-card.is-folder { border-color: rgba(245,166,35,0.2); }
.file-card.is-folder:hover { border-color: rgba(245,166,35,0.5); box-shadow: 0 2px 14px rgba(245,166,35,0.08); }

.file-icon {
  width: 26px; height: 26px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.file-icon svg { width: 15px; height: 15px; }

.file-icon-folder { background: rgba(245,166,35,0.12); color: var(--amber); }
.file-icon-image  { background: rgba(46,213,115,0.12); color: var(--green); }
.file-icon-video  { background: rgba(255,71,87,0.12);  color: var(--red); }
.file-icon-audio  { background: rgba(245,166,35,0.1);  color: var(--amber); }
.file-icon-pdf    { background: rgba(255,107,122,0.1); color: #ff6b7a; }
.file-icon-text   { background: var(--cyan-dim);        color: var(--cyan); }
.file-icon-html   { background: rgba(245,200,66,0.1);  color: #f5c842; }
.file-icon-office { background: rgba(46,213,115,0.1);  color: #52e88a; }
.file-icon-code   { background: rgba(255,255,255,0.05); color: var(--text-2); }
.file-icon-json   { background: rgba(255,255,255,0.04); color: var(--text-3); }
.file-icon-file   { background: rgba(255,255,255,0.03); color: var(--text-3); }

.file-name {
  font-family: var(--font-mono); font-size: 11px; color: var(--text);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.file-meta {
  font-family: var(--font-mono); font-size: 9px; color: var(--text-3);
  letter-spacing: 0.03em;
}

.file-type-badge {
  display: inline-flex; align-items: center;
  padding: 2px 6px; border-radius: 3px;
  font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.08em;
  border: 1px solid transparent;
  margin-top: auto; align-self: flex-start;
}

.type-image   { background: rgba(46,213,115,0.1);  border-color: rgba(46,213,115,0.2);  color: var(--green); }
.type-video   { background: rgba(255,71,87,0.1);   border-color: rgba(255,71,87,0.2);   color: var(--red); }
.type-audio   { background: rgba(245,166,35,0.1);  border-color: rgba(245,166,35,0.2);  color: var(--amber); }
.type-pdf     { background: rgba(255,71,87,0.08);  border-color: rgba(255,71,87,0.15);  color: #ff6b7a; }
.type-text    { background: var(--cyan-dim);        border-color: rgba(0,245,212,0.2);   color: var(--cyan); }
.type-html    { background: rgba(245,166,35,0.08); border-color: rgba(245,166,35,0.15); color: #f5c842; }
.type-office  { background: rgba(46,213,115,0.08); border-color: rgba(46,213,115,0.15); color: #52e88a; }
.type-code    { background: rgba(255,255,255,0.04); border-color: var(--border-2);       color: var(--text-2); }
.type-json    { background: rgba(255,255,255,0.04); border-color: var(--border-2);       color: var(--text-3); }
.type-folder  { background: rgba(245,166,35,0.08); border-color: rgba(245,166,35,0.2);  color: var(--amber); }
.type-file    { background: rgba(255,255,255,0.03); border-color: var(--border);         color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════
   PREVIEW PANEL — complete redesign
   ═══════════════════════════════════════════════════════════════ */

.preview-panel {
  width: 380px;
  min-width: 280px;
  max-width: 55vw;          /* up to 55% of viewport — much more room */
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* No transition on width — causes jank during drag */
}

.preview-panel.hidden-panel { display: none; }

/* Backdrop for overlay mode */
.preview-backdrop {
  display: none;
  position: fixed; inset: 0;
  z-index: 49;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
}
.preview-backdrop.active { display: block; }

/* ── Drag handle — fat enough to grab easily ── */
.preview-resize-handle {
  width: 10px;
  flex-shrink: 0;
  cursor: col-resize;
  position: relative;
  background: transparent;
  transition: background 0.15s;
  user-select: none;
}

.preview-resize-handle::before {
  /* Wide invisible hit area */
  content: '';
  position: absolute;
  inset: 0 -4px;   /* extend hit area 4px either side */
  z-index: 1;
  cursor: col-resize;
}

.preview-resize-handle::after {
  content: '';
  position: absolute;
  left: 4px; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 36px;
  background: var(--border-2);
  border-radius: 1px;
  transition: height 0.2s, background 0.2s;
}

.preview-resize-handle:hover { background: rgba(0,245,212,0.06); }
.preview-resize-handle:hover::after,
.preview-resize-handle.dragging::after {
  background: var(--cyan);
  height: 56px;
  box-shadow: 0 0 6px var(--cyan-glow);
}
.preview-resize-handle.dragging { background: rgba(0,245,212,0.08); }

/* ── Inner layout ── */
.preview-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Header: label + close button */
.preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.preview-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-3);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: all 0.15s;
}
.preview-close:hover { background: rgba(255,71,87,0.12); border-color: var(--red); color: var(--red); }

/* File name + meta — compact, no wasted vertical space */
.preview-name {
  padding: 10px 14px 2px;
  font-family: var(--font-head); font-size: 13px; font-weight: 600;
  color: var(--text); word-break: break-word; line-height: 1.3;
  flex-shrink: 0;
}

.preview-meta {
  padding: 3px 14px 10px;
  font-family: var(--font-mono); font-size: 10px; color: var(--text-3);
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Content area — fills all remaining height, single scroll context */
.preview-content {
  flex: 1;
  overflow: hidden;   /* NO scroll here — let children handle it */
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

/* Image preview — centered, max size */
.preview-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  margin: auto;
  border-radius: var(--radius);
  padding: 12px;
}

/* Text preview — scrolls independently */
.preview-text {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-2);
  line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
.preview-text::-webkit-scrollbar { width: 4px; }
.preview-text::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* Audio/Video */
.preview-audio, .preview-video {
  display: block; width: calc(100% - 28px);
  margin: 14px;
  border-radius: var(--radius);
}

/* PDF — fills height, no double scroll */
.preview-pdf-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
  min-height: 0;
}

/* HTML tools — fills height, scrolls inside iframe */
.preview-html-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
  min-height: 0;
}

.preview-empty {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-3); text-align: center; padding: 40px 20px;
}

/* Actions bar — download / open */
.preview-actions {
  padding: 10px 14px;
  display: flex; gap: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.preview-btn {
  flex: 1; padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius); color: var(--text-2);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em;
  cursor: pointer; text-align: center; text-decoration: none;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
}
.preview-btn:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim); }
.preview-btn.primary { background: var(--cyan-dim); border-color: rgba(0,245,212,0.3); color: var(--cyan); }

/* ═══ RESPONSIVE ═════════════════════════════════════════════════ */

/* Medium screens: preview overlays instead of side panel */
@media (max-width: 1000px) {
  .preview-panel:not(.hidden-panel) {
    position: fixed;
    top: 52px; right: 0; bottom: 0;
    z-index: 50;
    border-radius: var(--radius-lg) 0 0 0;
    box-shadow: -8px 0 40px rgba(0,0,0,0.6);
    width: 380px !important;
  }
}

@media (max-width: 768px) {
  .intel-sidebar, .ava-sidebar, .files-sidebar { display: none; }
  .topbar { padding: 0 12px; }
  .logo-mc { display: none; }
  .intel-layout, .ava-layout, .files-layout { padding: 12px; }
  .orb-stage { height: 130px; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .feed-list { grid-template-columns: 1fr; }
  .preview-panel:not(.hidden-panel) {
    position: fixed;
    top: 52px; right: 0; bottom: 0;
    width: 90vw !important;
    z-index: 50;
  }
}
