:root {
  --bg: #ffffff;
  --text: #18181a;
  --muted: #4b5563;
  --accent: #6aa5ff;
  --accent-2: #3ddc97;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.08);
  --font-main: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --container-width: 1100px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font-main);
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  font-weight: 700;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.docs-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 32px 16px 64px;
}

/* Navbar */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.nav-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.nav-brand {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none !important;
}
.nav-links {
  display: flex;
  gap: 20px;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.nav-links a:hover {
  color: var(--accent);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  background: #fff;
  flex-shrink: 0;
}
.footer-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

/* Cards */
.card, .card-tool, .resource-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.card-padding {
  padding: 24px;
}

.card:hover, .card-tool:hover {
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
  border-color: #d1d5db;
}

/* Buttons */
.btn {
  display: inline-block;
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 12px;
  transition: all .2s ease;
  border: none;
  text-decoration: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #85c1ff);
  color: #08111f !important;
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(106,165,255,.3);
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text) !important;
}

.btn-ghost:hover {
  background: #f9fafb;
}

.btn-danger {
  background: #ff6b6b;
  color: white !important;
}

/* Badges */
.badge, .badge-fw {
  font-size: 12px;
  background: #e0edff;
  color: #1f3a8a;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
  display: inline-block;
}

/* Form controls */
input[type="text"], input[type="search"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(106,165,255,.2);
}

/* Hero */
.hero {
  padding: 48px 0 32px;
}
.hero h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  margin-bottom: 12px;
}
.hero p {
  font-size: 1.25rem;
  color: var(--muted);
  max-width: 800px;
}

/* Grid */
.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* AI ecosystem page */
.ecosystem-page { margin: 0; }
.ecosystem-shell { display: grid; gap: 24px; }
.ecosystem-toolbar {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}
.ecosystem-toolbar-top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
}
.ecosystem-search { max-width: 560px; flex: 1 1 320px; }
.section-nav { display: flex; flex-wrap: wrap; gap: 10px; }
.section-chip {
  border: 1px solid #dbe3f4;
  background: #f8fbff;
  color: #12325f;
  padding: 8px 12px;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
}
.section-chip:hover { background: #edf4ff; }
.ecosystem-sections { display: grid; gap: 24px; }
.ecosystem-section {
  padding: 24px;
}
.ecosystem-section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: start;
  margin-bottom: 16px;
}
.ecosystem-section-header h2 { margin-bottom: 6px; }
.ecosystem-section-intro { margin: 0; color: var(--muted); max-width: 820px; }
.ecosystem-group { margin-top: 20px; }
.ecosystem-group-title { margin-bottom: 12px; font-size: 1rem; color: #1f3a8a; }
.ecosystem-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.ecosystem-card {
  padding: 18px;
  border: 1px solid #dce5f4;
  border-radius: 12px;
  background: #f9fbff;
}
.ecosystem-card h4 { margin-bottom: 8px; }
.ecosystem-card p { margin: 0; }
.ecosystem-card .resource-link,
.ecosystem-card .ecosystem-card-link { color: #1f3a8a; font-weight: 700; }
.ecosystem-description { margin-top: 10px !important; color: var(--text); }
.ecosystem-feature-list { margin: 12px 0 0 18px; color: var(--text); }
.ecosystem-meta { margin-top: 12px; display: grid; gap: 10px; }
.ecosystem-meta-row { font-size: 13px; }
.ecosystem-meta-label { display: block; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.ecosystem-empty {
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
}

/* Specific to references.html (keeping existing logic but updating variables) */
.resources-page { margin:0; }
.page-hero { margin-bottom:24px; }
.page-hero h1 { margin:0 0 10px; font-size:clamp(2rem, 4vw, 3rem); }
.page-intro { margin:0; max-width:760px; color:var(--muted); }
.resources-panel { padding:20px; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); background:#fff; margin-bottom: 24px; }
.resources-toolbar { display:grid; gap:12px; grid-template-columns:minmax(0, 1.8fr) minmax(180px, .8fr) auto; align-items:end; }
.field { display:flex; flex-direction:column; gap:6px; }
.field span { font-size:14px; font-weight:600; color: var(--muted); }
.reset-button { min-height:44px; padding:10px 16px; background:#edf2ff; color:#1f3a8a; font-weight:600; border: none; border-radius: 10px; cursor: pointer; }
.keyword-filter-block { margin-top:18px; }
.keyword-filter-header { display:flex; justify-content:space-between; gap:12px; align-items:baseline; flex-wrap:wrap; margin-bottom:12px; }
.keyword-filter-header h2 { font-size:14px; margin:0; }
.keyword-filter-header p { font-size:14px; color: var(--muted); margin:0; }
.chip-list { display:flex; flex-wrap:wrap; gap:10px; }
.keyword-chip { display:inline-flex; align-items:center; gap:8px; padding:8px 12px; border:1px solid #dbe3f4; border-radius:999px; background:#f8fbff; color:#12325f; font:inherit; cursor: pointer; border: 1px solid #dbe3f4; }
.keyword-chip small { font-size:12px; color: var(--muted); }
.keyword-chip.is-active { border-color:#6aa5ff; background:#e0edff; color:#1f3a8a; }
.resources-summary { margin-bottom: 16px; font-size:14px; color: var(--muted); }
.resources-grid { display: flex; flex-direction: column; gap: 32px; }
.resource-title-link { font-weight: 700; color: #1f3a8a; text-decoration: none; font-size: 1.2rem; }
.resource-title-link:hover { text-decoration: underline; }
.resource-meta { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.resource-description { margin: 12px 0; color: var(--text); }
.resource-link { display:inline-flex; align-items:center; gap:6px; font-weight:600; color:#1f3a8a; text-decoration:none; }
.resource-link:hover { text-decoration:underline; }

@media (max-width: 800px) {
  .resources-toolbar { grid-template-columns:1fr; }
  .nav-container { justify-content: center; }
  .nav-links { width: 100%; justify-content: center; }
  .ecosystem-toolbar-top { align-items: stretch; }
}

/* Utilities */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.w-100 { width: 100%; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-auto { margin-top: auto; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.fw-bold { font-weight: 700; }
.h5 { font-size: 1.25rem; }
