/* ═══════════════════════════════════════════════════════════
   AURALIS — style.css · Production v2.0
   Premium dark abstract AI aesthetic
═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────
   DESIGN TOKENS
───────────────────────────────────────── */
:root {
  /* Surface palette */
  --void:      #08080a;
  --surface-0: #0d0d10;
  --surface-1: #131318;
  --surface-2: #1a1a22;
  --surface-3: #22222e;

  /* Borders */
  --border:     rgba(255,255,255,0.06);
  --border-mid: rgba(255,255,255,0.10);
  --border-hi:  rgba(255,255,255,0.18);

  /* Text */
  --text-0: #f0eee8;
  --text-1: #a09d96;
  --text-2: #5e5b56;
  --text-3: #3a3835;

  /* Brand accents */
  --acid:   #c8ff57;
  --plasma: #7b6fff;
  --ember:  #ff5c38;
  --ice:    #57d4ff;
  --mist:   rgba(123,111,255,0.12);

  /* Risk levels */
  --risk-safe:    #4ade80;
  --risk-medium:  #fbbf24;
  --risk-high:    #f87171;
  --risk-blocked: #ff5c38;

  /* Layout — fluid, clamp-based */
  --sidebar-w: clamp(180px, 15vw, 240px);
  --right-w:   clamp(220px, 18vw, 280px);
  --radius:    12px;
  --radius-sm: 7px;

  /* Typography */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-ui:      'Syne', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-ui);
  background: var(--void);
  color: var(--text-0);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Allow body scroll when landing page is visible on mobile */
body.auth-visible {
  overflow-y: auto;
}
body.auth-visible .app {
  overflow: hidden;
}

button {
  font-family: var(--font-ui);
  cursor: pointer;
}

/* Focus-visible outline for keyboard nav — WCAG 2.1 AA compliant */
:focus-visible {
  outline: 2px solid var(--plasma);
  outline-offset: 3px;
  border-radius: 4px;
  box-shadow: 0 0 0 4px rgba(123,111,255,0.18);
}

/* Ensure interactive elements that are hidden from mouse still show focus */
button:focus-visible,
[tabindex]:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--plasma);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(123,111,255,0.18);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* ─────────────────────────────────────────
   ABSTRACT BACKGROUND
───────────────────────────────────────── */
.scene-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.scene-bg--auth {
  position: fixed;
  pointer-events: none;
}

/* Fine grain noise texture */
.scene-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScyNTYnIGhlaWdodD0nMjU2Jz48ZmlsdGVyIGlkPSduJz48ZmVUdXJidWxlbmNlIHR5cGU9J2ZyYWN0YWxOb2lzZScgYmFzZUZyZXF1ZW5jeT0nMC44NScgbnVtT2N0YXZlcz0nNCcgc3RpdGNoVGlsZXM9J3N0aXRjaCcvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPScxMDAlJyBoZWlnaHQ9JzEwMCUnIGZpbHRlcj0ndXJsKCNuKScgb3BhY2l0eT0nMC4wNicvPjwvc3ZnPg==");
  background-size: 180px 180px;
  opacity: 0.55;
  mix-blend-mode: screen;
}

/* Plasma orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(24px);
  will-change: transform;
  transform: translateZ(0);
  contain: layout style;
}

.orb-1 {
  width: 640px; height: 640px;
  top: -220px; right: -120px;
  background: radial-gradient(circle at 40% 40%,
    rgba(123,111,255,0.22) 0%,
    rgba(87,212,255,0.08) 45%,
    transparent 70%);
  animation: orbA 28s ease-in-out infinite alternate;
}

.orb-2 {
  width: 480px; height: 480px;
  bottom: -120px; left: -100px;
  background: radial-gradient(circle at 60% 55%,
    rgba(87,212,255,0.14) 0%,
    rgba(123,111,255,0.05) 50%,
    transparent 75%);
  animation: orbB 34s ease-in-out infinite alternate-reverse;
}

.orb-3 {
  width: 320px; height: 320px;
  top: 38%; left: 38%;
  background: radial-gradient(circle,
    rgba(200,255,87,0.07) 0%,
    rgba(255,92,56,0.03) 50%,
    transparent 70%);
  opacity: 0.6;
}

/* Geometric grid overlay */
.grid-lines {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc4MCcgaGVpZ2h0PSc4MCc+PHBhdGggZD0nTTgwIDAgTDAgMCAwIDgwJyBmaWxsPSdub25lJyBzdHJva2U9J3JnYmEoMjU1LDI1NSwyNTUsMC4wMTgpJyBzdHJva2Utd2lkdGg9JzEnLz48L3N2Zz4=");
  background-size: 80px 80px;
}

/* Diagonal lines overlay */
.diag-lines {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxMjAnIGhlaWdodD0nMTIwJz48bGluZSB4MT0nMCcgeTE9JzEyMCcgeDI9JzEyMCcgeTI9JzAnIHN0cm9rZT0ncmdiYSgyNTUsMjU1LDI1NSwwLjAxMiknIHN0cm9rZS13aWR0aD0nMScvPjwvc3ZnPg==");
  background-size: 120px 120px;
  opacity: 0.7;
}

@keyframes orbA {
  0%   { transform: translate(0,0) scale(1); }
  33%  { transform: translate(50px,-35px) scale(1.06); }
  66%  { transform: translate(-25px,45px) scale(0.94); }
  100% { transform: translate(35px,20px) scale(1.04); }
}
@keyframes orbB {
  0%   { transform: translate(0,0) scale(1.02); }
  40%  { transform: translate(-40px,30px) scale(0.96); }
  100% { transform: translate(30px,-40px) scale(1.05); }
}

/* ─────────────────────────────────────────
   UTILITY
───────────────────────────────────────── */
.hidden { display: none !important; }

/* ─────────────────────────────────────────
   ANIMATIONS
───────────────────────────────────────── */
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes pulse    { 0%,100%{opacity:1} 50%{opacity:0.4} }
@keyframes blink    { 0%,100%{opacity:1} 50%{opacity:0} }
@keyframes slideUp  {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn  {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes fadeIn   {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes chatDot  {
  0%,80%,100% { transform: scale(0.6); opacity: 0.4; }
  40%         { transform: scale(1);   opacity: 1; }
}
@keyframes pulse-blocked {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,92,56,0.4); }
  50%     { box-shadow: 0 0 0 6px rgba(255,92,56,0); }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
@keyframes glow-pulse {
  0%,100% { box-shadow: 0 0 8px rgba(123,111,255,0.2); }
  50%     { box-shadow: 0 0 20px rgba(123,111,255,0.45); }
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}
@keyframes installSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ─────────────────────────────────────────
   AUTH SCREEN
───────────────────────────────────────── */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--void);
  animation: fadeIn 0.4s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.auth-card {
  position: relative;
  width: min(420px, calc(100vw - 40px));
  background: var(--surface-1);
  border: 1px solid var(--border-mid);
  border-radius: 20px;
  padding: 44px 40px 40px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 40px 120px rgba(0,0,0,0.6),
    0 0 80px rgba(123,111,255,0.08);
  animation: scaleIn 0.5s var(--ease-out);
  transition: box-shadow 0.4s;
}
.auth-card:hover {
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 40px 120px rgba(0,0,0,0.65),
    0 0 100px rgba(123,111,255,0.13);
}

/* Auth logo — uses 512x512 image */
.auth-logo-mark {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--plasma), var(--acid));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(123,111,255,0.3);
  animation: glow-pulse 3s ease-in-out infinite;
}
.auth-logo-img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.auth-logo-mark svg { width: 22px; height: 22px; color: #000; }

.auth-glow {
  position: absolute;
  top: -80px; left: 50%; transform: translateX(-50%);
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(123,111,255,0.3) 0%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}


.auth-logo-text {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-0);
}

.auth-logo-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--acid);
  background: rgba(200,255,87,0.1);
  border: 1px solid rgba(200,255,87,0.2);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 2px;
}

.auth-heading {
  font-family: var(--font-display);
  font-size: 32px;
  font-style: italic;
  color: var(--text-0);
  margin-bottom: 8px;
  line-height: 1.15;
}

.auth-sub {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.6;
  margin-bottom: 32px;
  font-weight: 400;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--text-2);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  background: var(--surface-2);
  color: var(--text-0);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s var(--ease-out);
  margin-bottom: 10px;
}
.btn-oauth:hover {
  background: var(--surface-3);
  border-color: var(--border-hi);
  transform: translateY(-1px);
}
.btn-oauth:active { transform: translateY(0) scale(0.99); }
.btn-oauth svg { width: 18px; height: 18px; flex-shrink: 0; }

.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  color: var(--text-1);
  font-size: 13px;
}

.auth-terms {
  font-size: 11px;
  color: var(--text-2);
  text-align: center;
  margin-top: 20px;
  line-height: 1.6;
}

.spin-sm {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--acid);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─────────────────────────────────────────
   APP LAYOUT — fluid grid
───────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--right-w);
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
  animation: fadeIn 0.3s ease;
}
.app.no-right {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

/* ─────────────────────────────────────────
   LEFT SIDEBAR
───────────────────────────────────────── */
.sidebar {
  background: var(--surface-0);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
  min-height: 0;
}

.sidebar-scroll-zone {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
  min-height: 0;
}

.sidebar-brand {
  padding: 18px 14px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* Accent bar on brand */
.sidebar-brand::after {
  content: '';
  position: absolute;
  left: 0; top: 18px; bottom: 14px;
  width: 2px;
  background: linear-gradient(to bottom, var(--plasma), transparent);
  border-radius: 1px;
  opacity: 0.5;
}

.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--plasma), var(--acid));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 16px; height: 16px; color: #000; }

.brand-mark--sm {
  width: 28px; height: 28px;
  border-radius: 7px;
}
.brand-mark--sm svg { width: 14px; height: 14px; }

.brand-wordmark {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-0);
}

.brand-beta {
  display: block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--acid);
  background: rgba(200,255,87,0.1);
  border: 1px solid rgba(200,255,87,0.2);
  border-radius: 3px;
  padding: 1px 5px;
  margin-top: 1px;
}

/* Nav */
.sidebar-nav {
  padding: 10px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 9px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-1);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  letter-spacing: 0.01em;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text-0); }
.nav-item.active { background: rgba(123,111,255,0.12); color: var(--plasma); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 2px; height: 16px;
  background: var(--plasma);
  border-radius: 1px;
  box-shadow: 0 0 8px var(--plasma);
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Sessions */
.sidebar-sessions { padding: 0 8px; flex-shrink: 0; }

.sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 6px;
}

.sessions-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.btn-new-session {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--text-2);
  background: none;
  border: 1px solid var(--border);
  padding: 3px 7px;
  border-radius: 5px;
  transition: border-color 0.15s, color 0.15s;
  font-weight: 600;
}
.btn-new-session:hover { border-color: var(--border-mid); color: var(--text-0); }

.session-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 1px;
  border: 1px solid transparent;
}
.session-item:hover { background: var(--surface-2); }
.session-item.active { background: var(--surface-2); border-color: var(--border); }

.session-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  transition: box-shadow 0.2s;
}
.session-item:hover .session-dot { box-shadow: 0 0 6px currentColor; }

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

.session-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-meta {
  font-size: 10px;
  color: var(--text-2);
  margin-top: 1px;
  display: flex;
  gap: 6px;
}

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

.user-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.user-card:hover { background: var(--surface-2); }

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--plasma), var(--acid));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.user-info { min-width: 0; flex: 1; }
.user-name  { font-size: 12px; font-weight: 600; color: var(--text-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-tier  { font-size: 10px; color: var(--acid); font-weight: 600; }

.btn-signout {
  background: none;
  border: none;
  color: var(--text-2);
  padding: 4px;
  border-radius: 5px;
  transition: color 0.15s;
  display: flex;
}
.btn-signout:hover { color: var(--risk-high); }
.btn-signout svg { width: 14px; height: 14px; }

/* ─────────────────────────────────────────
   MAIN CANVAS
───────────────────────────────────────── */
.canvas {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: transparent;
}

.canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,8,10,0.95);
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
  gap: 8px;
}

.canvas-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
}
.panel-breadcrumb svg { width: 14px; height: 14px; }

.safe-mode-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border-mid);
  background: var(--surface-1);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-0);
  transition: border-color 0.15s;
  letter-spacing: 0.02em;
}
.safe-mode-btn:hover { border-color: var(--border-hi); }

.safe-mode-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  transition: box-shadow 0.3s;
}
.safe-mode-dot--strict     { background: var(--risk-high);   box-shadow: 0 0 6px var(--risk-high); }
.safe-mode-dot--balanced   { background: var(--risk-medium); box-shadow: 0 0 6px var(--risk-medium); }
.safe-mode-dot--permissive { background: var(--risk-safe);   box-shadow: 0 0 6px var(--risk-safe); }

.model-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-1);
}

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

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

.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-1);
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { border-color: var(--border-mid); color: var(--text-0); }
.icon-btn svg { width: 15px; height: 15px; }

/* ─────────────────────────────────────────
   PANEL SYSTEM
───────────────────────────────────────── */
.panel-view {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  animation: panelIn 0.22s var(--ease-out);
}
.panel-view.active { display: flex; }

/* ─────────────────────────────────────────
   CANVAS CONTENT (Analyzer panel)
───────────────────────────────────────── */
.canvas-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 22px 120px;
  position: relative;
  z-index: 2;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

/* Hero */
.canvas-hero {
  padding: 44px 0 30px;
  text-align: center;
}

.canvas-hero h2 {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 400;
  font-style: italic;
  color: var(--text-0);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 10px;
}

.canvas-hero h2 span {
  background: linear-gradient(90deg, var(--plasma), var(--acid));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.canvas-hero .tagline {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.hero-divider {
  width: 40px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--plasma), transparent);
  margin: 16px auto 0;
}

/* ─────────────────────────────────────────
   CARDS — shared elevated shadow
───────────────────────────────────────── */
.input-card,
.thinking-card,
.result-card,
.sandbox-output-card {
  box-shadow:
    0 4px 24px rgba(0,0,0,0.3),
    0 0 0 1px rgba(255,255,255,0.03);
}

/* ─────────────────────────────────────────
   INPUT CARD
───────────────────────────────────────── */
.input-card {
  background: rgba(19,19,24,0.98);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}
.input-card:focus-within { border-color: rgba(123,111,255,0.3); }

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

.input-card-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.code-editor-wrap {
  background: #0a0a0e;
  border-radius: 9px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid var(--border);
}

.editor-lang-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: rgba(255,255,255,0.3);
}

.lang-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #f7df1e;
}
.lang-dot--js { background: #f7df1e; }

.editor-btns {
  display: flex;
  align-items: center;
  gap: 5px;
}

.editor-btn {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: rgba(255,255,255,0.3);
  font-family: var(--font-mono);
  transition: border-color 0.15s, color 0.15s;
}
.editor-btn:hover { border-color: rgba(255,255,255,0.18); color: rgba(255,255,255,0.7); }

.code-textarea {
  display: block;
  width: 100%;
  min-height: 140px;
  max-height: 340px;
  padding: 14px 16px;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: #cdd6f4;
  caret-color: var(--acid);
}
.code-textarea::placeholder { color: rgba(255,255,255,0.15); }

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.input-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-select {
  font-size: 11px;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 8px;
  font-family: var(--font-ui);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.lang-select:focus { border-color: rgba(123,111,255,0.4); }

.char-count {
  font-size: 10px;
  color: var(--text-2);
  font-family: var(--font-mono);
}

.input-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.btn-clear {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, color 0.15s;
}
.btn-clear:hover { border-color: var(--border-mid); color: var(--text-0); }

.btn-analyze {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--acid);
  border: none;
  color: #000;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: background 0.2s, transform 0.2s, box-shadow 0.3s;
  box-shadow: 0 0 0 0 rgba(200,255,87,0);
}
.btn-analyze:hover {
  background: #d4ff6a;
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(200,255,87,0.25);
}
.btn-analyze:active  { transform: translateY(0) scale(0.98); }
.btn-analyze.loading { opacity: 0.7; cursor: wait; }
.btn-analyze svg { width: 14px; height: 14px; }

/* ─────────────────────────────────────────
   THINKING CARD
───────────────────────────────────────── */
.thinking-card {
  background: rgba(19,19,24,0.98);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  display: none;
  animation: slideUp 0.3s var(--ease-out);
}
.thinking-card.visible { display: block; }

.thinking-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.thinking-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.thinking-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(200,255,87,0.15);
  border-top-color: var(--acid);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.thinking-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  opacity: 0.25;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: translateY(4px);
}
.thinking-step.active { opacity: 1; transform: translateY(0); }
.thinking-step.done   { opacity: 0.6; transform: translateY(0); }

.step-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color 0.3s, background 0.3s;
}
.thinking-step.active .step-icon {
  border-color: rgba(123,111,255,0.4);
  background: rgba(123,111,255,0.12);
}
.thinking-step.done .step-icon {
  border-color: rgba(74,222,128,0.3);
  background: rgba(74,222,128,0.08);
}

.step-body { min-width: 0; }
.step-title { font-size: 12px; font-weight: 600; color: var(--text-0); margin-bottom: 2px; }
.step-desc  { font-size: 11px; color: var(--text-1); line-height: 1.4; }

/* Instant ack */
.instant-ack {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(200,255,87,0.05);
  border: 1px solid rgba(200,255,87,0.12);
  border-radius: 7px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-1);
}

.instant-ack-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 6px var(--acid);
  flex-shrink: 0;
  animation: pulse 1.2s ease-in-out infinite;
}

/* Analysis progress bar (inside thinking card) */
.analysis-progress-wrap {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.analysis-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
}
.analysis-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent, #7c6dfa), #a78bfa);
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}
.analysis-stage-msg {
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.02em;
  min-height: 14px;
}

/* Stream thoughts */
.stream-thoughts-wrap {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(10,10,14,0.8);
  border-radius: 9px;
  border: 1px solid var(--border);
  display: none;
}
.stream-thoughts-wrap.visible { display: block; }

.stream-thoughts-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}

.stream-thoughts-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.6;
  min-height: 20px;
  word-break: break-all;
  white-space: pre-wrap;
}

.stream-cursor {
  display: inline-block;
  width: 7px; height: 13px;
  background: var(--acid);
  border-radius: 1px;
  animation: blink 0.9s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 1px;
}

/* ─────────────────────────────────────────
   RESULT CARD
───────────────────────────────────────── */
.result-card {
  background: rgba(19,19,24,0.98);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  display: none;
  animation: slideUp 0.35s var(--ease-out);
}
.result-card.visible { display: block; }

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.result-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 6px;
  color: var(--text-1);
  transition: border-color 0.15s, color 0.15s;
}
.result-btn:hover { border-color: var(--border-mid); color: var(--text-0); }
.result-btn svg { width: 13px; height: 13px; }

.result-code-wrap {
  background: #0a0a0e;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.result-code-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid var(--border);
}

.result-lang-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: rgba(255,255,255,0.3);
}

.result-line-count {
  font-size: 10px;
  font-family: var(--font-mono);
  color: rgba(255,255,255,0.25);
}

.result-code-body {
  display: flex;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
}

.line-nums {
  padding: 14px 12px 14px 14px;
  color: rgba(255,255,255,0.18);
  font-size: 12px;
  font-family: var(--font-mono);
  line-height: 1.7;
  user-select: none;
  text-align: right;
  min-width: 32px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}

.result-code-content {
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #cdd6f4;
  white-space: pre;
  overflow-x: auto;
  flex: 1;
}

/* Explanation */
.explanation-section {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.explanation-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 10px;
}

.explanation-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.explanation-list li {
  font-size: 12.5px;
  color: var(--text-1);
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
}
.explanation-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--plasma);
  font-size: 11px;
}

/* ─────────────────────────────────────────
   SANDBOX OUTPUT (canvas panel)
───────────────────────────────────────── */
.sandbox-output-card {
  background: rgba(19,19,24,0.98);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: none;
  animation: slideUp 0.3s var(--ease-out);
}
.sandbox-output-card.visible { display: block; }

.sandbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sandbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}
.sandbox-label svg { width: 13px; height: 13px; }

.exec-time {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
}

.sandbox-output-pre {
  background: #0a0a0e;
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--risk-safe);
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--border);
  max-height: 200px;
  overflow-y: auto;
}
.sandbox-output-pre.error { color: var(--risk-high); }

/* ─────────────────────────────────────────
   ACTION BAR (floating)
───────────────────────────────────────── */
.action-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(calc(-50% + var(--sidebar-w)/2 - var(--right-w)/2));
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a1a22;
  border: 1px solid var(--border-mid);
  border-radius: 100px;
  padding: 7px 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.04);
  transition: bottom 0.2s;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: var(--text-1);
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.action-btn:hover           { background: var(--surface-2); color: var(--text-0); }
.action-btn:disabled        { opacity: 0.35; cursor: not-allowed; }
.action-btn--primary        { background: var(--plasma); color: #fff; font-weight: 600; }
.action-btn--primary:hover:not(:disabled) { background: #8f84ff; }
.action-btn svg { width: 14px; height: 14px; }

.action-sep {
  width: 1px; height: 20px;
  background: var(--border);
}

/* ─────────────────────────────────────────
   RIGHT PANEL
───────────────────────────────────────── */
.right-panel {
  background: var(--surface-0);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.right-panel-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(123,111,255,0.06), transparent);
}

.right-panel-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}

.right-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

/* Safety gate */
.safety-gate {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
}

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

.safety-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.safety-status--pending  .safety-indicator { background: var(--text-3); }
.safety-status--safe     .safety-indicator { background: var(--risk-safe);    box-shadow: 0 0 8px var(--risk-safe); }
.safety-status--medium   .safety-indicator { background: var(--risk-medium);  box-shadow: 0 0 8px var(--risk-medium);  animation: pulse 1.5s infinite; }
.safety-status--high     .safety-indicator { background: var(--risk-high);    box-shadow: 0 0 8px var(--risk-high);    animation: pulse 1s infinite; }
.safety-status--blocked  .safety-indicator { background: var(--risk-blocked); box-shadow: 0 0 10px var(--risk-blocked); animation: pulse-blocked 1.2s ease-in-out infinite; }

.safety-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.3s;
}
.safety-status--pending  .safety-label { color: var(--text-2); }
.safety-status--safe     .safety-label { color: var(--risk-safe); }
.safety-status--medium   .safety-label { color: var(--risk-medium); }
.safety-status--high     .safety-label { color: var(--risk-high); }
.safety-status--blocked  .safety-label { color: var(--risk-blocked); }

.safety-desc {
  font-size: 11px;
  color: var(--text-1);
  line-height: 1.5;
}

.btn-run-sandbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin-top: 12px;
  padding: 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-0);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.18s, color 0.18s;
}
.btn-run-sandbox:hover:not(:disabled) { border-color: var(--plasma); color: var(--plasma); }
.btn-run-sandbox:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-run-sandbox svg { width: 13px; height: 13px; }

/* Analysis layers */
.analysis-card {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.analysis-card-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}

.layer-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.layer-row:last-child { border-bottom: none; }

.layer-key {
  font-size: 10.5px;
  color: var(--text-2);
  font-weight: 500;
  flex-shrink: 0;
}

.layer-val {
  font-size: 11px;
  color: var(--text-0);
  font-weight: 600;
  text-align: right;
}

/* Risks */
.risks-card {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.risks-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}

.risks-list { padding: 6px 0; }

.risk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  gap: 6px;
  animation: slideUp 0.2s var(--ease-out);
}

.risk-label-text {
  font-size: 11px;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.risk-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.risk-badge.low    { background: rgba(74,222,128,0.12);  color: var(--risk-safe);    border: 1px solid rgba(74,222,128,0.2); }
.risk-badge.medium { background: rgba(251,191,36,0.12);  color: var(--risk-medium);  border: 1px solid rgba(251,191,36,0.2); }
.risk-badge.high   { background: rgba(248,113,113,0.12); color: var(--risk-high);    border: 1px solid rgba(248,113,113,0.2); }

.risks-empty {
  font-size: 11px;
  color: var(--text-2);
  padding: 10px 12px;
  font-style: italic;
}

/* Context card */
.context-card {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.context-card-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}

.context-list { list-style: none; }

.context-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.context-row--last { border-bottom: none; }

.context-key { font-size: 10px; color: var(--text-2); }
.context-val {
  font-size: 10.5px; color: var(--text-1); text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}

/* ─────────────────────────────────────────
   MODAL
───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }

.modal {
  background: var(--surface-1);
  border: 1px solid var(--border-mid);
  border-radius: 16px;
  padding: 28px;
  width: 360px;
  box-shadow: 0 40px 120px rgba(0,0,0,0.6);
  animation: slideUp 0.25s var(--ease-out);
}

.modal h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-style: italic;
  color: var(--text-0);
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.5;
  margin-bottom: 20px;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.mode-option:hover           { border-color: var(--border-mid); background: var(--surface-2); }
.mode-option--selected,
.mode-option.selected        { border-color: rgba(123,111,255,0.4); background: rgba(123,111,255,0.08); }

.mode-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mode-dot--strict     { background: var(--risk-high);   box-shadow: 0 0 8px var(--risk-high); }
.mode-dot--balanced   { background: var(--risk-medium); box-shadow: 0 0 8px var(--risk-medium); }
.mode-dot--permissive { background: var(--risk-safe);   box-shadow: 0 0 8px var(--risk-safe); }

.mode-label { font-size: 13px; font-weight: 600; color: var(--text-0); }
.mode-hint  { font-size: 11px; color: var(--text-1); margin-top: 2px; }

.modal-footer {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.btn-modal {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
  border: 1px solid var(--border);
}
.btn-modal--secondary          { background: transparent; color: var(--text-1); }
.btn-modal--secondary:hover    { background: var(--surface-2); color: var(--text-0); }
.btn-modal--primary            { background: var(--acid); border-color: var(--acid); color: #000; }
.btn-modal--primary:hover      { background: #d4ff6a; }

/* ─────────────────────────────────────────
   TOAST
───────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface-1);
  border: 1px solid var(--border-mid);
  color: var(--text-0);
  font-size: 12.5px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 100px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s var(--ease-spring);
  pointer-events: none;
  z-index: 300;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─────────────────────────────────────────
   CHAT PANEL
───────────────────────────────────────── */
.chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.chat-welcome {
  text-align: center;
  padding: 48px 24px;
  opacity: 0.85;
}
.chat-welcome h3 {
  font-family: var(--font-display);
  font-size: 34px;
  font-style: italic;
  color: var(--text-0);
  margin-bottom: 8px;
}
.chat-welcome p {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.6;
  max-width: 340px;
  margin: 0 auto 24px;
}
.chat-welcome-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.chat-chip {
  font-size: 11.5px;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: 100px;
  padding: 6px 14px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chat-chip:hover { background: var(--surface-3); border-color: var(--border-hi); color: var(--text-0); }

.chat-msg {
  display: flex;
  gap: 10px;
  animation: slideUp 0.25s var(--ease-out);
}
.chat-msg.user { flex-direction: row-reverse; }

.chat-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.chat-msg.user .chat-avatar {
  background: linear-gradient(135deg, var(--plasma), var(--acid));
  color: #000;
}
.chat-msg.ai .chat-avatar {
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  color: var(--plasma);
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.chat-bubble {
  max-width: 72%;
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.65;
}
.chat-msg.user .chat-bubble {
  background: var(--plasma);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.ai .chat-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  border-bottom-left-radius: 4px;
}
.chat-bubble code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(0,0,0,0.3);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--acid);
}
.chat-bubble pre {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(0,0,0,0.4);
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin-top: 8px;
  border: 1px solid var(--border);
  color: #cdd6f4;
  white-space: pre-wrap;
}

.chat-thinking {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 11px 15px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}
.chat-thinking-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-2);
  animation: chatDot 1.4s ease-in-out infinite;
}
.chat-thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-thinking-dot:nth-child(3) { animation-delay: 0.4s; }

.chat-input-area {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: rgba(8,8,10,0.95);
}
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface-1);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color 0.2s;
}
.chat-input-row:focus-within { border-color: rgba(123,111,255,0.4); }
.chat-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--text-0);
  line-height: 1.55;
  min-height: 22px;
  max-height: 120px;
  caret-color: var(--acid);
}
.chat-textarea::placeholder { color: var(--text-3); }
.chat-send-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--plasma);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.chat-send-btn:hover           { background: #8f84ff; }
.chat-send-btn:active          { transform: scale(0.95); }
.chat-send-btn:disabled        { opacity: 0.35; cursor: not-allowed; }
.chat-send-btn svg             { width: 14px; height: 14px; }

/* ─────────────────────────────────────────
   CODE PANEL
───────────────────────────────────────── */
.code-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.code-panel-main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  gap: 12px;
}
.code-editor-full {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0a0a0e;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}
.code-editor-full .code-textarea {
  flex: 1;
  min-height: 0;
  max-height: none;
  height: 100%;
  font-size: 13.5px;
}
.code-panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.code-panel-toolbar-left  { display: flex; align-items: center; gap: 8px; }
.code-panel-toolbar-right { display: flex; align-items: center; gap: 6px; }

.btn-code-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid var(--border-mid);
  background: var(--surface-2);
  color: var(--text-0);
}
.btn-code-action:hover                { background: var(--surface-3); border-color: var(--border-hi); }
.btn-code-action--primary             { background: var(--acid); border-color: var(--acid); color: #000; }
.btn-code-action--primary:hover       { background: #d4ff6a; }
.btn-code-action svg { width: 13px; height: 13px; }

.code-panel-output {
  background: #0a0a0e;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 160px;
}
.code-panel-output-header {
  padding: 7px 12px;
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid var(--border);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.code-panel-output-header svg { width: 12px; height: 12px; color: var(--risk-safe); }
.code-panel-output pre {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--risk-safe);
  line-height: 1.65;
  overflow-y: auto;
  max-height: 116px;
}

/* ─────────────────────────────────────────
   FILES PANEL
───────────────────────────────────────── */
.files-panel { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.files-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.files-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.files-search {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-0);
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.2s;
}
.files-search:focus          { border-color: rgba(123,111,255,0.4); }
.files-search::placeholder   { color: var(--text-3); }

.files-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  animation: slideUp 0.2s var(--ease-out);
}
.file-row:hover { background: var(--surface-2); border-color: var(--border-mid); }

.file-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.file-icon svg { width: 15px; height: 15px; }

.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13px; font-weight: 600; color: var(--text-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 10.5px; color: var(--text-2); margin-top: 2px; display: flex; gap: 8px; }

.file-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.file-badge.safe    { background: rgba(74,222,128,0.1);  color: var(--risk-safe);    border: 1px solid rgba(74,222,128,0.2); }
.file-badge.medium  { background: rgba(251,191,36,0.1);  color: var(--risk-medium);  border: 1px solid rgba(251,191,36,0.2); }
.file-badge.high    { background: rgba(248,113,113,0.1); color: var(--risk-high);    border: 1px solid rgba(248,113,113,0.2); }
.file-badge.blocked { background: rgba(255,92,56,0.1);   color: var(--ember);        border: 1px solid rgba(255,92,56,0.2); }

.files-empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-2);
}
.files-empty-state svg { width: 40px; height: 40px; opacity: 0.3; margin-bottom: 12px; }
.files-empty-state p   { font-size: 13px; }

/* ─────────────────────────────────────────
   MEMORY PANEL
───────────────────────────────────────── */
.memory-panel { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.memory-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.memory-section-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 4px 0 8px;
}

.memory-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.memory-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.memory-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-0);
  display: flex;
  align-items: center;
  gap: 6px;
}
.memory-card-title svg { width: 13px; height: 13px; color: var(--plasma); }

.memory-card-body { padding: 12px 14px; }

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

.memory-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.memory-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-0);
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 4px;
}
.memory-stat-label { font-size: 10px; color: var(--text-2); }

.mem-safe-dot { color: var(--risk-safe); }

.mem-context-list { list-style: none; font-size: 12px; color: var(--text-1); line-height: 1.7; }
.mem-context-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.mem-context-row--last { border-bottom: none; }
.mem-context-key { color: var(--text-2); }
.mem-context-val { color: var(--text-1); }

.memory-tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.memory-tag {
  font-size: 11px;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 10px;
}
.memory-tag--empty { color: var(--text-3); font-style: italic; }

.memory-clear-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(248,113,113,0.25);
  background: rgba(248,113,113,0.07);
  color: var(--risk-high);
  transition: background 0.15s;
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}
.memory-clear-btn:hover { background: rgba(248,113,113,0.14); }
.memory-clear-btn svg { width: 14px; height: 14px; }

/* ─────────────────────────────────────────
   TOOLS PANEL
───────────────────────────────────────── */
.tools-panel { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.tools-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

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

.tool-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  position: relative;
  overflow: hidden;
}
.tool-card:hover              { border-color: var(--border-mid); background: var(--surface-2); }
.tool-card--enabled           { border-color: rgba(123,111,255,0.3); }

.tool-card-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  font-size: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.tool-card-icon--analysis { background: rgba(123,111,255,0.15); border-color: rgba(123,111,255,0.25); }
.tool-card-icon--safety   { background: rgba(74,222,128,0.1);   border-color: rgba(74,222,128,0.2); }
.tool-card-icon--sandbox  { background: rgba(200,255,87,0.1);   border-color: rgba(200,255,87,0.2); }
.tool-card-icon--supabase { background: rgba(87,212,255,0.1);   border-color: rgba(87,212,255,0.2); }
.tool-card-icon--upload   { background: rgba(255,92,56,0.1);    border-color: rgba(255,92,56,0.2); }
.tool-card-icon--chat,
.tool-card-icon--optimizer,
.tool-card-icon--export   { background: rgba(123,111,255,0.08); }

.tool-card-name { font-size: 12.5px; font-weight: 700; color: var(--text-0); margin-bottom: 4px; }
.tool-card-desc { font-size: 11px; color: var(--text-2); line-height: 1.45; }

.tool-toggle {
  position: absolute;
  top: 10px; right: 10px;
  width: 28px; height: 16px;
  border-radius: 100px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}
.tool-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-3);
  transition: left 0.2s, background 0.2s, box-shadow 0.2s;
}
.tool-card--enabled .tool-toggle {
  background: rgba(123,111,255,0.3);
  border-color: rgba(123,111,255,0.5);
}
.tool-card--enabled .tool-toggle::after {
  left: 14px;
  background: var(--plasma);
  box-shadow: 0 0 6px var(--plasma);
}

/* ─────────────────────────────────────────
   SANDBOX PANEL
───────────────────────────────────────── */
.sandbox-panel { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.sandbox-panel-body {
  flex: 1;
  display: grid;
  grid-template-rows: 1fr 1fr;
  overflow: hidden;
  padding: 14px 20px;
  gap: 12px;
}

.sandbox-editor-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #0a0a0e;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  overflow: hidden;
}

.sandbox-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sandbox-editor-section textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: #cdd6f4;
  caret-color: var(--acid);
  min-height: 0;
}

.sandbox-output-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #0a0a0e;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sandbox-output-section pre {
  flex: 1;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--risk-safe);
  overflow-y: auto;
  min-height: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.sandbox-run-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--acid);
  border: none;
  color: #000;
  font-size: 11.5px;
  font-weight: 700;
  transition: background 0.15s, transform 0.1s;
}
.sandbox-run-btn:hover  { background: #d4ff6a; }
.sandbox-run-btn:active { transform: scale(0.97); }
.sandbox-run-btn svg    { width: 12px; height: 12px; }

/* ─────────────────────────────────────────
   SETTINGS PANEL
───────────────────────────────────────── */
.settings-panel { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.settings-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.settings-section {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-section-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--surface-2);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.settings-row:last-child { border-bottom: none; }

.settings-row-label  { font-size: 13px; font-weight: 500; color: var(--text-0); }
.settings-row-sub    { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.settings-row-sub--mono { font-family: var(--font-mono); font-size: 10px; }
.settings-row-grow   { flex: 1; }

.settings-account-info { flex: 1; min-width: 0; }

.settings-select {
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-0);
  font-family: var(--font-ui);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.settings-select:focus { border-color: rgba(123,111,255,0.4); }

.settings-toggle {
  width: 36px; height: 20px;
  border-radius: 100px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.settings-toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-3);
  transition: left 0.2s, background 0.2s, box-shadow 0.2s;
}
.settings-toggle--on,
.settings-toggle.on {
  background: rgba(123,111,255,0.3);
  border-color: rgba(123,111,255,0.5);
}
.settings-toggle--on::after,
.settings-toggle.on::after {
  left: 19px;
  background: var(--plasma);
  box-shadow: 0 0 6px var(--plasma);
}

.settings-danger-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(248,113,113,0.3);
  background: rgba(248,113,113,0.07);
  color: var(--risk-high);
  transition: background 0.15s;
}
.settings-danger-btn:hover { background: rgba(248,113,113,0.15); }
.settings-danger-btn svg { width: 13px; height: 13px; }

.settings-account-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--plasma), var(--acid));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
  overflow: hidden;
}
.settings-account-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ─────────────────────────────────────────
   NIXAI BADGE
───────────────────────────────────────── */
.nixai-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ice);
  background: rgba(87,212,255,0.08);
  border: 1px solid rgba(87,212,255,0.18);
  border-radius: 20px;
  padding: 2px 8px;
}
.nixai-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ice);
  box-shadow: 0 0 5px var(--ice);
}

/* ─────────────────────────────────────────
   MOBILE TOP BAR
───────────────────────────────────────── */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-0);
}

.mobile-menu-btn {
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border-mid);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-1);
  transition: background 0.15s;
}
.mobile-menu-btn:hover { background: var(--surface-3); }
.mobile-menu-btn svg { width: 16px; height: 16px; }

/* ─────────────────────────────────────────
   MOBILE BOTTOM NAV
───────────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(13,13,16,0.97);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding: 8px 4px max(env(safe-area-inset-bottom, 8px), 8px);
  gap: 0;
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}
.mobile-nav-item.active     { color: var(--plasma); }
.mobile-nav-item.active svg { color: var(--plasma); }
.mobile-nav-item svg { width: 18px; height: 18px; color: var(--text-2); transition: color 0.15s; }

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;
}
.sidebar-overlay.active { display: block; animation: fadeIn 0.2s ease; }

/* ════════════════════════════════════════
   RESPONSIVE — LARGE TABLET (≤1100px)
════════════════════════════════════════ */
@media (max-width: 1100px) {
  :root {
    --sidebar-w: clamp(160px, 14vw, 200px);
    --right-w:   clamp(200px, 17vw, 240px);
  }
}

/* ════════════════════════════════════════
   RESPONSIVE — TABLET (≤960px)
════════════════════════════════════════ */
@media (max-width: 960px) {
  :root {
    --sidebar-w: clamp(150px, 13vw, 190px);
    --right-w: clamp(180px, 16vw, 220px);
  }
}

/* ════════════════════════════════════════
   RESPONSIVE — MOBILE (≤768px)
════════════════════════════════════════ */
@media (max-width: 768px) {
  html, body { overflow: hidden; }

  .sidebar      { display: none !important; }
  .right-panel  { display: none !important; }

  .app {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr;
    height: 100dvh;
    overflow: hidden;
  }
  .app.no-right { grid-template-columns: 1fr !important; }

  .mobile-topbar      { display: flex; }
  .mobile-bottom-nav  { display: flex; }

  .canvas {
    height: calc(100dvh - 57px - 60px);
    overflow: hidden;
  }

  .canvas-header { padding: 8px 14px; flex-wrap: wrap; gap: 8px; }
  .canvas-header-left { gap: 7px; flex-wrap: wrap; }
  .safe-mode-btn { padding: 5px 10px; font-size: 11px; }
  .model-badge   { font-size: 10px; padding: 4px 9px; }

  .canvas-content { padding: 0 14px 120px; }
  .canvas-hero { padding: 24px 0 18px; }
  .canvas-hero h2 { font-size: 32px; }
  .canvas-hero .tagline { font-size: 12px; }

  .code-textarea   { min-height: 180px; max-height: 260px; font-size: 12px; }
  .result-code-body { max-height: 260px; }

  .action-bar {
    bottom: 70px;
    left: 14px; right: 14px;
    transform: none;
    border-radius: var(--radius);
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
  }
  .action-btn { font-size: 11px; padding: 6px 11px; }

  .thinking-steps { grid-template-columns: 1fr; }

  .input-card   { padding: 12px; }
  .input-footer { flex-direction: column; gap: 10px; align-items: stretch; }
  .input-meta, .input-controls { justify-content: space-between; }
  .btn-analyze  { width: 100%; justify-content: center; padding: 12px; }

  .auth-card    { width: calc(100vw - 32px); padding: 32px 24px 28px; border-radius: 16px; }
  .auth-heading { font-size: 26px; }

  .settings-panel-body { padding: 12px; gap: 12px; }

  .tools-grid   { grid-template-columns: 1fr; }

  .sidebar.mobile-open {
    display: flex !important;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    z-index: 160;
    animation: slideInLeft 0.22s var(--ease-out);
  }

  .toast { bottom: 80px; }
}

/* ════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (≤420px)
════════════════════════════════════════ */
@media (max-width: 420px) {
  .canvas-hero h2 { font-size: 26px; }
  .model-badge    { display: none; }
  .header-actions { gap: 5px; }
  .icon-btn       { width: 30px; height: 30px; }
  .action-bar     { bottom: 68px; }
}

/* ═══════════════════════════════════════════════════════════
   AURALIS v2.1 UPGRADES — Intelligence Signals
   Auth proof grid · Live scanner · Confidence viz ·
   Sidebar system state · Nav dots · Trust signals
═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────
   AUTH PROOF GRID
───────────────────────────────────────── */
.auth-proof-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 28px;
}

.auth-proof-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  color: var(--text-1);
  line-height: 1.45;
  transition: border-color 0.2s, background 0.2s;
  animation: slideUp 0.5s var(--ease-out) both;
}
.auth-proof-item:nth-child(1) { animation-delay: 0.05s; }
.auth-proof-item:nth-child(2) { animation-delay: 0.10s; }
.auth-proof-item:nth-child(3) { animation-delay: 0.15s; }
.auth-proof-item:nth-child(4) { animation-delay: 0.20s; }
.auth-proof-item:hover {
  border-color: rgba(123,111,255,0.2);
  background: rgba(123,111,255,0.05);
}

.auth-proof-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--acid);
  opacity: 0.85;
}

/* ─────────────────────────────────────────
   SIDEBAR SYSTEM STATUS BAR
───────────────────────────────────────── */
.sidebar-sys-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px 5px;
  border-bottom: 1px solid var(--border);
  background: rgba(200,255,87,0.02);
}

.sys-bar-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 6px var(--acid);
  animation: pulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}
.sys-bar-dot--offline {
  background: var(--text-3);
  box-shadow: none;
  animation: none;
}
.sys-bar-dot--analyzing {
  background: var(--plasma);
  box-shadow: 0 0 8px var(--plasma);
  animation: pulse 0.9s ease-in-out infinite;
}

.sys-bar-label {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acid);
  opacity: 0.8;
  flex: 1;
}

.sys-bar-uptime {
  font-size: 8.5px;
  font-family: var(--font-mono);
  color: var(--text-3);
}

/* ─────────────────────────────────────────
   NAV STATE DOTS — system infrastructure feel
───────────────────────────────────────── */
.nav-state-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
  margin-left: auto;
  transition: background 0.3s, box-shadow 0.3s;
}

/* Active: acid green pulse — currently in use */
.nav-state--active {
  background: var(--acid);
  box-shadow: 0 0 5px var(--acid);
  animation: pulse 2s ease-in-out infinite;
}

/* Synced: dim green — data up to date */
.nav-state--synced {
  background: var(--risk-safe);
  opacity: 0.7;
}

/* Ready: plasma dim — standing by */
.nav-state--ready {
  background: var(--plasma);
  opacity: 0.5;
}

/* Idle: muted amber — available but unused */
.nav-state--idle {
  background: var(--risk-medium);
  opacity: 0.4;
}

/* Streaming: fast pulse */
.nav-state--streaming {
  background: var(--ice);
  box-shadow: 0 0 6px var(--ice);
  animation: pulse 0.7s ease-in-out infinite;
}

/* Analyzing: plasma fast pulse */
.nav-state--analyzing {
  background: var(--plasma);
  box-shadow: 0 0 8px var(--plasma);
  animation: pulse 0.8s ease-in-out infinite;
}

/* ─────────────────────────────────────────
   LIVE PRE-SCAN — signature interaction
───────────────────────────────────────── */
.live-scanner {
  background: rgba(10,10,14,0.6);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  transition: border-color 0.3s;
}

.live-scanner.scanner--active {
  border-color: rgba(123,111,255,0.2);
}

.live-scanner.scanner--risk-detected {
  border-color: rgba(248,113,113,0.25);
  background: rgba(248,113,113,0.03);
}

.live-scanner.scanner--clean {
  border-color: rgba(74,222,128,0.2);
  background: rgba(74,222,128,0.02);
}

.scanner-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

.scanner-pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.live-scanner.scanner--active   .scanner-pulse-dot { background: var(--plasma); box-shadow: 0 0 6px var(--plasma); animation: pulse 0.9s ease-in-out infinite; }
.live-scanner.scanner--risk-detected .scanner-pulse-dot { background: var(--risk-high); box-shadow: 0 0 7px var(--risk-high); animation: pulse 0.7s ease-in-out infinite; }
.live-scanner.scanner--clean    .scanner-pulse-dot { background: var(--risk-safe); box-shadow: 0 0 6px var(--risk-safe); }

.scanner-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.scanner-meta {
  font-size: 10px;
  color: var(--text-2);
  margin-left: auto;
  font-family: var(--font-mono);
}

.scanner-risk-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 7px;
  min-height: 0;
}
.scanner-risk-tags:empty { margin-bottom: 0; }

.scanner-risk-tag {
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid;
  animation: slideUp 0.18s var(--ease-out) both;
  letter-spacing: 0.02em;
}

.scanner-tag--high {
  background: rgba(248,113,113,0.1);
  color: var(--risk-high);
  border-color: rgba(248,113,113,0.25);
}

.scanner-tag--medium {
  background: rgba(251,191,36,0.08);
  color: var(--risk-medium);
  border-color: rgba(251,191,36,0.2);
}

.scanner-tag--low {
  background: rgba(74,222,128,0.07);
  color: var(--risk-safe);
  border-color: rgba(74,222,128,0.15);
}

.scanner-progress-track {
  height: 2px;
  background: rgba(255,255,255,0.05);
  border-radius: 1px;
  overflow: hidden;
}

.scanner-progress-fill {
  height: 100%;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--plasma), var(--acid));
  transition: width 0.3s var(--ease-out), background 0.4s;
  will-change: width;
}

.live-scanner.scanner--risk-detected .scanner-progress-fill {
  background: linear-gradient(90deg, var(--plasma), var(--risk-high));
}

.live-scanner.scanner--clean .scanner-progress-fill {
  background: linear-gradient(90deg, var(--plasma), var(--risk-safe));
}

/* ─────────────────────────────────────────
   CONFIDENCE VISUALIZATION CARD
───────────────────────────────────────── */
.confidence-viz-card {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  padding: 12px;
  transition: border-color 0.4s;
}

.confidence-viz-card.conf--high   { border-color: rgba(74,222,128,0.25); }
.confidence-viz-card.conf--medium { border-color: rgba(251,191,36,0.2); }
.confidence-viz-card.conf--low    { border-color: rgba(248,113,113,0.2); }

.conf-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.conf-card-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}

.conf-pct-label {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-0);
  transition: color 0.4s;
  letter-spacing: -0.02em;
}

.confidence-viz-card.conf--high   .conf-pct-label { color: var(--risk-safe); }
.confidence-viz-card.conf--medium .conf-pct-label { color: var(--risk-medium); }
.confidence-viz-card.conf--low    .conf-pct-label { color: var(--risk-high); }

.conf-track-outer {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.conf-track-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--plasma), var(--plasma));
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s;
  will-change: width;
}

.confidence-viz-card.conf--high   .conf-track-fill { background: linear-gradient(90deg, var(--plasma), var(--risk-safe)); }
.confidence-viz-card.conf--medium .conf-track-fill { background: linear-gradient(90deg, var(--plasma), var(--risk-medium)); }
.confidence-viz-card.conf--low    .conf-track-fill { background: linear-gradient(90deg, var(--plasma), var(--risk-high)); }

.conf-meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
}

.conf-meta-item {
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: var(--text-2);
}

.conf-meta-dot {
  font-size: 9px;
  color: var(--text-3);
}

.conf-rationale {
  font-size: 10.5px;
  color: var(--text-2);
  line-height: 1.5;
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 7px;
  min-height: 28px;
  transition: color 0.3s;
}

/* ─────────────────────────────────────────
   ORBS — Reduced ambient noise
   (toned down opacity, more precise)
───────────────────────────────────────── */
.orb-1 {
  opacity: 0.65 !important;
}
.orb-2 {
  opacity: 0.55 !important;
}
.orb-3 {
  opacity: 0.3 !important;
}

/* ─────────────────────────────────────────
   TRUST SIGNAL ENHANCEMENTS
───────────────────────────────────────── */

/* Reasoning step — enhanced active glow */
.thinking-step.active .step-icon {
  box-shadow: 0 0 12px rgba(123,111,255,0.3);
}
.thinking-step.active .step-title {
  color: var(--plasma);
}

/* Risk item — entrance animation */
.risk-item {
  opacity: 0;
  animation: slideUp 0.25s var(--ease-out) forwards;
}
.risk-item:nth-child(1) { animation-delay: 0.0s; }
.risk-item:nth-child(2) { animation-delay: 0.06s; }
.risk-item:nth-child(3) { animation-delay: 0.12s; }
.risk-item:nth-child(4) { animation-delay: 0.18s; }
.risk-item:nth-child(5) { animation-delay: 0.24s; }

/* Model badge — live indicator */
.model-dot {
  animation: pulse 3s ease-in-out infinite;
}

/* Stream thoughts — stronger visual weight */
.stream-thoughts-wrap {
  border-color: rgba(123,111,255,0.15);
  background: rgba(8,8,14,0.9);
}
.stream-thoughts-label {
  color: var(--plasma);
  opacity: 0.6;
}

/* ─────────────────────────────────────────
   INSTANT ACK — enhanced
───────────────────────────────────────── */
.instant-ack {
  border-left: 2px solid rgba(200,255,87,0.3);
  border-radius: 0 7px 7px 0;
}

/* ═══════════════════════════════════════════════════════════
   AURALIS v2.1 ENHANCEMENTS — Smoother UI & Animations
   Panel transitions · Button micro-interactions · Install PWA
═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────
   ENHANCED PANEL TRANSITIONS
───────────────────────────────────────── */
.panel-view {
  transition: opacity 0.18s var(--ease-out);
}
.panel-view.active {
  animation: panelIn 0.22s var(--ease-out);
}

/* ─────────────────────────────────────────
   SMOOTH CARD HOVER ELEVATIONS
───────────────────────────────────────── */
.input-card {
  transition: border-color 0.25s var(--ease-out), box-shadow 0.3s var(--ease-out), transform 0.2s var(--ease-out);
}
.input-card:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.35),
    0 0 0 1px rgba(255,255,255,0.04);
}

.result-card {
  transition: border-color 0.25s, box-shadow 0.3s;
}
.result-card.visible {
  animation: slideUp 0.35s var(--ease-out);
}

.thinking-card.visible {
  animation: slideDown 0.3s var(--ease-out);
}

/* ─────────────────────────────────────────
   BUTTON MICRO-INTERACTIONS
───────────────────────────────────────── */
.btn-analyze {
  position: relative;
  overflow: hidden;
}
.btn-analyze::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.3s;
}
.btn-analyze:hover::after {
  opacity: 1;
  animation: shimmer 1.2s ease-in-out infinite;
}

.nav-item {
  transition: background 0.15s, color 0.15s, transform 0.12s;
}
.nav-item:active { transform: scale(0.97); }

.btn-oauth {
  position: relative;
  overflow: hidden;
}
.btn-oauth::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(123,111,255,0.0) 0%, rgba(123,111,255,0.06) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}
.btn-oauth:hover::before { opacity: 1; }

/* ─────────────────────────────────────────
   SESSION ITEM — smoother hover
───────────────────────────────────────── */
.session-item {
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.session-item:active { transform: scale(0.99); }

/* ─────────────────────────────────────────
   TOOL CARD — hover lift
───────────────────────────────────────── */
.tool-card {
  transition: border-color 0.18s, background 0.18s, transform 0.15s, box-shadow 0.2s;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.tool-card:active { transform: translateY(0); }

/* ─────────────────────────────────────────
   FILE ROW — smoother hover
───────────────────────────────────────── */
.file-row {
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.file-row:hover { transform: translateX(2px); }

/* ─────────────────────────────────────────
   CHAT CHIPS — spring bounce
───────────────────────────────────────── */
.chat-chip {
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s var(--ease-spring);
}
.chat-chip:hover  { transform: translateY(-2px) scale(1.02); }
.chat-chip:active { transform: translateY(0) scale(0.98); }

/* ─────────────────────────────────────────
   RESULT BUTTONS — spring
───────────────────────────────────────── */
.result-btn {
  transition: border-color 0.15s, color 0.15s, transform 0.12s var(--ease-spring), background 0.15s;
}
.result-btn:hover  { transform: scale(1.08); }
.result-btn:active { transform: scale(0.95); }

/* ─────────────────────────────────────────
   SAFETY STATUS — smooth tier transitions
───────────────────────────────────────── */
.safety-status { transition: background 0.3s, border-color 0.3s; }
.safety-indicator { transition: background 0.4s, box-shadow 0.4s; }
.safety-label     { transition: color 0.35s; }

/* ─────────────────────────────────────────
   THINKING STEPS — stagger fade-in
───────────────────────────────────────── */
.thinking-step:nth-child(1) { transition-delay: 0ms; }
.thinking-step:nth-child(2) { transition-delay: 60ms; }
.thinking-step:nth-child(3) { transition-delay: 120ms; }
.thinking-step:nth-child(4) { transition-delay: 180ms; }

/* ─────────────────────────────────────────
   MODAL — smooth spring entrance
───────────────────────────────────────── */
.modal {
  animation: scaleIn 0.28s var(--ease-spring);
}

/* ─────────────────────────────────────────
   APP SHELL — subtle entrance
───────────────────────────────────────── */
.app {
  animation: fadeIn 0.35s ease;
}
.sidebar { animation: slideInLeft 0.3s var(--ease-out); }
.right-panel { animation: slideInRight 0.3s var(--ease-out); }

/* ─────────────────────────────────────────
   CONFIDENCE TRACK — smoother
───────────────────────────────────────── */
.conf-track-fill {
  transition: width 1.4s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s;
}

/* ─────────────────────────────────────────
   PWA INSTALL BANNER
───────────────────────────────────────── */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 400;
  padding: 12px 16px;
  background: var(--surface-1);
  border-top: 1px solid var(--border-mid);
  backdrop-filter: blur(12px);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.35s var(--ease-spring), opacity 0.3s ease;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
}
.install-banner--visible {
  transform: translateY(0);
  opacity: 1;
}

.install-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.install-banner-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.install-banner-text { flex: 1; min-width: 0; }
.install-banner-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 2px;
}
.install-banner-sub {
  font-size: 11px;
  color: var(--text-2);
}

.install-banner-btn {
  padding: 8px 18px;
  border-radius: 100px;
  background: var(--acid);
  border: none;
  color: #000;
  font-size: 12.5px;
  font-weight: 700;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.install-banner-btn:hover  { background: #d4ff6a; transform: scale(1.03); }
.install-banner-btn:active { transform: scale(0.97); }

.install-banner-dismiss {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 14px;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.install-banner-dismiss:hover { color: var(--text-0); }

@media (max-width: 768px) {
  .install-banner { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

/* ─────────────────────────────────────────
   GRANULAR PROGRESS INDICATOR
   Shows contextual analysis stage messages
───────────────────────────────────────── */
.analysis-progress-bar {
  height: 2px;
  background: var(--surface-3);
  border-radius: 1px;
  overflow: hidden;
  margin: 8px 0 4px;
}

.analysis-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--plasma), var(--acid));
  border-radius: 1px;
  transition: width 0.6s var(--ease-out), background 0.4s;
  position: relative;
}

/* Shimmer effect on active fill */
.analysis-progress-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.2s ease-in-out infinite;
}

.analysis-stage-msg {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--plasma);
  letter-spacing: 0.06em;
  min-height: 14px;
  transition: opacity 0.25s;
  opacity: 0.85;
}

.analysis-stage-msg::before {
  content: '▸ ';
  opacity: 0.5;
}

/* Stage progress inside the instant-ack block */
.instant-ack-progress {
  margin-top: 8px;
}

/* Pulsing indicator when streaming is active */
.stage-streaming .analysis-stage-msg {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ─────────────────────────────────────────
   ACCESSIBILITY ENHANCEMENTS
───────────────────────────────────────── */

/* Visually-hidden utility for screen-reader-only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip-to-content link for keyboard users */
.skip-link {
  position: fixed;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: var(--plasma);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 9999;
  text-decoration: none;
  transition: top 0.2s;
  white-space: nowrap;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid var(--acid);
  outline-offset: 2px;
}

/* Improve contrast of nav-item active state for a11y */
.nav-item.active {
  background: rgba(123,111,255,0.16);
  color: var(--plasma);
  font-weight: 600;
}

/* Modal role=dialog — trap focus indicator */
.modal-overlay:not(.hidden) .modal {
  outline: none; /* Remove default outline; we manage focus states */
}

/* Ensure disabled buttons are visually distinct */
button:disabled,
[aria-disabled="true"] {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}
/* Exception: we still want pointer on loading spinners */
.btn-analyze.loading { pointer-events: none; }

/* High-contrast mode support */
@media (forced-colors: active) {
  :focus-visible {
    outline: 3px solid ButtonText;
    box-shadow: none;
  }
  .model-dot, .sys-bar-dot, .scanner-pulse-dot {
    forced-color-adjust: none;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .orb-1, .orb-2 { animation: none !important; }
  .analysis-progress-fill::after { animation: none !important; }
}


/* ═══════════════════════════════════════════════════════════
   LANDING PAGE — Full marketing page above sign-in
═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────
   LANDING NAV
───────────────────────────────────────── */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(8,8,10,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  animation: slideDown 0.4s var(--ease-out);
}

.landing-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.auth-logo-mark--nav {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.landing-nav-name {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-0);
  letter-spacing: -0.01em;
}

.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.landing-nav-link {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
}
.landing-nav-link:hover { color: var(--text-0); }

.landing-nav-cta {
  padding: 7px 16px;
  border-radius: 100px;
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-0);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.landing-nav-cta:hover {
  background: var(--surface-2);
  border-color: var(--border-hi);
}

/* ─────────────────────────────────────────
   LANDING HERO
───────────────────────────────────────── */
.landing-hero {
  width: 100%;
  box-sizing: border-box;
  padding: 72px 24px 64px;
  text-align: center;
  animation: slideUp 0.6s var(--ease-out) 0.1s both;
}

.landing-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--plasma);
  background: rgba(123,111,255,0.1);
  border: 1px solid rgba(123,111,255,0.2);
  border-radius: 100px;
  padding: 6px 14px;
  margin-bottom: 28px;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acid);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.landing-hero-heading {
  font-family: var(--font-display);
  font-size: clamp(44px, 10vw, 88px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-0);
  margin-bottom: 24px;
}

.landing-hero-heading em {
  font-style: italic;
  color: var(--plasma);
}

.landing-hero-sub {
  font-family: var(--font-ui);
  font-size: clamp(14px, 3.5vw, 18px);
  line-height: 1.65;
  color: var(--text-1);
  max-width: 540px;
  margin: 0 auto 36px;
}

.landing-hero-sub strong { color: var(--text-0); font-weight: 600; }

.hero-br { display: none; }

.landing-hero-ctas {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  width: 100%;
}

.btn-hero-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 28px;
  border-radius: 100px;
  background: var(--acid);
  border: none;
  color: #000;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  width: 100%;
  max-width: 320px;
  transition: background 0.15s, transform 0.15s var(--ease-spring), box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(200,255,87,0.2);
}
.btn-hero-primary:hover {
  background: #d4ff6a;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 32px rgba(200,255,87,0.3);
}
.btn-hero-primary:active { transform: translateY(0) scale(0.98); }

.btn-hero-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 24px;
  border-radius: 100px;
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-0);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  width: 100%;
  max-width: 320px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-hero-secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-hi);
}

.landing-hero-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.trust-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.trust-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
}

.trust-sep { color: var(--text-3); }

/* ─────────────────────────────────────────
   DIVIDER BETWEEN SECTIONS
───────────────────────────────────────── */
.landing-divider {
  width: calc(100% - 48px);
  max-width: 880px;
  height: 1px;
  background: var(--border);
  margin: 0 auto;
}

/* ─────────────────────────────────────────
   LANDING HOW IT WORKS
───────────────────────────────────────── */
.landing-how {
  width: 100%;
  box-sizing: border-box;
  padding: 64px 24px;
  text-align: center;
  animation: slideUp 0.6s var(--ease-out) 0.2s both;
}

.landing-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acid);
  margin-bottom: 12px;
}

.landing-section-heading {
  font-family: var(--font-display);
  font-size: clamp(24px, 5vw, 42px);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-0);
  margin-bottom: 48px;
  letter-spacing: -0.01em;
}

.landing-steps-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
}

.landing-step {
  width: 100%;
  box-sizing: border-box;
  padding: 28px 24px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  transition: border-color 0.2s, transform 0.2s var(--ease-spring), box-shadow 0.2s;
}
.landing-step:hover {
  border-color: var(--border-hi);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.landing-step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.landing-step-icon {
  font-size: 22px;
  color: var(--plasma);
  margin-bottom: 10px;
  display: block;
}

.landing-step-title {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.landing-step-desc {
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-1);
}

/* Hide horizontal connectors on mobile-first layout */
.landing-step-connector { display: none; }

/* ─────────────────────────────────────────
   LANDING FEATURES GRID
───────────────────────────────────────── */
.landing-features {
  width: 100%;
  box-sizing: border-box;
  padding: 0 24px 64px;
  text-align: center;
  animation: slideUp 0.6s var(--ease-out) 0.3s both;
}

.landing-features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  text-align: left;
  max-width: 640px;
  margin: 0 auto;
}

.landing-feature-card {
  padding: 24px 20px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease-spring);
}
.landing-feature-card:hover {
  border-color: rgba(123,111,255,0.3);
  background: var(--surface-2);
  transform: translateY(-3px);
}

.feature-card-icon {
  font-size: 20px;
  color: var(--plasma);
  margin-bottom: 12px;
  display: block;
}

.landing-feature-card h3 {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.landing-feature-card p {
  font-family: var(--font-ui);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-1);
  margin: 0;
}

/* ─────────────────────────────────────────
   LANDING SIGNIN WRAP
───────────────────────────────────────── */
.landing-signin-wrap {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  padding: 40px 20px 64px;
  animation: slideUp 0.6s var(--ease-out) 0.4s both;
}

/* ─────────────────────────────────────────
   LANDING FOOTER
───────────────────────────────────────── */
.landing-footer {
  width: 100%;
  box-sizing: border-box;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.05em;
  flex-wrap: wrap;
  text-align: center;
}

.footer-sep { color: var(--text-3); }

/* ─────────────────────────────────────────
   LARGER SCREENS — tablet & desktop
───────────────────────────────────────── */
@media (min-width: 640px) {
  .landing-nav { padding: 14px 40px; }
  .landing-hero { padding: 96px 40px 80px; }
  .landing-hero-ctas { flex-direction: row; justify-content: center; }
  .btn-hero-primary, .btn-hero-secondary { width: auto; max-width: none; }
  .landing-how, .landing-features { padding: 72px 40px; }
  .landing-features { padding-top: 0; }
  .landing-features-grid { grid-template-columns: 1fr 1fr; max-width: 880px; }
  .landing-signin-wrap { padding: 40px 40px 80px; }
}

@media (min-width: 960px) {
  .landing-steps-row {
    flex-direction: row;
    align-items: flex-start;
    max-width: 880px;
    margin: 0 auto;
    gap: 0;
  }
  .landing-step { flex: 1; max-width: none; }
  .landing-step-connector {
    display: block;
    width: 40px;
    height: 1px;
    background: var(--border-mid);
    align-self: center;
    flex-shrink: 0;
    position: relative;
  }
  .landing-step-connector::after {
    content: '→';
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: var(--text-2);
  }
  .landing-features-grid { grid-template-columns: repeat(3, 1fr); max-width: 960px; }
}

/* ════════════════════════════════════════
   LANDING PAGE — MOBILE FIXES (≤640px)
   Fixes broken layout on mobile browsers
════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── NAV: hide text links, keep brand + sign in ── */
  .landing-nav {
    padding: 10px 16px;
    gap: 8px;
  }
  .landing-nav-link {
    display: none; /* hide How it works / Features links on tiny screens */
  }
  .landing-nav-actions {
    gap: 10px;
  }
  .landing-nav-cta {
    padding: 6px 14px;
    font-size: 12px;
  }
  .landing-nav-name {
    font-size: 14px;
  }

  /* ── HERO ── */
  .landing-hero {
    padding: 48px 20px 40px;
  }
  .landing-hero-heading {
    font-size: clamp(36px, 11vw, 52px);
    letter-spacing: -0.02em;
    word-break: break-word;
  }
  .landing-hero-sub {
    font-size: 14px;
    line-height: 1.6;
    max-width: 100%;
    margin-bottom: 28px;
  }
  .landing-hero-eyebrow {
    font-size: 9px;
    padding: 5px 12px;
    margin-bottom: 20px;
    white-space: normal;
    text-align: center;
  }
  .landing-hero-ctas {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 24px;
  }
  .btn-hero-primary,
  .btn-hero-secondary {
    width: 100%;
    max-width: 100%;
    padding: 13px 20px;
    font-size: 14px;
  }
  .landing-hero-trust {
    gap: 6px;
    font-size: 10px;
  }

  /* ── SECTION DIVIDER ── */
  .landing-divider {
    width: calc(100% - 32px);
  }

  /* ── HOW IT WORKS ── */
  .landing-how {
    padding: 48px 20px;
  }
  .landing-section-heading {
    font-size: clamp(22px, 6.5vw, 32px);
    margin-bottom: 32px;
    word-break: break-word;
  }
  .landing-steps-row {
    flex-direction: column;
    gap: 10px;
    max-width: 100%;
  }
  .landing-step {
    padding: 22px 18px;
    width: 100%;
  }
  .landing-step-connector {
    display: none; /* always hidden on mobile */
  }

  /* ── FEATURES ── */
  .landing-features {
    padding: 0 20px 48px;
  }
  .landing-features-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: 100%;
  }
  .landing-feature-card {
    padding: 20px 16px;
  }

  /* ── SIGN-IN CARD ── */
  .landing-signin-wrap {
    padding: 32px 16px 48px;
  }
  .auth-card {
    width: 100%;
    max-width: 100%;
    padding: 28px 20px 24px;
    border-radius: 16px;
    box-sizing: border-box;
  }
  .auth-heading {
    font-size: 24px;
  }
  .auth-sub {
    font-size: 12.5px;
  }
  .btn-oauth {
    font-size: 13.5px;
    padding: 12px 16px;
  }
  .auth-proof-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  /* ── FOOTER ── */
  .landing-footer {
    padding: 16px 20px;
    font-size: 10px;
    gap: 6px;
  }

  /* ── MOBILE SCROLL — allow landing page to scroll on small screens ── */
  body.auth-visible {
    overflow-y: auto;
    overflow-x: hidden;
  }
  body.auth-visible .app {
    overflow: hidden;
  }
  .auth-screen {
    position: relative; /* un-fix so body scroll drives it */
    min-height: 100vh;
    overflow: visible;
  }
}

