:root {
  /* 60-30-10 Color System (Light Theme) */
  --bg: #fafafa;             /* 60% Dominant Background */
  --surface: #ffffff;        /* 30% Secondary Surface */
  --surface2: #f4f4f5;       /* Zinc 100 - inner inputs/logs */
  --surface3: #e4e4e7;       /* Zinc 200 - hover / borders */
  
  --border: rgba(0, 0, 0, 0.06);   /* Translucent thin borders */
  --border2: rgba(0, 0, 0, 0.1);   /* Slightly darker borders */
  --border-focus: rgba(79, 70, 229, 0.4); /* Indigo border focus */
  
  --accent: #4f46e5;         /* 10% Accent (Royal Indigo) */
  --accent-rgb: 79, 70, 229;
  --accent-light: #818cf8;
  --accent-hover: #4338ca;
  --accent2: #e11d48;        /* Rose Red (Alert/Urgency) */
  
  /* Brand Psychology Status Indicators */
  --gold: #d97706;           /* Amber (Warning/Pending Review) */
  --teal: #0d9488;           /* Teal (Fact-checking/RAG) */
  --green: #059669;          /* Emerald Green (Success/Approved) */
  --red: #e11d48;            /* Red (Urgency/Fixes) */
  --blue: #2563eb;           /* Blue (Trust/Professionalism) */
  --orange: #ea580c;         /* Orange (Highlight) */
  
  /* Typography & Text hierarchy */
  --text: #09090b;           /* Slate 950 - high contrast charcoal headings */
  --text-secondary: #27272a; /* Slate 800 - body text */
  --muted: #71717a;          /* Slate 500 - meta labels */
  --muted2: #a1a1aa;         /* Slate 400 - secondary meta info */
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Courier New, monospace;
  
  --r: 10px;
  --r-lg: 14px;
  --r-sm: 6px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.03);

  /* Layout rhythm — 8px base, golden-ratio sidebar */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --page-padding: clamp(16px, 2.5vw, 28px);
  --sidebar-width: clamp(300px, 28vw, 380px);
  --header-height: 60px;
  --footer-height: 40px;
  --content-max: 920px;
  --grid-gap: var(--space-4);
  --ratio-sidebar: 0.382;
  --ratio-main: 0.618;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-secondary);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Subtle dot + line grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at center, rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.012) 1px, transparent 1px);
  background-size: 24px 24px, 48px 48px, 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* Redesigned clean ambient glows matching light theme */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}
.orb1 {
  width: 500px;
  height: 500px;
  background: rgba(79, 70, 229, 0.05);
  top: -100px;
  left: -100px;
}
.orb2 {
  width: 400px;
  height: 400px;
  background: rgba(13, 148, 136, 0.04);
  bottom: -50px;
  right: -50px;
}
.orb3 {
  width: 300px;
  height: 300px;
  background: rgba(217, 119, 6, 0.03);
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--grid-gap);
  padding: var(--grid-gap);
  height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
}

/* Golden-ratio split: ~38% sidebar / ~62% output */
.main {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: var(--grid-gap);
  overflow: hidden;
  min-height: 0;
}

.output {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.output-inner {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted2);
}

/* Utility Styles */
.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fade-in {
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* User Profile Avatar */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  border: 2px solid #ffffff;
  transition: var(--transition);
  flex-shrink: 0;
}

.user-avatar:hover {
  transform: scale(1.05);
}

.avatar-circle {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Glassmorphic Login/Signup Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}

.modal-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: modalEnter 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  transition: var(--transition);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  background: var(--surface2);
  color: var(--text);
}

.modal-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.modal-header .logo-mark {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.modal-header p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.modal-submit-btn {
  width: 100%;
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
  transition: var(--transition);
  margin-top: 8px;
}

.modal-submit-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}

.modal-footer {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.modal-footer a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  margin-left: 4px;
}

.modal-footer a:hover {
  text-decoration: underline;
}
