@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700&family=Poppins:wght@400;500;600;700&family=Kode+Mono:wght@400;700&display=swap');

body {
  font-family: "Figtree", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

code, pre, .font-mono {
  font-family: "Kode Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[x-cloak] {
  display: none !important;
}

/* ────────────────────────────────────────────────────────────────
   Light-mode polyfill for dark-only Tailwind utilities.

   Many project-scoped templates (projects/guardrails.html,
   profile_prompt.html, …) were authored against a dark canvas with
   `text-white`, `bg-[#131628]`, `border-white/[0.07]`, etc. and no
   `dark:` variant — so they leak into light mode and look out of
   place. Instead of editing every template, we map those utilities
   to sensible light values when the root does NOT have `.dark`.

   When you migrate a screen properly (add explicit `dark:` variants
   in the template), remove its overrides here — these are a safety
   net, not the long-term design.
   ──────────────────────────────────────────────────────────────── */
:root:not(.dark) .bg-\[\#131628\]          { background-color: #FFFFFF; }
:root:not(.dark) .bg-\[\#0f1031\],
:root:not(.dark) .bg-\[\#0F1031\]          { background-color: #FFFFFF; }
:root:not(.dark) .bg-\[\#0b0d1c\],
:root:not(.dark) .bg-\[\#0a0c1e\],
:root:not(.dark) .bg-\[\#0d0f22\],
:root:not(.dark) .bg-\[\#0e0f22\],
:root:not(.dark) .bg-\[\#090a1d\],
:root:not(.dark) .bg-\[\#0f1024\]          { background-color: #F4F5F7; }

/* The legacy cream `bg-[#FFFEF4]` is the light-mode default in most templates;
   flip it to pure white so cards/inputs/modals read as crisp in light. */
:root:not(.dark) .bg-\[\#FFFEF4\],
:root:not(.dark) .bg-\[\#fffef4\]          { background-color: #FFFFFF; }
:root:not(.dark) .bg-\[\#FCF9CE\],
:root:not(.dark) .bg-\[\#fcf9ce\]          { background-color: #FFFFFF; }

/* The original light-mode border `[#0F10311A]` is 10% navy → very faint on
   white. Bump to a proper neutral so card edges read clearly. */
:root:not(.dark) .border-\[\#0F10311A\],
:root:not(.dark) .border-\[\#0f10311a\]    { border-color: #E5E7EB; }
:root:not(.dark) .divide-\[\#0F10311A\] > :where(:not([hidden]) ~ :not([hidden])),
:root:not(.dark) .divide-\[\#0f10311a\] > :where(:not([hidden]) ~ :not([hidden])) {
  border-color: #E5E7EB;
}

:root:not(.dark) .border-white\/\[0\.07\],
:root:not(.dark) .border-white\/10         { border-color: rgba(15, 16, 49, 0.08); }
:root:not(.dark) .border-white\/12         { border-color: rgba(15, 16, 49, 0.10); }
:root:not(.dark) .border-white\/15         { border-color: rgba(15, 16, 49, 0.12); }
:root:not(.dark) .border-white\/20         { border-color: rgba(15, 16, 49, 0.14); }
:root:not(.dark) .border-white\/5          { border-color: rgba(15, 16, 49, 0.05); }
:root:not(.dark) .border-white\/\[0\.06\]  { border-color: rgba(15, 16, 49, 0.06); }

:root:not(.dark) .bg-white\/\[0\.04\],
:root:not(.dark) .bg-white\/\[0\.05\],
:root:not(.dark) .bg-white\/\[0\.06\],
:root:not(.dark) .bg-white\/\[0\.07\]      { background-color: rgba(15, 16, 49, 0.035); }
:root:not(.dark) .bg-white\/5,
:root:not(.dark) .bg-white\/10             { background-color: rgba(15, 16, 49, 0.05); }

:root:not(.dark) .text-white               { color: #0F1031; }
:root:not(.dark) .text-white\/80           { color: rgba(15, 16, 49, 0.80); }
:root:not(.dark) .text-white\/70           { color: rgba(15, 16, 49, 0.70); }
:root:not(.dark) .text-white\/60           { color: rgba(15, 16, 49, 0.60); }
:root:not(.dark) .text-white\/55           { color: rgba(15, 16, 49, 0.55); }
:root:not(.dark) .text-white\/50           { color: rgba(15, 16, 49, 0.50); }
:root:not(.dark) .text-white\/40           { color: rgba(15, 16, 49, 0.45); }
:root:not(.dark) .text-white\/35           { color: rgba(15, 16, 49, 0.40); }
:root:not(.dark) .text-white\/30           { color: rgba(15, 16, 49, 0.35); }
:root:not(.dark) .text-white\/25           { color: rgba(15, 16, 49, 0.30); }

:root:not(.dark) .placeholder-white\/30::placeholder { color: rgba(15, 16, 49, 0.35); }
:root:not(.dark) .placeholder-white\/40::placeholder { color: rgba(15, 16, 49, 0.40); }

/* Hover variants */
:root:not(.dark) .hover\:bg-white\/5:hover,
:root:not(.dark) .hover\:bg-white\/10:hover { background-color: rgba(15, 16, 49, 0.05); }
:root:not(.dark) .hover\:bg-white\/20:hover { background-color: rgba(15, 16, 49, 0.08); }

/* Focus borders the templates use */
:root:not(.dark) .focus\:border-white\/20:focus { border-color: rgba(15, 16, 49, 0.20); }

/* Token-colored chips/badges on dark canvases. The 15%-opacity solid-color
   chips (bg-amber-500/15, bg-emerald-500/15, etc.) read fine on white too,
   but their TEXT (text-emerald-400, text-amber-200 …) is too pale for
   contrast. Bump the text toward a darker shade in light mode. */
:root:not(.dark) .text-amber-100\/60,
:root:not(.dark) .text-amber-100\/70,
:root:not(.dark) .text-amber-200          { color: #92400e; }
:root:not(.dark) .text-amber-300,
:root:not(.dark) .text-amber-400          { color: #b45309; }
:root:not(.dark) .text-emerald-400        { color: #047857; }
:root:not(.dark) .text-emerald-300        { color: #065f46; }
:root:not(.dark) .text-red-100\/70,
:root:not(.dark) .text-red-200,
:root:not(.dark) .text-red-300            { color: #b91c1c; }
:root:not(.dark) .text-red-400            { color: #dc2626; }

/* ─── Card primitives ─────────────────────────────────────────── */
/* Subtle shadow in light mode so white cards have visible separation
   from the off-white body. Dark mode keeps the flat look. */
.vr-card {
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(15, 16, 49, 0.04);
}

.dark .vr-card {
  border-color: rgba(252, 249, 206, 0.1);
  background: #0f1031;
  box-shadow: none;
}

.metric-card {
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  background: #FFFFFF;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(15, 16, 49, 0.04);
}

.dark .metric-card {
  border-color: rgba(252, 249, 206, 0.1);
  background: #0f1031;
  box-shadow: none;
}

/* ─── Metric tile (dashboard strip) ──────────────────────────── */
.vr-metric-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(15, 16, 49, 0.04);
  min-width: 120px;
}

.dark .vr-metric-tile {
  border-color: rgba(252, 249, 206, 0.1);
  background: #0f1031;
  box-shadow: none;
}

.vr-metric-tile .tile-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(15, 16, 49, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dark .vr-metric-tile .tile-label {
  color: rgba(238, 235, 242, 0.5);
}

.vr-metric-tile .tile-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: #0f1031;
}

.dark .vr-metric-tile .tile-value {
  color: #fcf9ce;
}

.vr-metric-tile .tile-sub {
  font-size: 11px;
  color: rgba(15, 16, 49, 0.5);
}

.dark .vr-metric-tile .tile-sub {
  color: rgba(238, 235, 242, 0.5);
}

/* ─── Tab bar ─────────────────────────────────────────────────── */
.vr-tab-bar {
  display: flex;
  border-bottom: 1px solid rgba(15, 16, 49, 0.1);
  margin-bottom: 24px;
  gap: 4px;
}

.dark .vr-tab-bar {
  border-color: rgba(255, 255, 255, 0.07);
}

.vr-tab-item {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(15, 16, 49, 0.5);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.dark .vr-tab-item {
  color: rgba(238, 235, 242, 0.4);
}

.vr-tab-item:hover {
  color: #666633;
}
.dark .vr-tab-item:hover {
  color: rgba(255, 255, 255, 0.85);
}

.vr-tab-item.vr-tab-active {
  color: #666633;
  border-bottom-color: #666633;
}
.dark .vr-tab-item.vr-tab-active {
  color: #ffffff;
  border-bottom-color: #ffffff;
}

/* ─── Progress bars (severity) ───────────────────────────────── */
.vr-progress-track {
  height: 6px;
  border-radius: 9999px;
  background: rgba(15, 16, 49, 0.08);
  overflow: hidden;
}

.dark .vr-progress-track {
  background: rgba(252, 249, 206, 0.08);
}

.vr-progress-bar {
  height: 100%;
  border-radius: 9999px;
}

/* ─── Guardrail type pills ────────────────────────────────────── */
.vr-pill-do {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.dark .vr-pill-do {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.vr-pill-dont {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.dark .vr-pill-dont {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.vr-pill-ai {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.dark .vr-pill-ai {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
}

/* ─── Project cards (Vibe Reviews grid) ──────────────────────── */
.vr-project-card {
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  background: #FFFFFF;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 1px 2px rgba(15, 16, 49, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dark .vr-project-card {
  border-color: rgba(252, 249, 206, 0.1);
  background: #0f1031;
  box-shadow: none;
}

.vr-project-card:hover {
  border-color: rgba(102, 102, 51, 0.4);
  box-shadow: 0 4px 12px rgba(15, 16, 49, 0.06);
}

.dark .vr-project-card:hover {
  box-shadow: none;
}

/* ─── Sidebar sub-nav ─────────────────────────────────────────── */
.vr-subnav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid rgba(15, 16, 49, 0.1);
  margin-bottom: 24px;
}

.dark .vr-subnav {
  border-color: rgba(252, 249, 206, 0.1);
}

.vr-subnav-item {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(15, 16, 49, 0.5);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  transition: color 0.15s;
}

.dark .vr-subnav-item {
  color: rgba(238, 235, 242, 0.5);
}

.vr-subnav-item:hover,
.vr-subnav-item.active {
  color: #666633;
  border-bottom-color: #666633;
}

/* ─── Notice banner ───────────────────────────────────────────── */
.vr-notice {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid rgba(102, 102, 51, 0.25);
  background: rgba(102, 102, 51, 0.06);
  color: #666633;
}

.vr-notice-error {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.06);
  color: #dc2626;
}

/* ─── Status badge colors ─────────────────────────────────────── */
.badge-plan-individual { background: rgba(102, 102, 51, 0.12); color: #666633; }
.badge-plan-team       { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.badge-plan-enterprise { background: rgba(168, 85, 247, 0.12); color: #9333ea; }
.badge-plan-onprem     { background: rgba(20, 184, 166, 0.12); color: #0d9488; }

.dark .badge-plan-individual { background: rgba(102,102,51,0.2);  color: #b8b84e; }
.dark .badge-plan-team       { background: rgba(59,130,246,0.2);  color: #60a5fa; }
.dark .badge-plan-enterprise { background: rgba(168,85,247,0.2);  color: #c084fc; }
.dark .badge-plan-onprem     { background: rgba(20,184,166,0.2);  color: #2dd4bf; }

/* ─── Connection status badges ───────────────────────────────── */
.badge-connected    { background: rgba(34,197,94,0.12);  color: #16a34a; }
.badge-not-configured { background: rgba(15,16,49,0.08); color: rgba(15,16,49,0.5); }

.dark .badge-connected      { background: rgba(34,197,94,0.15);  color: #4ade80; }
.dark .badge-not-configured { background: rgba(252,249,206,0.08); color: rgba(238,235,242,0.4); }

/* ─── Collapsible (details/summary polish) ───────────────────── */
details > summary {
  list-style: none;
  cursor: pointer;
}
details > summary::-webkit-details-marker { display: none; }

/* ─── Contribution heatmap ────────────────────────────────────── */
/* Fluid layout: parent grid stretches to the card width.            */
/*   col 1 = weekday rail (auto width)                               */
/*   col 2 = month strip / cell grid / legend (1fr — fills space)    */
/* Cell grid pins aspect-ratio to 52:7 so cells stay square.         */
.vr-heatmap-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 6px;
  row-gap: 4px;
  width: 100%;
}

.vr-heatmap-months {
  grid-column: 2;
  position: relative;
  height: 11px;
  font-size: 9px;
  line-height: 1;
  color: rgba(15, 16, 49, 0.5);
}
.dark .vr-heatmap-months { color: rgba(238, 235, 242, 0.45); }
.vr-heatmap-months > span { position: absolute; top: 0; transform: translateX(-1px); }

.vr-heatmap-weekdays {
  grid-column: 1;
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  font-size: 9px;
  line-height: 1;
  color: rgba(15, 16, 49, 0.5);
}
.dark .vr-heatmap-weekdays { color: rgba(238, 235, 242, 0.45); }
.vr-heatmap-weekdays > span { display: flex; align-items: center; }

.vr-heatmap {
  grid-column: 2;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  width: 100%;
  aspect-ratio: 52 / 7;
}

.vr-heatmap-cell {
  display: block;
  border-radius: 3px;
  background-color: rgba(15, 16, 49, 0.06);
  transition: outline-color 0.12s ease, transform 0.08s ease;
}

a.vr-heatmap-cell { cursor: pointer; }
a.vr-heatmap-cell:focus-visible {
  outline: 2px solid #666633;
  outline-offset: 2px;
}

.vr-heatmap > .vr-heatmap-cell:hover {
  outline: 1.5px solid rgba(102, 102, 51, 0.75);
  outline-offset: 1px;
}

.dark .vr-heatmap-cell            { background-color: rgba(252, 249, 206, 0.06); }
.vr-heatmap-cell[data-level="1"]  { background-color: rgba(102, 102, 51, 0.28); }
.vr-heatmap-cell[data-level="2"]  { background-color: rgba(102, 102, 51, 0.50); }
.vr-heatmap-cell[data-level="3"]  { background-color: rgba(102, 102, 51, 0.75); }
.vr-heatmap-cell[data-level="4"]  { background-color: rgba(102, 102, 51, 1.00); }
.vr-heatmap-cell[data-level="-1"] { background-color: transparent; pointer-events: none; }

.vr-heatmap-legend {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  font-size: 10px;
  color: rgba(15, 16, 49, 0.5);
}
.dark .vr-heatmap-legend { color: rgba(238, 235, 242, 0.4); }
.vr-heatmap-legend .vr-heatmap-cell {
  width: 11px;
  height: 11px;
  flex: none;
}

.vr-heatmap-popover {
  pointer-events: none;
  position: absolute;
  z-index: 20;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  border: 1px solid #E5E7EB;
  background: #FFFFFF;
  color: #0f1031;
  box-shadow: 0 6px 18px rgba(15, 16, 49, 0.10);
  transform: translate(-50%, calc(-100% - 8px));
}
.dark .vr-heatmap-popover {
  border-color: rgba(252, 249, 206, 0.15);
  background: #0f1031;
  color: #fcf9ce;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.vr-heatmap-popover::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: inherit;
  border-right: 1px solid rgba(15, 16, 49, 0.12);
  border-bottom: 1px solid rgba(15, 16, 49, 0.12);
  transform: translateX(-50%) rotate(45deg);
}
.dark .vr-heatmap-popover::after {
  border-right-color: rgba(252, 249, 206, 0.15);
  border-bottom-color: rgba(252, 249, 206, 0.15);
}
