/* ═══════════════════════════════════════════════
   EcoChem — Green Chemistry Intelligence Platform
   Theme: Lush Greenery & Botanical Life
═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,800;1,700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@300;400;500&display=swap');

:root {
  /* ── Greens palette ── */
  --forest:       #1a4731;
  --forest-mid:   #2d6a4f;
  --leaf:         #40916c;
  --mint:         #52b788;
  --sage:         #74c69d;
  --pale:         #b7e4c7;
  --mist:         #d8f3dc;
  --cream:        #f0faf2;

  /* ── Backgrounds ── */
  --bg:           #edf7ee;
  --bg-2:         #f7fbf7;
  --bg-card:      #ffffff;
  --bg-card-alt:  #f4faf5;

  /* ── Text ── */
  --text-1:       #0d2b1a;   /* very dark green — max readability */
  --text-2:       #2d5a3d;   /* medium forest */
  --text-3:       #5a8a6a;   /* muted sage */

  /* ── Accents ── */
  --accent:       #2d6a4f;
  --accent-bright:#40916c;
  --accent-glow:  rgba(45,106,79,0.15);
  --warn:         #e07a00;
  --danger:       #c0392b;
  --info:         #1a6b8a;
  --amber:        #d47c0a;

  /* ── UI tokens ── */
  --border:       rgba(45,106,79,0.15);
  --border-hi:    rgba(45,106,79,0.32);
  --shadow-card:  0 4px 24px rgba(29,77,46,0.10), 0 1px 3px rgba(29,77,46,0.06);
  --shadow-hover: 0 12px 40px rgba(29,77,46,0.18), 0 2px 8px rgba(29,77,46,0.10);

  /* ── Radius ── */
  --radius-sm:    10px;
  --radius-md:    16px;
  --radius-lg:    24px;
  --radius-xl:    32px;

  /* ── Fonts ── */
  --font-head:    'Playfair Display', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', sans-serif;
  --font-mono:    'DM Mono', monospace;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(116,198,157,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(45,106,79,0.12) 0%, transparent 55%);
}

/* ── Leaf pattern overlay ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cellipse cx='60' cy='60' rx='22' ry='38' fill='none' stroke='%232d6a4f' stroke-width='0.6' opacity='0.07' transform='rotate(30 60 60)'/%3E%3Cellipse cx='20' cy='20' rx='14' ry='24' fill='none' stroke='%2340916c' stroke-width='0.5' opacity='0.06' transform='rotate(-20 20 20)'/%3E%3Cellipse cx='100' cy='95' rx='11' ry='19' fill='none' stroke='%2352b788' stroke-width='0.5' opacity='0.05' transform='rotate(50 100 95)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ── Canvas ── */
#bgCanvas {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; opacity: 0.35;
}

/* ══════════════════════════════════════════
   NAV
══════════════════════════════════════════ */
#topNav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(240,250,242,0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(45,106,79,0.08);
}
.nav-inner {
  max-width: 1320px; margin: 0 auto;
  padding: 0 32px;
  height: 68px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: 12px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--leaf);
  box-shadow: 0 0 0 3px rgba(64,145,108,0.22);
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.7;transform:scale(.82)} }

.brand-text {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 800;
  color: var(--forest);
  letter-spacing: -0.3px;
}
.brand-tag {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-3); letter-spacing: 0.4px;
  background: rgba(64,145,108,0.1);
  padding: 3px 10px; border-radius: 100px;
  border: 1px solid var(--border);
}
@media (max-width: 640px) { .brand-tag { display: none; } }

.nav-pills { display: flex; gap: 6px; }
.nav-pill {
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  padding: 8px 20px; border-radius: 100px;
  border: 1px solid transparent;
  background: none; color: var(--text-3);
  cursor: pointer; transition: all .2s;
}
.nav-pill:hover { color: var(--forest); border-color: var(--border-hi); background: var(--mist); }
.nav-pill.active {
  background: var(--forest);
  color: #ffffff; border-color: var(--forest);
  box-shadow: 0 4px 14px rgba(29,77,46,0.28);
}

/* ══════════════════════════════════════════
   SECTIONS
══════════════════════════════════════════ */
.page-section {
  display: none; position: relative; z-index: 1;
  min-height: 100vh; padding-top: 68px;
}
.page-section.active { display: block; }

/* ══ HERO ══ */
.hero {
  max-width: 900px; margin: 0 auto;
  padding: 80px 28px 48px;
  text-align: center;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 2.5px;
  color: var(--leaf); text-transform: uppercase;
  margin-bottom: 28px;
  background: rgba(64,145,108,0.1);
  padding: 8px 18px; border-radius: 100px;
  border: 1px solid rgba(64,145,108,0.25);
}
.dot-pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--leaf);
  animation: pulse 1.8s infinite;
}
.hero-title {
  font-family: var(--font-head);
  font-size: clamp(42px, 7vw, 88px);
  font-weight: 800; line-height: 1.0;
  letter-spacing: -2px; color: var(--forest);
  margin-bottom: 24px;
}
.hero-title em {
  font-style: italic;
  background: linear-gradient(135deg, var(--forest) 0%, var(--leaf) 50%, var(--mint) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 18px; line-height: 1.75; color: var(--text-2);
  max-width: 600px; margin: 0 auto 40px; font-weight: 400;
}
.hero-sub span { color: var(--forest); font-weight: 700; font-family: var(--font-mono); }

/* ── Filter chips ── */
.filter-row {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px; margin-bottom: 32px;
}
.filter-chip {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 8px 18px; border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--bg-card); color: var(--text-2);
  cursor: pointer; transition: all .2s; white-space: nowrap;
  box-shadow: var(--shadow-card);
}
.filter-chip:hover { border-color: var(--leaf); color: var(--forest); background: var(--mist); }
.filter-chip.active {
  background: var(--forest);
  color: #ffffff; border-color: var(--forest);
  box-shadow: 0 4px 14px rgba(29,77,46,0.28);
}

/* ── Search bar ── */
.search-bar { position: relative; max-width: 720px; margin: 0 auto; }
.search-inner {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card);
  border: 2px solid var(--border-hi);
  border-radius: var(--radius-md);
  padding: 8px 8px 8px 22px;
  box-shadow: var(--shadow-card);
  transition: border-color .25s, box-shadow .25s;
}
.search-inner:focus-within {
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(64,145,108,0.12), var(--shadow-hover);
}
.search-ico { width: 20px; height: 20px; color: var(--text-3); flex-shrink: 0; }
#searchInput {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font-body); font-size: 17px; font-weight: 400;
  color: var(--text-1); padding: 10px 0; min-width: 0;
}
#searchInput::placeholder { color: var(--text-3); }
.search-clear {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 15px; padding: 6px 8px;
  transition: color .2s; border-radius: 6px;
}
.search-clear:hover { color: var(--forest); background: var(--mist); }
.search-btn {
  padding: 12px 26px; border: none; border-radius: 10px;
  background: var(--forest); color: #ffffff;
  font-family: var(--font-body); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all .2s; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(29,77,46,0.3);
}
.search-btn:hover { background: var(--forest-mid); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(29,77,46,0.4); }

/* Autocomplete */
.suggestions-box {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-card); border: 1.5px solid var(--border-hi);
  border-radius: var(--radius-md); overflow: hidden;
  z-index: 50; box-shadow: var(--shadow-hover);
}
.suggestion-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px; cursor: pointer; transition: background .15s;
  font-size: 15px; color: var(--text-1); border-bottom: 1px solid var(--border);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--mist); }
.sug-type {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px;
  text-transform: uppercase; padding: 3px 8px; border-radius: 100px;
  background: rgba(64,145,108,0.12); color: var(--leaf); flex-shrink: 0;
}

/* ── Sort bar ── */
.sort-bar {
  max-width: 1320px; margin: 0 auto;
  padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.result-count {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-3); letter-spacing: 0.3px;
}
.sort-controls { display: flex; align-items: center; gap: 10px; }
.sort-label { font-size: 14px; color: var(--text-3); font-weight: 500; }
#sortSelect {
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  padding: 8px 14px; border-radius: 10px;
  border: 1.5px solid var(--border-hi);
  background: var(--bg-card); color: var(--text-1);
  cursor: pointer; outline: none;
}
#sortSelect:focus { border-color: var(--leaf); }

/* ── Result cards ── */
.results-grid {
  max-width: 1320px; margin: 0 auto;
  padding: 8px 32px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px,1fr));
  gap: 20px;
}
.reaction-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
  box-shadow: var(--shadow-card);
  position: relative; overflow: hidden;
}
.reaction-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--forest), var(--mint));
  opacity: 0; transition: opacity .25s;
}
.reaction-card:hover {
  border-color: var(--leaf);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}
.reaction-card:hover::before { opacity: 1; }

.card-industry {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--leaf); margin-bottom: 10px;
}
.card-product {
  font-family: var(--font-head); font-size: 22px; font-weight: 800;
  color: var(--forest); line-height: 1.2; margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.card-process {
  font-size: 14px; color: var(--text-3); margin-bottom: 18px;
  font-weight: 400; line-height: 1.5;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.score-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 100px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  border: 1.5px solid;
}
.toxin-badge {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  padding: 5px 12px; border-radius: 100px;
  text-transform: uppercase; letter-spacing: 0.8px;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.card-tag {
  font-family: var(--font-mono); font-size: 10px;
  padding: 3px 10px; border-radius: 100px;
  background: rgba(64,145,108,0.08); color: var(--leaf);
  border: 1px solid rgba(64,145,108,0.2);
}
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-3);
}
.card-view-btn {
  font-family: var(--font-body); font-size: 13px; font-weight: 700;
  color: var(--forest); display: flex; align-items: center; gap: 5px;
}

/* Score colour scale */
.score-1,.score-2,.score-3{ border-color:rgba(192,57,43,0.3); background:rgba(192,57,43,0.07); color:#c0392b; }
.score-4,.score-5{ border-color:rgba(212,124,10,0.3); background:rgba(212,124,10,0.07); color:#d47c0a; }
.score-6,.score-7{ border-color:rgba(64,145,108,0.3); background:rgba(64,145,108,0.08); color:#2d6a4f; }
.score-8,.score-9,.score-10{ border-color:rgba(29,77,46,0.3); background:rgba(29,77,46,0.08); color:#1a4731; }

.toxin-very-high { background:rgba(192,57,43,0.1); color:#c0392b; border:1px solid rgba(192,57,43,0.25); }
.toxin-high      { background:rgba(212,124,10,0.1); color:#b86b00; border:1px solid rgba(212,124,10,0.25); }
.toxin-medium    { background:rgba(26,107,138,0.1); color:#1a6b8a; border:1px solid rgba(26,107,138,0.25); }
.toxin-low       { background:rgba(64,145,108,0.1); color:#2d6a4f; border:1px solid rgba(64,145,108,0.3); }

/* ── Browse CTA ── */
.browse-cta { text-align: center; padding: 32px 24px 60px; }
.btn-outline {
  font-family: var(--font-body); font-size: 16px; font-weight: 700;
  padding: 14px 36px; border-radius: 100px;
  border: 2px solid var(--forest); color: var(--forest);
  background: transparent; cursor: pointer; transition: all .2s;
}
.btn-outline:hover { background: var(--forest); color: #fff; box-shadow: 0 6px 20px rgba(29,77,46,0.3); }

/* ══════════════════════════════════════════
   DASHBOARD
══════════════════════════════════════════ */
.dash-wrap, .ai-wrap {
  max-width: 1320px; margin: 0 auto;
  padding: 48px 32px 80px;
}
.section-header { margin-bottom: 40px; }
.section-header h2 {
  font-family: var(--font-head); font-size: 40px; font-weight: 800;
  color: var(--forest); letter-spacing: -1px; margin-bottom: 10px;
}
.section-header p {
  font-size: 17px; color: var(--text-2); line-height: 1.6; font-weight: 400;
}

/* KPI row */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 16px; margin-bottom: 32px; }
.kpi-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 24px 20px;
  box-shadow: var(--shadow-card); text-align: center;
  transition: box-shadow .2s;
}
.kpi-card:hover { box-shadow: var(--shadow-hover); }
.kpi-val {
  font-family: var(--font-head); font-size: 48px; font-weight: 800;
  color: var(--forest); line-height: 1; margin-bottom: 8px;
}
.kpi-lbl { font-size: 14px; font-weight: 500; color: var(--text-3); }
.kpi-red  .kpi-val { color: #c0392b; }
.kpi-red  { border-color: rgba(192,57,43,0.25); background: rgba(192,57,43,0.04); }
.kpi-amber .kpi-val { color: #d47c0a; }
.kpi-amber { border-color: rgba(212,124,10,0.25); background: rgba(212,124,10,0.04); }
.kpi-green .kpi-val { color: var(--forest); }
.kpi-green { border-color: rgba(29,77,46,0.25); background: rgba(29,77,46,0.04); }

/* Charts */
.charts-row { display: grid; grid-template-columns: 1fr 340px; gap: 20px; margin-bottom: 24px; }
@media (max-width: 900px) { .charts-row { grid-template-columns: 1fr; } }
.chart-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 28px;
  box-shadow: var(--shadow-card);
}
.chart-title {
  font-family: var(--font-head); font-size: 18px; font-weight: 700;
  color: var(--forest); margin-bottom: 24px;
}
.heatmap-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 28px;
  box-shadow: var(--shadow-card); margin-bottom: 24px;
}
.principles-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 28px;
  box-shadow: var(--shadow-card);
}

/* Bar chart */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row {
  display: grid; grid-template-columns: 160px 1fr 36px;
  align-items: center; gap: 12px;
}
.bar-lbl { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); text-align: right; }
.bar-track { height: 20px; border-radius: 100px; background: var(--mist); overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 100px; transition: width .6s ease; min-width: 4px; }
.bar-val   { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text-1); }

/* Donut */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.donut-svg-wrap { position: relative; width: 170px; height: 170px; }
.donut-svg-wrap svg { transform: rotate(-90deg); }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 28px; font-weight: 800; color: var(--forest);
}
.donut-center small { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }
.donut-legend { display: flex; flex-direction: column; gap: 8px; align-self: flex-start; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* Heatmap */
.heatmap-grid { display: flex; flex-direction: column; gap: 8px; }
.hm-row { display: flex; align-items: center; gap: 12px; }
.hm-label {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-2);
  width: 220px; flex-shrink: 0; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hm-cell {
  flex: 1; height: 32px; border-radius: 6px; position: relative;
  display: flex; align-items: center; padding-left: 12px;
  font-family: var(--font-mono); font-size: 11px; color: rgba(0,0,0,0.6);
  cursor: pointer; transition: filter .2s; overflow: hidden; min-width: 60px;
  font-weight: 600;
}
.hm-cell:hover { filter: brightness(0.9); }

/* Principles */
.principles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px,1fr)); gap: 12px; }
.principle-item {
  background: var(--bg-card-alt); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 10px; text-align: center;
  cursor: pointer; transition: all .2s;
}
.principle-item:hover { border-color: var(--leaf); background: var(--mist); box-shadow: var(--shadow-card); }
.p-num { font-family: var(--font-head); font-size: 28px; font-weight: 800; color: var(--forest); margin-bottom: 5px; }
.p-name { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-3); line-height: 1.4; }
.p-count { font-family: var(--font-mono); font-size: 11px; margin-top: 8px; color: var(--text-2); font-weight: 500; }

/* ══════════════════════════════════════════
   AI SECTION
══════════════════════════════════════════ */
.prompt-suggestions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.prompt-chip {
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  padding: 10px 18px; border-radius: 100px;
  border: 1.5px solid var(--border-hi);
  background: var(--bg-card); color: var(--text-2);
  cursor: pointer; transition: all .2s; text-align: left;
  box-shadow: var(--shadow-card);
}
.prompt-chip:hover { border-color: var(--leaf); color: var(--forest); background: var(--mist); box-shadow: var(--shadow-hover); }

.chat-window {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  min-height: 440px; max-height: 580px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  scrollbar-width: thin; scrollbar-color: var(--pale) transparent;
}
.chat-msg { display: flex; gap: 16px; align-items: flex-start; }
.chat-msg.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  background: var(--mist); color: var(--forest);
  border: 1.5px solid var(--border-hi);
}
.chat-msg.user .msg-avatar { background: rgba(26,107,138,0.1); color: var(--info); border-color: rgba(26,107,138,0.2); }
.msg-body {
  flex: 1; font-size: 15.5px; line-height: 1.75; color: var(--text-1);
  background: var(--bg-card-alt); border: 1.5px solid var(--border);
  border-radius: 4px 16px 16px 16px; padding: 16px 20px;
}
.chat-msg.user .msg-body {
  border-radius: 16px 4px 16px 16px;
  background: rgba(26,107,138,0.05); border-color: rgba(26,107,138,0.15);
}
.msg-body p { margin-bottom: 12px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body strong { color: var(--forest); font-weight: 700; }
.msg-body em { color: var(--warn); font-style: normal; font-weight: 600; }
.msg-body ul { padding-left: 20px; margin: 8px 0; }
.msg-body li { margin-bottom: 6px; }

.typing-dots { display: flex; gap: 6px; padding: 8px 0; }
.typing-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--sage);
  animation: bounce .9s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .18s; }
.typing-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes bounce { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-7px)} }

.chat-input-row { display: flex; gap: 12px; align-items: flex-end; }
#chatInput {
  flex: 1; background: var(--bg-card);
  border: 1.5px solid var(--border-hi); border-radius: var(--radius-md);
  padding: 16px 20px; color: var(--text-1);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  resize: none; outline: none; transition: border-color .2s;
  box-shadow: var(--shadow-card);
}
#chatInput:focus { border-color: var(--leaf); box-shadow: 0 0 0 4px rgba(64,145,108,0.1); }
#chatInput::placeholder { color: var(--text-3); }
.chat-send {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--forest); border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #ffffff; flex-shrink: 0;
  transition: all .2s; box-shadow: 0 4px 14px rgba(29,77,46,0.3);
}
.chat-send:hover { background: var(--forest-mid); transform: scale(1.06); }
.chat-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.ai-disclaimer {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-3);
  text-align: center; margin-top: 14px; line-height: 1.6;
}

/* ══════════════════════════════════════════
   FULLSCREEN MODAL
══════════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(10,30,15,0.55);
  backdrop-filter: blur(6px);
  align-items: stretch; justify-content: flex-end;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg-2);
  width: 100%; max-width: 100%;
  height: 100vh;
  overflow-y: auto;
  position: relative;
  animation: slideIn .35s cubic-bezier(.16,1,.3,1);
  scrollbar-width: thin; scrollbar-color: var(--pale) transparent;
  display: flex; flex-direction: column;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(40px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* Fullscreen modal header band */
.modal-hero-band {
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-mid) 60%, var(--leaf) 100%);
  padding: 60px 60px 40px;
  position: relative; overflow: hidden;
  flex-shrink: 0;
}
.modal-hero-band::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cellipse cx='100' cy='100' rx='40' ry='70' fill='none' stroke='white' stroke-width='0.8' opacity='0.08' transform='rotate(30 100 100)'/%3E%3Cellipse cx='30' cy='40' rx='24' ry='42' fill='none' stroke='white' stroke-width='0.6' opacity='0.06' transform='rotate(-15 30 40)'/%3E%3Cellipse cx='170' cy='160' rx='20' ry='35' fill='none' stroke='white' stroke-width='0.5' opacity='0.05' transform='rotate(60 170 160)'/%3E%3C/svg%3E");
  pointer-events: none;
}
.modal-close {
  position: fixed; top: 20px; right: 24px; z-index: 400;
  width: 46px; height: 46px; border-radius: 12px;
  background: rgba(255,255,255,0.15); border: 1.5px solid rgba(255,255,255,0.3);
  color: #ffffff; cursor: pointer; font-size: 18px;
  transition: all .2s; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px);
}
.modal-close:hover { background: rgba(255,255,255,0.28); transform: scale(1.08); }

/* Modal content inner */
.modal-content-inner { padding: 48px 60px 80px; max-width: 1100px; margin: 0 auto; width: 100%; }
@media (max-width: 760px) {
  .modal-hero-band { padding: 50px 24px 32px; }
  .modal-content-inner { padding: 32px 24px 60px; }
}

.modal-industry {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 2px;
  text-transform: uppercase; color: rgba(255,255,255,0.7); margin-bottom: 12px;
}
.modal-product {
  font-family: var(--font-head); font-size: clamp(32px,5vw,56px);
  font-weight: 800; letter-spacing: -1px; color: #ffffff; margin-bottom: 10px;
  line-height: 1.1;
}
.modal-process { font-size: 18px; color: rgba(255,255,255,0.75); margin-bottom: 0; font-weight: 400; }

.modal-score-row {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 24px 28px; border-radius: var(--radius-md);
  background: var(--bg-card); border: 1.5px solid var(--border);
  margin-bottom: 32px; box-shadow: var(--shadow-card);
}
.score-big {
  font-family: var(--font-head); font-size: 64px;
  font-weight: 800; line-height: 1; color: var(--forest);
}
.score-meta { display: flex; flex-direction: column; gap: 6px; }
.score-label { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); letter-spacing: 0.5px; }
.score-bar-track { width: 220px; height: 10px; border-radius: 100px; background: var(--mist); overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 100px; }

.modal-section { margin-bottom: 32px; }
.modal-section-title {
  font-family: var(--font-head); font-size: 20px; font-weight: 700;
  color: var(--forest); margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 2px solid var(--mist);
}
.modal-eq {
  font-family: var(--font-mono); font-size: 14px; line-height: 1.8;
  color: var(--forest); background: var(--mist);
  border: 1.5px solid rgba(64,145,108,0.3);
  padding: 18px 24px; border-radius: var(--radius-md);
  margin-bottom: 32px; word-break: break-all;
  font-weight: 500;
}

.modal-toxins { display: flex; flex-direction: column; gap: 10px; }
.modal-toxin-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius-sm);
  background: rgba(192,57,43,0.06); border: 1.5px solid rgba(192,57,43,0.2);
  font-size: 15px; color: var(--text-1);
}
.toxin-ico { color: #c0392b; font-size: 18px; flex-shrink: 0; }

.modal-alts { display: flex; flex-direction: column; gap: 12px; }
.modal-alt-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius-sm);
  background: rgba(64,145,108,0.06); border: 1.5px solid rgba(64,145,108,0.22);
  font-size: 15px; color: var(--text-1); line-height: 1.6;
}
.alt-ico { color: var(--leaf); font-size: 18px; flex-shrink: 0; margin-top: 2px; }

.modal-impact {
  padding: 18px 22px; border-radius: var(--radius-md);
  background: rgba(212,124,10,0.07); border: 1.5px solid rgba(212,124,10,0.25);
  font-size: 15px; color: #9a5a00; line-height: 1.7; font-weight: 500;
}
.modal-principles { display: flex; flex-wrap: wrap; gap: 8px; }
.p-badge {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 100px;
  background: rgba(45,106,79,0.1); color: var(--forest);
  border: 1.5px solid rgba(45,106,79,0.3);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .results-grid { grid-template-columns: 1fr; padding: 8px 16px 60px; }
  .sort-bar { padding: 12px 16px; }
  .dash-wrap, .ai-wrap { padding: 32px 16px 60px; }
  .hero { padding: 60px 16px 32px; }
  .score-bar-track { width: 140px; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--pale); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--sage); }