:root {
  /* Layout tokens */
  --kh-gutter: 16px;
  --kh-maxw: 1260px;
  --kh-radius: 12px;

  /* Semantic colors (light) map to Tailwind tokens */
  --kh-border: var(--color-gray-200);
  --kh-bg: var(--color-white);
  --kh-text: var(--color-gray-900);
  --kh-surface: var(--color-white);
  --kh-hover: var(--color-gray-50);

  color-scheme: light;
}

html.dark {
  /* Semantic colors (dark) */
  --kh-border: var(--color-gray-800);
  --kh-bg: var(--color-gray-900);
  --kh-text: var(--color-gray-100);
  --kh-surface: var(--color-gray-900);
  --kh-hover: var(--color-gray-800);

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--kh-text);
  background: var(--kh-bg);
}

/* Links (low specificity so Tailwind .text-* wins where used, e.g. navbar) */
a { color: var(--color-blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar (kept for pages that use .kh-topbar) */
.kh-topbar {
  position: sticky;
  top: 0;
  /* align with navbar’s z-40 so it won’t sit above it if both are present */
  z-index: 40;
  background: var(--kh-surface);
  border-bottom: 1px solid var(--kh-border);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  backdrop-filter: saturate(140%) blur(8px);
  pointer-events: auto;
}
.kh-topbar-inner {
  max-width: var(--kh-maxw);
  margin: 0 auto;
  padding: 10px var(--kh-gutter);
  display: flex;
  align-items: center;
  gap: 16px;
}
.kh-brand {
  font-weight: 800;
  letter-spacing: .2px;
  margin-right: 8px;
  white-space: nowrap;
}
.kh-topnav {
  display: flex;
  gap: 12px;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.kh-topnav::-webkit-scrollbar { display: none; }
.kh-topnav a {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.kh-topnav a:hover { background: var(--kh-hover); }

/* 3-column layout */
.kh-layout {
  max-width: var(--kh-maxw);
  margin: 0 auto;
  padding: var(--kh-gutter);
  display: grid;
  grid-template-columns: 280px minmax(0,1fr) 320px;
  gap: var(--kh-gutter);
}
.kh-left, .kh-center, .kh-right { min-width: 0; }

/* Extra class-based dark variables for hub chrome (kept from your original)
   These ensure dark background when pages use utility classes like bg-gray-50 */
html.dark {
  --bg: #0b1220;   /* panel/card/topbar background */
  --text: #e5e7eb; /* body text */
  --border: #374151;
}
html.dark body { background:#0b1220; color:var(--text); }
html.dark a { color:#93c5fd; }
html.dark .kh-topnav a:hover { background:#1f2937; }

/* Cards */
.kh-card {
  background: var(--kh-surface);
  border: 1px solid var(--kh-border);
  border-radius: var(--kh-radius);
  padding: 12px;
}
.kh-card h2 { margin: 0 0 8px; font-size: 20px; }
.kh-card p { margin: 0; color: var(--color-gray-600); }

/* Sections */
.kh-section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 4px 0 8px;
  color: var(--color-gray-600);
}
.kh-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.kh-pills a { padding: 6px 10px; border-radius: 999px; background: var(--color-gray-100); }
html.dark .kh-pills a { background: var(--kh-hover); }

.kh-links { list-style: none; padding: 0; margin: 0; }
.kh-links li { padding: 6px 0; }

/* Responsive */
@media (max-width: 1100px) {
  .kh-layout { grid-template-columns: 240px 1fr; }
  .kh-right { display: none; }
}
@media (max-width: 800px) {
  .kh-layout { grid-template-columns: 1fr; }
  .kh-left { display: none; }
  .kh-topbar-inner { padding: 8px 12px; }
}
