/* ============================================================
   HVAC Intelligence Platform — Design System
   Light theme. Notion/Linear inspired. DM Sans/Serif/Mono.
   ============================================================ */

:root {
  --bg: #FFFFFF;
  --surface: #F8F9FA;
  --surface-2: #F1F3F5;
  --surface-3: #E9ECEF;
  --border: #E2E5E9;
  --border-light: #CED4DA;
  --text: #1A1D23;
  --text-dim: #4A5568;
  --text-muted: #8896A6;
  --accent: #0D9488;
  --accent-dim: rgba(13,148,136,0.08);
  --accent-glow: rgba(13,148,136,0.12);
  --accent-solid: rgba(13,148,136,0.14);
  --accent-hover: #0F766E;
  --orange: #E8590C;
  --orange-dim: rgba(232,89,12,0.08);
  --purple: #7C3AED;
  --purple-dim: rgba(124,58,237,0.08);
  --blue: #2563EB;
  --blue-dim: rgba(37,99,235,0.08);
  --red: #DC2626;
  --red-dim: rgba(220,38,38,0.08);
  --green: #16A34A;
  --green-dim: rgba(22,163,74,0.08);
  --yellow: #CA8A04;
  --yellow-dim: rgba(202,138,4,0.08);
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.04);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 8px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin-right: auto;
  white-space: nowrap;
}
.nav-icon {
  color: var(--accent);
  font-size: 18px;
}
.nav-links {
  display: flex;
  gap: 4px;
}
.nav-link {
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid transparent;
  color: var(--text-dim);
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}
.nav-link.active {
  background: var(--accent-dim);
  border-color: rgba(13,148,136,0.25);
  color: var(--accent);
}
.nav-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(22,163,74,0.4);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.status-text {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
  padding-bottom: 80px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 64px 0 48px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}
.hero-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-label::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 4.5vw, 48px);
  line-height: 1.15;
  color: var(--text);
  max-width: 780px;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero-sub {
  font-size: 16px;
  color: var(--text-dim);
  margin-top: 18px;
  max-width: 680px;
  line-height: 1.75;
}

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 8px 0 48px;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--serif);
  font-size: 32px;
  color: var(--accent);
  line-height: 1.1;
}
.stat-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}
.section:first-of-type { border-top: none; }
.section-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(24px, 3.5vw, 36px);
  line-height: 1.2;
  margin-bottom: 14px;
}
.section-desc {
  font-size: 15px;
  color: var(--text-dim);
  max-width: 680px;
  margin-bottom: 32px;
  line-height: 1.75;
}

/* ============================================================
   CAPABILITY CARDS
   ============================================================ */
.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
@media (max-width: 768px) { .capabilities-grid { grid-template-columns: 1fr; } }

.capability-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s, transform var(--transition), box-shadow 0.3s;
}
.capability-card:hover {
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.capability-card.disabled {
  opacity: 0.5;
  pointer-events: none;
}
.capability-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
}
.capability-icon.accent { background: var(--accent-dim); color: var(--accent); }
.capability-icon.orange { background: var(--orange-dim); color: var(--orange); }
.capability-icon.purple { background: var(--purple-dim); color: var(--purple); }
.capability-icon.muted { background: var(--surface-2); color: var(--text-muted); }
.capability-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
}
.capability-card p {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.7;
  flex: 1;
}
.capability-cta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  margin-top: 16px;
  letter-spacing: 0.5px;
}
.capability-cta.muted { color: var(--text-muted); }

/* ============================================================
   COMPOUNDING VISUAL
   ============================================================ */
.compound-visual {
  position: relative;
  padding-left: 32px;
}
.compound-visual::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--purple), var(--orange), var(--accent));
  border-radius: 1px;
}
.compound-step {
  position: relative;
  margin-bottom: 28px;
  padding: 18px 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.compound-step:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}
.compound-step:last-child { margin-bottom: 0; }
.compound-step.highlight {
  border-color: rgba(13,148,136,0.35);
  background: linear-gradient(135deg, var(--bg), rgba(13,148,136,0.04));
}
.compound-num {
  position: absolute;
  left: -39px;
  top: 18px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}
.compound-content strong {
  font-size: 15px;
  display: block;
  margin-bottom: 4px;
}
.compound-content p {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.65;
}

/* ============================================================
   CHAT INTERFACE (Knowledge Assistant)
   ============================================================ */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 500px;
  max-height: 800px;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.chat-header h2 {
  font-size: 16px;
  font-weight: 600;
}
.chat-header-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.company-filter {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  padding: 6px 12px;
  outline: none;
  transition: border-color var(--transition);
}
.company-filter:focus { border-color: var(--accent); color: var(--text); }
.company-filter option { background: var(--bg); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.chat-welcome {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.chat-welcome-icon {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 16px;
  opacity: 0.4;
}
.chat-welcome h3 {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.chat-welcome p {
  font-size: 14px;
  max-width: 480px;
  margin: 0 auto 24px;
  line-height: 1.7;
  color: var(--text-dim);
}
.suggested-queries {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.suggested-query {
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--bg);
  cursor: pointer;
  transition: all var(--transition);
}
.suggested-query:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Message bubbles */
.message {
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.message-user {
  display: flex;
  justify-content: flex-end;
}
.message-user .message-bubble {
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius) var(--radius) 4px var(--radius);
  max-width: 70%;
  padding: 12px 18px;
  font-size: 14px;
  line-height: 1.65;
}
.message-ai {
  display: flex;
  gap: 12px;
}
.message-ai-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}
.message-ai .message-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px var(--radius) var(--radius) var(--radius);
  max-width: 80%;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-dim);
}
.message-ai .message-bubble strong { color: var(--text); }
.message-sources {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.message-source {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.message-source::before {
  content: '◆';
  color: var(--accent);
  font-size: 8px;
}
.message-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  gap: 12px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 12px 18px;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Chat input */
.chat-input-area {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}
.chat-input-wrap {
  display: flex;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.chat-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
}
.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  padding: 10px 14px;
  line-height: 1.5;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-send {
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all var(--transition);
}
.chat-send:hover { background: var(--accent-hover); transform: translateY(-1px); }
.chat-send:active { transform: translateY(0); }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ============================================================
   ONBOARDING PAGE
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
  background: var(--surface);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload-zone-icon {
  font-size: 36px;
  color: var(--accent);
  margin-bottom: 14px;
  opacity: 0.5;
}
.upload-zone h3 {
  font-size: 16px;
  margin-bottom: 6px;
}
.upload-zone p {
  font-size: 13px;
  color: var(--text-muted);
}

.onboard-results {
  margin-top: 32px;
}
.onboard-stat {
  display: flex;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.onboard-stat-label { color: var(--text-dim); }
.onboard-stat-value {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 500;
}

/* ============================================================
   PORTFOLIO PAGE
   ============================================================ */
.company-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin: 24px 0;
}
.company-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s, transform var(--transition), box-shadow 0.3s;
}
.company-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.company-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.company-card h3 { font-size: 16px; font-weight: 600; }
.company-card-location {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.company-badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--green-dim);
  color: var(--green);
  letter-spacing: 0.5px;
  font-weight: 500;
}
.company-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.company-metric-value {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}
.company-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* Tags */
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 4px;
  margin-bottom: 4px;
  font-weight: 500;
}
.tag.accent { background: var(--accent-dim); color: var(--accent); }
.tag.orange { background: var(--orange-dim); color: var(--orange); }
.tag.purple { background: var(--purple-dim); color: var(--purple); }
.tag.blue { background: var(--blue-dim); color: var(--blue); }
.tag.green { background: var(--green-dim); color: var(--green); }

/* Callout */
.callout {
  border-radius: var(--radius);
  padding: 22px 26px;
  margin: 24px 0;
  border-left: 3px solid;
}
.callout.recommend { background: var(--accent-dim); border-color: var(--accent); }
.callout.warn { background: var(--orange-dim); border-color: var(--orange); }
.callout.info { background: var(--blue-dim); border-color: var(--blue); }
.callout-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.callout.recommend .callout-label { color: var(--accent); }
.callout.warn .callout-label { color: var(--orange); }
.callout.info .callout-label { color: var(--blue); }
.callout p { font-size: 14px; color: var(--text-dim); line-height: 1.7; }
.callout strong { color: var(--text); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .nav-inner { padding: 0 16px; }
  .nav-links { display: none; }
  .nav-status { display: none; }
  .container { padding: 0 16px; }
  .hero h1 { font-size: 28px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .capabilities-grid { grid-template-columns: 1fr; }
  .chat-container { height: calc(100vh - 160px); }
  .message-user .message-bubble, .message-ai .message-bubble { max-width: 90%; }
  .company-cards { grid-template-columns: 1fr; }
}
