/* ============================================================
   TRUTH LENS — Cyber-Tech Theme
   A futuristic, data-dense interface with neon accents,
   glassmorphism panels, and animated background effects.
   ============================================================ */

/* ----- CSS Custom Properties ----- */
:root {
  --bg-deep: #060b14;
  --bg-primary: #0a0f1e;
  --bg-card: #0d1528;
  --bg-panel: rgba(13, 21, 40, 0.75);
  --bg-sidebar: #080d1a;
  --surface-glass: rgba(15, 24, 45, 0.65);
  --border-subtle: rgba(0, 180, 255, 0.08);
  --border-glow: rgba(0, 200, 255, 0.18);
  --border-active: rgba(0, 220, 255, 0.42);

  --accent-cyan: #00d4ff;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-orange: #ff7058;
  --accent-rose: #f43f5e;

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-cyan: #67e8f9;

  --glow-cyan: 0 0 18px rgba(0, 212, 255, 0.25);
  --glow-purple: 0 0 22px rgba(139, 92, 246, 0.25);
  --glow-blue: 0 0 16px rgba(59, 130, 246, 0.2);
  --glow-orange: 0 0 18px rgba(255, 112, 88, 0.3);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
  --font-sans: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ----- Reset & Base ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----- Animated Grid Background ----- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    /* radial gradient vignette */
    radial-gradient(ellipse at 50% 0%, rgba(0, 180, 255, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 20% 80%, rgba(255, 112, 88, 0.04) 0%, transparent 50%),
    /* dot grid */
    radial-gradient(circle, rgba(0, 200, 255, 0.12) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 32px 32px;
  animation: gridShift 20s linear infinite;
}

@keyframes gridShift {
  0% { background-position: 0 0, 0 0, 0 0, 0 0; }
  100% { background-position: 0 0, 0 0, 0 0, 32px 32px; }
}

/* ----- Scan Line Overlay ----- */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  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
  );
  opacity: 0.5;
}

/* ----- Particle Canvas ----- */
#particleCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ----- Scrollbar ----- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 200, 255, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 200, 255, 0.4);
}

/* ----- Typography ----- */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

h1 { font-size: 34px; }
h2 { font-size: 26px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
}

button, input, textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
}
input, textarea {
  outline: none;
}
a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* ============================================================
   AUTH SHELL — Login/Register Page
   ============================================================ */
.auth-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 480px) minmax(380px, 580px);
  justify-content: center;
  align-items: center;
  gap: 32px;
  padding: 32px;
}

/* Auth Panel (left) */
.auth-panel {
  width: 100%;
  background: var(--bg-panel);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}
.auth-panel:hover {
  border-color: var(--border-active);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(0, 200, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  font-family: var(--font-mono);
  letter-spacing: 0;
  box-shadow: 0 0 30px rgba(0, 200, 255, 0.35);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.auth-panel h1 {
  margin: 20px 0 10px;
  background: linear-gradient(135deg, #e2e8f0, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-panel > p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 8px;
}

/* Auth Form */
.auth-form {
  display: grid;
  gap: 16px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}

.seg-btn {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition-fast);
}
.seg-btn.active {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  box-shadow: var(--glow-cyan);
}

label {
  display: grid;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  transition: all var(--transition-fast);
}
input:focus, textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1), var(--glow-cyan);
  background: rgba(255, 255, 255, 0.05);
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.primary-btn {
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  padding: 13px 18px;
  font-weight: 700;
  font-size: 15px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-smooth);
  box-shadow: var(--glow-cyan);
}
.primary-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  opacity: 0;
  transition: opacity var(--transition-smooth);
}
.primary-btn:hover::before {
  opacity: 1;
}
.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
}
.primary-btn:active {
  transform: translateY(0);
  box-shadow: var(--glow-cyan);
}
.primary-btn span {
  position: relative;
  z-index: 1;
}

.form-tip {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Auth Showcase (right) */
.auth-showcase {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 32px;
  background: linear-gradient(160deg, rgba(8, 13, 26, 0.92), rgba(13, 21, 40, 0.85));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.auth-showcase::before {
  content: "";
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(0, 200, 255, 0.1);
  border-radius: 12px;
  pointer-events: none;
}
.auth-showcase::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 60% 30%, rgba(0, 200, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 30% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.showcase-top {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.showcase-top span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.showcase-top strong {
  color: #fff;
  font-size: 15px;
}

/* Status indicator dots */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  margin-right: 6px;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--accent-green); }
  50% { opacity: 0.5; box-shadow: 0 0 14px var(--accent-green); }
}

/* Radar */
.radar-card {
  position: relative;
  height: 360px;
  display: grid;
  place-items: center;
}

.radar-orbit {
  width: min(340px, 80%);
  aspect-ratio: 1;
  position: relative;
  border-radius: 50%;
  border: 1px solid rgba(0, 200, 255, 0.15);
  background:
    radial-gradient(circle, rgba(0, 200, 255, 0.15) 0 12%, transparent 13%),
    radial-gradient(circle, rgba(255, 255, 255, 0.03), transparent 55%);
  animation: rotate-slow 40s linear infinite;
}
@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.radar-orbit::before,
.radar-orbit::after {
  content: "";
  position: absolute;
  border: 1px dashed rgba(0, 200, 255, 0.15);
  border-radius: 50%;
}
.radar-orbit::before {
  inset: 18%;
}
.radar-orbit::after {
  inset: 35%;
}

.radar-orbit span {
  position: absolute;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 200, 255, 0.08);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 200, 255, 0.2);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-cyan);
  transition: all var(--transition-smooth);
}
.radar-orbit span:hover {
  background: rgba(0, 200, 255, 0.18);
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

.radar-orbit span:nth-child(1) { top: 10%; left: 5%; }
.radar-orbit span:nth-child(2) { top: 16%; right: 2%; }
.radar-orbit span:nth-child(3) { bottom: 12%; left: 2%; }
.radar-orbit span:nth-child(4) { bottom: 14%; right: 0%; }

/* Radar sweep */
.radar-sweep {
  position: absolute;
  width: 50%;
  height: 2px;
  top: 50%;
  left: 50%;
  background: linear-gradient(90deg, transparent, rgba(0, 220, 255, 0.7), transparent);
  transform-origin: left center;
  animation: sweep 4s linear infinite;
  border-radius: 1px;
}
@keyframes sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.showcase-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.showcase-grid div {
  padding: 18px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  transition: all var(--transition-smooth);
}
.showcase-grid div:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 200, 255, 0.2);
  box-shadow: var(--glow-cyan);
}
.showcase-grid strong {
  display: block;
  font-size: 28px;
  font-family: var(--font-mono);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.showcase-grid span {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================================
   WORKSPACE — Main Layout
   ============================================================ */
#app {
  position: relative;
  z-index: 2;
}

.workspace {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

/* ----- Sidebar ----- */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 20px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.side-brand > div strong {
  display: block;
  color: #fff;
  font-size: 16px;
}
.side-brand > div span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* Status bar in sidebar */
.side-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.side-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  animation: pulse-dot 2s ease-in-out infinite;
}
.side-status span {
  font-size: 11px;
  color: var(--accent-green);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* Nav list */
.nav-list {
  display: grid;
  gap: 6px;
  align-content: start;
}

.nav-item {
  width: 100%;
  border-radius: var(--radius-md);
  padding: 13px 16px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  transition: all var(--transition-fast);
  position: relative;
  border: 1px solid transparent;
}
.nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent-cyan);
  border-radius: 0 2px 2px 0;
  transition: height var(--transition-smooth);
}
.nav-item.active {
  background: rgba(0, 200, 255, 0.08);
  color: #fff;
  font-weight: 700;
  border-color: rgba(0, 200, 255, 0.15);
  box-shadow: inset 0 0 20px rgba(0, 200, 255, 0.04);
}
.nav-item.active::before {
  height: 60%;
}
.nav-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
}

/* Nav icons (emoji as simple icons) */
.nav-icon {
  display: inline-block;
  width: 20px;
  margin-right: 10px;
  font-size: 15px;
}

/* Account mini */
.account-mini {
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 13px;
}
.account-mini button {
  border: 1px solid var(--border-glow);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text-muted);
  font-size: 12px;
  transition: all var(--transition-fast);
}
.account-mini button:hover {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.08);
}

/* ----- Main Content Area ----- */
.main {
  min-width: 0;
  padding: 28px 32px;
  background: var(--bg-primary);
}

/* ----- Top Bar ----- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.topbar .eyebrow {
  color: var(--accent-cyan);
}

.topbar h2 {
  margin-top: 4px;
  color: #fff;
}

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

/* Global search */
.global-search {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  transition: all var(--transition-fast);
  width: min(340px, 36vw);
}
.global-search:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08);
}
.global-search span {
  font-size: 18px;
  color: var(--text-muted);
}
.global-search input {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: none;
}

/* VIP pill */
.vip-pill {
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.vip-pill.active {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
  color: var(--accent-amber);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}

/* ============================================================
   INSIGHT STRIP — Metrics Bar
   ============================================================ */
.insight-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.insight-strip > div {
  padding: 18px 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-smooth);
}
.insight-strip > div::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  opacity: 0;
  transition: opacity var(--transition-smooth);
}
.insight-strip > div:hover {
  border-color: var(--border-glow);
  box-shadow: var(--glow-cyan);
  transform: translateY(-2px);
}
.insight-strip > div:hover::after {
  opacity: 1;
}
.insight-strip span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.insight-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  font-family: var(--font-mono);
  background: linear-gradient(135deg, #e2e8f0, var(--accent-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============================================================
   VIEWS — Content Areas
   ============================================================ */
.view {
  display: none;
  animation: fadeSlideIn 0.35s ease;
}
.view.active {
  display: block;
}

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

/* ----- Chat Layout ----- */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.chat-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  min-height: calc(100vh - 140px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  transition: border-color var(--transition-smooth);
}
.chat-panel:focus-within {
  border-color: var(--border-active);
  box-shadow: var(--glow-cyan);
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}
.chat-head strong {
  color: #fff;
  font-family: var(--font-mono);
  font-size: 14px;
}
.chat-head > div span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}
.chat-head button {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  padding: 7px 12px;
  color: var(--text-muted);
  font-size: 12px;
  transition: all var(--transition-fast);
}
.chat-head button:hover {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}

/* Messages */
.messages {
  padding: 22px;
  overflow: auto;
  max-height: calc(100vh - 220px);
  display: grid;
  gap: 16px;
  align-content: start;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  animation: msgIn 0.3s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(680px, 85%);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  line-height: 1.7;
  white-space: pre-wrap;
  font-size: 14px;
}
.assistant .bubble {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.user .bubble {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  box-shadow: var(--glow-cyan);
}

/* Typing cursor for AI */
.typing-cursor::after {
  content: "▊";
  animation: blink 1s step-end infinite;
  color: var(--accent-cyan);
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Composer */
.composer {
  border-top: 1px solid var(--border-subtle);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.composer input {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}
.composer button {
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  padding: 12px 22px;
  font-weight: 700;
  box-shadow: var(--glow-cyan);
  transition: all var(--transition-smooth);
}
.composer button:hover {
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.45);
  transform: translateY(-1px);
}

/* ----- Quick Panel ----- */
.quick-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  align-self: start;
}
.quick-panel h3 {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.quick-question {
  width: 100%;
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  text-align: left;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all var(--transition-fast);
}
.quick-question:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 200, 255, 0.05);
  box-shadow: var(--glow-cyan);
}

.agent-mode {
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
}
.agent-mode span {
  display: block;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.agent-mode div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-btn {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  padding: 9px 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.mode-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 200, 255, 0.1);
  color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}
.mode-btn:hover:not(.active) {
  border-color: var(--border-glow);
  color: var(--text-secondary);
}

.quick-panel > p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ----- Stocks View ----- */
.split-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

.tool-card, .list-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: border-color var(--transition-smooth);
}
.tool-card:focus-within, .list-panel:hover {
  border-color: var(--border-glow);
}

.tool-card h3, .list-panel h3, .profile-card h3 {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.tool-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 12px;
}
.tool-card textarea {
  min-height: 90px;
  resize: vertical;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-head span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.stock-list {
  display: grid;
  gap: 10px;
}

.stock-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  transition: all var(--transition-smooth);
}
.stock-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--glow-cyan);
  transform: translateY(-2px);
}
.stock-card h4 {
  color: #fff;
  margin-bottom: 6px;
}
.stock-meta {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}
.stock-card p {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 6px 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.tag {
  display: inline-block;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}

.stock-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.stock-actions button {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.stock-actions button:first-child {
  border-color: rgba(0, 200, 255, 0.3);
  color: var(--accent-cyan);
}
.stock-actions button:first-child:hover {
  background: rgba(0, 200, 255, 0.08);
  box-shadow: var(--glow-cyan);
}
.stock-actions button:last-child:hover {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.06);
}

/* ----- Articles View ----- */
.article-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.article-toolbar input {
  flex: 1;
  min-width: 200px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-size: 13px;
}
.article-toolbar input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08);
}
.article-toolbar button {
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: var(--glow-cyan);
  transition: all var(--transition-smooth);
}
.article-toolbar button:hover {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
  transform: translateY(-1px);
}

.article-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.cat-btn {
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.cat-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 200, 255, 0.1);
  color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}
.cat-btn:hover:not(.active) {
  border-color: var(--border-glow);
  color: var(--text-secondary);
}

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

.article-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--bg-card);
  display: grid;
  gap: 10px;
  min-height: 210px;
  transition: all var(--transition-smooth);
}
.article-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--glow-purple);
  transform: translateY(-3px);
}
.article-meta {
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.article-card h4 {
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
}
.article-card p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

/* ----- Profile View ----- */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: grid;
  gap: 14px;
  transition: border-color var(--transition-smooth);
}
.profile-card:hover {
  border-color: var(--border-glow);
}
.profile-card h3 {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0;
}
.profile-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
}

.balance {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-mono);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.quota {
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-mono);
}

.vip-products, .amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.product-btn {
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.08);
  color: var(--accent-amber);
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  transition: all var(--transition-smooth);
}
.product-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
  transform: translateY(-1px);
}

.amounts button {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 16px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition-fast);
}
.amounts button:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 200, 255, 0.06);
  box-shadow: var(--glow-cyan);
}

.records {
  display: grid;
  gap: 10px;
}

.record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  transition: all var(--transition-fast);
}
.record-row:hover {
  border-color: var(--border-glow);
}
.record-row span {
  color: var(--text-secondary);
  font-size: 13px;
}
.record-row small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
  font-family: var(--font-mono);
}
.record-row strong.plus {
  color: var(--accent-green);
  font-family: var(--font-mono);
}
.record-row strong.minus {
  color: var(--accent-rose);
  font-family: var(--font-mono);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 240px 1fr;
  }
  .chat-layout {
    grid-template-columns: 1fr;
  }
  .quick-panel {
    display: none;
  }
  .article-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .auth-showcase {
    min-height: auto;
    padding: 24px;
  }
  .radar-card {
    height: 260px;
  }
  .workspace, .split-grid, .profile-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: auto;
    padding: 14px;
    grid-template-rows: auto auto;
  }
  .nav-list {
    grid-template-columns: repeat(4, 1fr);
  }
  .nav-item {
    text-align: center;
    padding: 10px 6px;
    font-size: 12px;
  }
  .nav-item::before {
    display: none;
  }
  .nav-icon {
    display: block;
    margin: 0 auto 4px;
  }
  .account-mini, .side-status {
    display: none;
  }
  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .global-search {
    width: 100%;
  }
  .insight-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .main {
    padding: 16px;
  }
  .article-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .auth-panel {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }
  .nav-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }
  .composer {
    grid-template-columns: 1fr;
  }
  .insight-strip {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}
