/* Growth Detector — Design System
   Dark, sober, analytical. Phosphor-green accent.
   Drop-in replacement for gems.html visual language.
*/

:root {
  /* Surfaces */
  --bg-0: #0A0D12;        /* page */
  --bg-1: #0F141B;        /* surface */
  --bg-2: #161D27;        /* elevated */
  --bg-3: #1E2733;        /* hover */
  --bg-4: #2A3543;        /* selected */
  --line: #232C39;
  --line-strong: #2E3A4B;

  /* Text */
  --ink-0: #F2F5F9;
  --ink-1: #B6C0CD;
  --ink-2: #7E8B9C;
  --ink-3: #4F5B6B;

  /* Brand — neon pink */
  --brand: #FF2D78;
  --brand-soft: #FF85B3;
  --brand-dim: #9E1F55;
  --brand-ink: #0A0D12;

  /* Status — variation outcomes */
  --pos: #4ADE80;        /* Variação Positiva (Acelerador) */
  --pos-bg: rgba(74, 222, 128, 0.10);
  --pos-line: rgba(74, 222, 128, 0.28);

  --neutral: #94A3B8;    /* Sem Variação (Baseline) */
  --neutral-bg: rgba(148, 163, 184, 0.10);
  --neutral-line: rgba(148, 163, 184, 0.26);

  --neg: #F87171;        /* Variação Negativa (Gargalo) */
  --neg-bg: rgba(248, 113, 113, 0.10);
  --neg-line: rgba(248, 113, 113, 0.30);

  --pending: #FACC15;    /* Em validação / em teste */
  --pending-bg: rgba(250, 204, 21, 0.10);
  --pending-line: rgba(250, 204, 21, 0.28);

  --testing: #818CF8;    /* In incubation */
  --testing-bg: rgba(129, 140, 248, 0.10);
  --testing-line: rgba(129, 140, 248, 0.28);

  /* Stage colors */
  --c-radar:    #38BDF8;
  --c-garimpo:  #FF2D78;
  --c-clara:    #C084FC;
  --c-casca:    #F59E0B;

  /* Platform colors */
  --p-google:   #EA4335;
  --p-meta:     #1877F2;
  --p-linkedin: #0A66C2;
  --p-rd:       #F03C30;
  --p-multi:    #FF2D78;

  /* Type */
  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Scale */
  --t-xs: 11px;
  --t-sm: 12px;
  --t-md: 13px;
  --t-lg: 15px;
  --t-xl: 18px;
  --t-2xl: 22px;
  --t-3xl: 28px;
  --t-4xl: 40px;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 14px;

  --row-h: 44px;
  --pad-cell: 12px;

  --sidebar-w: 232px;
  --topbar-h: 56px;
}

[data-density="compact"] { --row-h: 36px; --pad-cell: 8px; }
[data-density="spacious"] { --row-h: 56px; --pad-cell: 16px; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: var(--font-sans);
  font-size: var(--t-md);
  line-height: 1.45;
  font-feature-settings: "ss01", "cv11", "tnum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, textarea, select { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ============================================================ */
/* App Shell                                                    */
/* ============================================================ */

.gd-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  overflow: hidden;
}
@media (max-width: 1100px) {
  :root { --sidebar-w: 196px; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 64px; }
  .gd-sidebar { padding: 12px 8px; }
  .gd-nav-item { justify-content: center; padding: 9px 4px; }
  .gd-nav-item > span:not(.gd-nav-icon):not(.gd-stage-pill) { display: none; }
  .gd-nav-label { font-size: 0; padding: 8px 0; border-top: 1px solid var(--line); }
  .gd-nav-label:first-child { border-top: none; }
  .gd-sidebar-status > span:not(.dot) { display: none; }
  .gd-brand { width: calc(var(--sidebar-w) - 20px); padding-right: 8px; }
  .gd-brand > div { display: none; }
}

.gd-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  position: relative;
  z-index: 10;
}

.gd-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(var(--sidebar-w) - 20px);
  padding-right: 20px;
  border-right: 1px solid var(--line);
  height: 100%;
  flex-shrink: 0;
  margin-left: -20px;
  padding-left: 20px;
}

.gd-brand-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  position: relative;
}

.gd-brand-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-0);
  line-height: 1;
}
.gd-brand-name .dim { color: var(--ink-2); font-weight: 400; }
.gd-brand-name .sub {
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 3px;
  font-weight: 500;
  display: block;
}

.gd-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: var(--t-sm);
}
.gd-breadcrumbs .crumb-current { color: var(--ink-0); font-weight: 500; }
.gd-breadcrumbs .sep { color: var(--ink-3); }

.gd-topbar-spacer { flex: 1; }
.gd-topbar-actions { display: flex; align-items: center; gap: 8px; }

.gd-cycle-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  font-size: var(--t-xs);
  color: var(--ink-1);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.gd-cycle-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(255, 45, 120, 0.18);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

.gd-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--ink-1);
  border: 1px solid transparent;
  transition: all .12s ease;
}
.gd-icon-btn:hover { background: var(--bg-3); color: var(--ink-0); border-color: var(--line); }

.gd-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4F46E5, #C084FC);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ============================================================ */
/* Sidebar                                                      */
/* ============================================================ */

.gd-sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 12px;
}

.gd-nav-section { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.gd-nav-section:first-child { margin-top: 0; }

.gd-nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--ink-3);
  padding: 4px 10px 8px;
  font-weight: 600;
}

.gd-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  color: var(--ink-1);
  font-size: var(--t-md);
  cursor: pointer;
  transition: background .1s ease, color .1s ease;
  width: 100%;
  text-align: left;
  position: relative;
}
.gd-nav-item:hover { background: var(--bg-2); color: var(--ink-0); }
.gd-nav-item.active { background: var(--bg-3); color: var(--ink-0); }
.gd-nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
}

/* Stage accent — colored icons per stage */
.gd-nav-item[data-stage="radar"]   .gd-nav-icon { color: var(--c-radar); opacity: 0.8; }
.gd-nav-item[data-stage="garimpo"] .gd-nav-icon { color: var(--c-garimpo); opacity: 0.8; }
.gd-nav-item[data-stage="clara"]   .gd-nav-icon { color: var(--c-clara); opacity: 0.8; }
.gd-nav-item[data-stage="casca"]   .gd-nav-icon { color: var(--c-casca); opacity: 0.8; }
/* Active overrides back to white */
.gd-nav-item.active[data-stage] .gd-nav-icon { color: var(--ink-0); opacity: 1; }

.gd-nav-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink-2);
}
.gd-nav-item.active .gd-nav-icon { color: var(--ink-0); }
.gd-nav-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 999px;
}
.gd-nav-item.active .gd-nav-count { color: var(--ink-1); background: var(--bg-1); }

.gd-stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-2);
  color: var(--ink-2);
  flex-shrink: 0;
}
.gd-stage-pill::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.gd-stage-pill.radar    { color: var(--c-radar); }
.gd-stage-pill.garimpo  { color: var(--c-garimpo); }
.gd-stage-pill.clara    { color: var(--c-clara); }
.gd-stage-pill.casca    { color: var(--c-casca); }

.gd-darwin-shortcut {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-md);
  background: transparent;
  border: none;
  color: var(--ink-1);
  cursor: pointer;
  transition: background .1s ease, color .1s ease;
  text-align: left;
  box-sizing: border-box;
  margin-bottom: 4px;
  margin-top: auto;
  position: relative;
}
.gd-darwin-shortcut::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}
.gd-darwin-shortcut:hover {
  background: var(--bg-2);
  color: var(--ink-0);
}
.gd-darwin-shortcut.active {
  background: var(--bg-3);
  color: var(--ink-0);
}
.gd-darwin-shortcut.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 22px;
  bottom: 8px;
  width: 2px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
}
.gd-darwin-shortcut-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}
.gd-darwin-shortcut-text .name {
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}
.gd-darwin-shortcut-text .sub {
  font-size: 10px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  white-space: nowrap;
  letter-spacing: 0.03em;
}
[data-sidebar-collapsed="true"] .gd-darwin-shortcut {
  justify-content: center;
  padding: 14px 0 7px;
}
[data-sidebar-collapsed="true"] .gd-darwin-shortcut .gd-darwin-shortcut-text,
[data-sidebar-collapsed="true"] .gd-darwin-shortcut > svg { display: none; }

.gd-sidebar-status {
  margin-top: 0;
  padding: 10px 10px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-xs);
  color: var(--ink-2);
}
.gd-sidebar-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 6px var(--pos-line);
  flex-shrink: 0;
}

.gd-sidebar-toggle-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.gd-sidebar-toggle {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  border: 1px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
  flex-shrink: 0;
}
.gd-sidebar-toggle:hover {
  color: var(--ink-1);
  background: var(--bg-2);
  border-color: var(--line);
}

/* Sidebar collapsed state */
[data-sidebar-collapsed="true"] { --sidebar-w: 56px; }

[data-sidebar-collapsed="true"] .gd-sidebar { padding: 16px 8px; }

[data-sidebar-collapsed="true"] .gd-brand > div { display: none; }

[data-sidebar-collapsed="true"] .gd-nav-item {
  justify-content: center;
  padding: 7px 0;
}
[data-sidebar-collapsed="true"] .gd-nav-item > span:not(.gd-nav-icon):not(.gd-stage-pill),
[data-sidebar-collapsed="true"] .gd-nav-item > .gd-nav-count { display: none; }
[data-sidebar-collapsed="true"] .gd-nav-item.active::before { left: -8px; }

[data-sidebar-collapsed="true"] .gd-nav-label {
  font-size: 0;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  margin-top: 0;
}
[data-sidebar-collapsed="true"] .gd-nav-label:first-child { border-top: none; }

[data-sidebar-collapsed="true"] .gd-sidebar-status { justify-content: center; }
[data-sidebar-collapsed="true"] .gd-sidebar-status > span:not(.dot) { display: none; }

[data-sidebar-collapsed="true"] .gd-sidebar-toggle-wrap { justify-content: center; }

/* ============================================================ */
/* Main column                                                  */
/* ============================================================ */

.gd-main {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-0);
  min-width: 0;
  min-height: 0;
}

.gd-page-header {
  padding: 32px 40px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-0);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.gd-page-header > div:first-child { min-width: 0; flex: 1 1 320px; }
.gd-page-actions { flex-wrap: wrap; }
.gd-page-title {
  font-size: var(--t-3xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--ink-0);
  line-height: 1.1;
}
.gd-page-subtitle {
  color: var(--ink-2);
  font-size: var(--t-md);
  margin: 0;
  max-width: 720px;
}
.gd-page-actions { display: flex; align-items: center; gap: 8px; }

.gd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--ink-0);
  font-size: var(--t-sm);
  font-weight: 500;
  transition: all .1s ease;
  height: 32px;
  white-space: nowrap;
}
.gd-btn:hover { background: var(--bg-3); border-color: var(--ink-3); }
.gd-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.gd-btn.primary {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
  font-weight: 600;
}
.gd-btn.primary:hover {
  background: var(--brand-soft);
  border-color: var(--brand-soft);
}
.gd-btn.ghost { background: transparent; border-color: transparent; color: var(--ink-1); }
.gd-btn.ghost:hover { background: var(--bg-2); color: var(--ink-0); }
.gd-btn.danger {
  background: transparent;
  color: var(--neg);
  border-color: var(--neg-line);
}
.gd-btn.danger:hover { background: var(--neg-bg); }
.gd-btn.sm { height: 26px; padding: 4px 9px; font-size: var(--t-xs); }
.gd-btn .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  padding: 0 4px;
  border-radius: 3px;
  margin-left: 4px;
}

/* Tab bar */
.gd-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 40px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-0);
  overflow-x: auto;
  scrollbar-width: thin;
}
.gd-tabs::-webkit-scrollbar { height: 2px; }
.gd-tab {
  padding: 11px 14px;
  font-size: var(--t-sm);
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color .1s;
  white-space: nowrap;
}
.gd-tab:hover { color: var(--ink-0); }
.gd-tab.active {
  color: var(--ink-0);
  border-bottom-color: var(--brand);
  font-weight: 500;
}
.gd-tab .badge {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-3);
  color: var(--ink-1);
  padding: 1px 6px;
  border-radius: 999px;
}
.gd-tab.active .badge { background: var(--bg-4); }
.gd-tab.tab-pos.active .badge { background: var(--pos-bg); color: var(--pos); }
.gd-tab.tab-neutral.active .badge { background: var(--neutral-bg); color: var(--neutral); }
.gd-tab.tab-neg.active .badge { background: var(--neg-bg); color: var(--neg); }

/* ============================================================ */
/* Filter / control bar                                         */
/* ============================================================ */

.gd-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-0);
  flex-wrap: wrap;
}
.gd-search { min-width: 220px; }
@media (max-width: 760px) { .gd-search { width: 100%; } }

.gd-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  height: 30px;
  width: 280px;
  color: var(--ink-2);
}
.gd-search:focus-within { border-color: var(--ink-3); background: var(--bg-1); }
.gd-search input {
  flex: 1;
  background: none;
  border: none;
  color: var(--ink-0);
  font: inherit;
  outline: none;
  padding: 0;
  height: 100%;
  font-size: var(--t-sm);
}
.gd-search .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  padding: 0 4px;
  border-radius: 3px;
}

.gd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 30px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink-1);
  font-size: var(--t-sm);
  cursor: pointer;
  transition: all .1s;
  white-space: nowrap;
}
.gd-chip:hover { background: var(--bg-3); color: var(--ink-0); }
.gd-chip.active {
  background: var(--bg-3);
  color: var(--ink-0);
  border-color: var(--line-strong);
}
.gd-chip .count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
}
.gd-chip.active .count { color: var(--ink-1); }
.gd-chip-divider { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }

.gd-period-group {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 1px;
}
.gd-period-btn {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: var(--t-sm);
  color: var(--ink-2);
  font-family: var(--font-mono);
  height: 24px;
  transition: all .1s;
}
.gd-period-btn:hover { color: var(--ink-0); }
.gd-period-btn.active { background: var(--brand); color: var(--brand-ink); font-weight: 600; }

/* ── Impact & Confidence chips (HypothesisRow) ── */
.gd-chip-impact {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--chip-c, var(--ink-3));
  background: rgba(0,0,0,0.0);
  border: 1px solid var(--line);
  /* browsers with color-mix get tinted background */
  background: color-mix(in srgb, var(--chip-c, var(--ink-3)) 10%, transparent);
  border-color: color-mix(in srgb, var(--chip-c, var(--ink-3)) 22%, transparent);
}
.gd-chip-conf {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
}
.gd-row-age {
  font-size: var(--t-xs);
  color: var(--ink-3);
}
.gd-row-meta .dim { color: var(--ink-3); }

/* ── Knowledge source chips (ChatScreen darwin strip) ── */
.gc-src-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.gc-src-chip {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--ink-3);
  white-space: nowrap;
}
.gc-src-chip.on {
  background: rgba(255,45,120,0.08);
  border-color: rgba(255,45,120,0.22);
  color: var(--brand);
}

/* ============================================================ */
/* Hypothesis Lab                                                */
/* ============================================================ */

.gd-lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(360px, 36%, 480px);
  flex: 1;
  overflow: hidden;
  min-height: 0;
  position: relative;
}
.gd-lab.collapsed { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 1180px) {
  .gd-lab { grid-template-columns: minmax(0, 1fr); }
  .gd-lab .gd-detail {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: min(440px, 92%);
    z-index: 20;
    box-shadow: -16px 0 40px rgba(0,0,0,.45);
  }
}

.gd-lab-left {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.gd-rows { min-width: 0; }

/* KPI strip */
.gd-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.gd-kpi {
  padding: 16px 22px;
  border-right: 1px solid var(--line);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gd-kpi:last-child { border-right: none; }

.gd-kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.gd-kpi-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink-0);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.gd-kpi-value .unit { font-size: var(--t-md); color: var(--ink-2); font-weight: 400; }
.gd-kpi-delta {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.gd-kpi-delta.up   { color: var(--pos); }
.gd-kpi-delta.down { color: var(--neg); }
.gd-kpi-delta.flat { color: var(--ink-2); }

.gd-kpi-spark {
  position: absolute;
  bottom: 12px;
  right: 16px;
  width: 70px;
  height: 24px;
  opacity: 0.55;
}

/* List header */
.gd-list-header {
  padding: 10px 28px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-1);
}

/* Hypothesis row card */
.gd-rows {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.gd-row {
  display: grid;
  grid-template-columns: 4px 44px minmax(0, 1fr) auto auto;
  gap: 14px;
  padding: 14px 28px 14px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
  cursor: pointer;
  transition: background .08s;
  position: relative;
}
@media (max-width: 760px) {
  .gd-row { grid-template-columns: 4px 36px minmax(0, 1fr) auto; gap: 10px; padding-right: 16px; }
  .gd-row .gd-row-actions { display: none; }
}
.gd-row:hover { background: var(--bg-1); }
.gd-row.selected { background: var(--bg-2); }
.gd-row.selected .gd-row-marker { background: var(--brand); }

.gd-row-marker {
  width: 4px;
  height: 100%;
  align-self: stretch;
  background: transparent;
}
.gd-row.status-pos    .gd-row-marker { background: linear-gradient(180deg, var(--pos), transparent); }
.gd-row.status-neutral .gd-row-marker { background: linear-gradient(180deg, var(--neutral), transparent); }
.gd-row.status-neg    .gd-row-marker { background: linear-gradient(180deg, var(--neg), transparent); }
.gd-row.status-pending .gd-row-marker { background: linear-gradient(180deg, var(--pending), transparent); }
.gd-row.status-testing .gd-row-marker { background: linear-gradient(180deg, var(--testing), transparent); }
.gd-row.status-draft   .gd-row-marker { background: linear-gradient(180deg, var(--brand-dim), transparent); }

.gd-row-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  flex-shrink: 0;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}
.gd-row-icon img { width: 22px; height: 22px; object-fit: contain; }

.gd-row-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.gd-row-title {
  color: var(--ink-0);
  font-weight: 500;
  font-size: var(--t-md);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}
.gd-row-insight {
  color: var(--ink-1);
  font-size: var(--t-sm);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gd-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-xs);
  color: var(--ink-3);
  margin-top: 2px;
  flex-wrap: wrap;
}
.gd-row-meta .sep { color: var(--ink-3); opacity: 0.5; }
.gd-row-meta .impact {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.gd-row-meta .impact.high { color: var(--pos); background: var(--pos-bg); }
.gd-row-meta .impact.med  { color: var(--pending); background: var(--pending-bg); }
.gd-row-meta .impact.low  { color: var(--ink-2); background: var(--bg-2); }

.gd-row-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
}
.gd-cu-badge {
  font-size: 9px; font-family: var(--font-mono); font-weight: 600;
  color: var(--ink-3); text-decoration: none;
  padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--line);
  letter-spacing: .04em;
  transition: color .15s, border-color .15s;
}
.gd-cu-badge:hover { color: var(--brand); border-color: var(--brand); }
.gd-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Status badge */
.gd-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: var(--t-xs);
  font-weight: 600;
  border: 1px solid;
  letter-spacing: 0.01em;
  white-space: nowrap;
  font-family: var(--font-mono);
  text-transform: uppercase;
}
.gd-status::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.gd-status.pos      { background: var(--pos-bg);     color: var(--pos);     border-color: var(--pos-line); }
.gd-status.neutral  { background: var(--neutral-bg); color: var(--neutral); border-color: var(--neutral-line); }
.gd-status.neg      { background: var(--neg-bg);     color: var(--neg);     border-color: var(--neg-line); }
.gd-status.pending  { background: var(--pending-bg); color: var(--pending); border-color: var(--pending-line); }
.gd-status.testing  { background: var(--testing-bg); color: var(--testing); border-color: var(--testing-line); }
.gd-status.draft    { background: var(--bg-3);       color: var(--ink-2);   border-color: var(--line); }
.gd-status.approved { background: var(--testing-bg); color: var(--testing); border-color: var(--testing-line); }

/* Platform chip */
.gd-platform {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink-1);
}
.gd-platform .pdot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0;
}
.gd-platform.google   .pdot { background: var(--p-google); }
.gd-platform.meta     .pdot { background: var(--p-meta); }
.gd-platform.linkedin .pdot { background: var(--p-linkedin); }
.gd-platform.rd_station .pdot { background: var(--p-rd); }
.gd-platform.all      .pdot { background: var(--p-multi); }
.gd-platform .plogo {
  width: 14px; height: 14px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

/* Progress (testing) */
.gd-progress {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gd-progress-label {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
}
.gd-progress-track {
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.gd-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--testing), var(--brand));
  transition: width .4s ease;
}
.gd-progress-fill.done { background: var(--pos); }
.gd-progress-fill.broken { background: var(--neg); }

/* ============================================================ */
/* Detail panel (right)                                          */
/* ============================================================ */

.gd-detail {
  border-left: 1px solid var(--line);
  background: var(--bg-1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
}
.gd-detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  text-align: center;
  color: var(--ink-2);
  font-size: var(--t-sm);
}
.gd-detail-empty .glyph {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px dashed var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}

.gd-detail-head {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg-1);
  z-index: 2;
}
.gd-detail-id {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.gd-detail-title {
  font-size: var(--t-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--ink-0);
  line-height: 1.3;
}
.gd-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.gd-cu-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-family: var(--font-mono);
  color: var(--ink-3); text-decoration: none;
  padding: 2px 7px; border-radius: 4px;
  border: 1px solid var(--line);
  transition: color .15s, border-color .15s;
}
.gd-cu-link:hover { color: var(--brand); border-color: var(--brand); }

.gd-detail-section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.gd-detail-section:last-child { border-bottom: none; }
.gd-detail-section h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  margin: 0 0 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gd-hypothesis {
  font-size: var(--t-md);
  color: var(--ink-0);
  line-height: 1.55;
  padding: 12px 14px;
  background: var(--bg-2);
  border-left: 2px solid var(--brand-dim);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.gd-hypothesis em { font-style: normal; color: var(--brand); font-weight: 500; }

/* Metric grid */
.gd-mgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.gd-mcell {
  background: var(--bg-1);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gd-mcell .lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  font-weight: 500;
}
.gd-mcell .val {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-0);
  display: flex;
  align-items: baseline;
  gap: 6px;
  letter-spacing: -0.01em;
  font-family: var(--font-mono);
}
.gd-mcell .val .unit { font-size: var(--t-sm); color: var(--ink-2); font-weight: 400; font-family: var(--font-sans); }
.gd-mcell .vs {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--ink-2);
  display: flex; gap: 6px; align-items: center;
}
.gd-mcell .vs .delta.up { color: var(--pos); }
.gd-mcell .vs .delta.down { color: var(--neg); }

/* Evidence table */
.gd-evtable {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  font-size: var(--t-xs);
}
.gd-evtable table { width: 100%; border-collapse: collapse; }
.gd-evtable th {
  background: var(--bg-2);
  text-align: left;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  font-weight: 600;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
}
.gd-evtable td {
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-1);
  font-family: var(--font-mono);
}
.gd-evtable tr:last-child td { border-bottom: none; }
.gd-evtable td:first-child {
  color: var(--ink-0);
  font-family: var(--font-sans);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gd-evtable td.bad { color: var(--neg); }
.gd-evtable td.good { color: var(--pos); }
.gd-evtable td.muted { color: var(--ink-3); }

/* Timeline */
.gd-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.gd-timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 4px; bottom: 4px;
  width: 1px; background: var(--line);
}
.gd-timeline li {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  font-size: var(--t-sm);
  position: relative;
}
.gd-timeline .tl-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg-1);
  border: 1.5px solid var(--ink-3);
  flex-shrink: 0;
  margin-top: 2px;
  z-index: 1;
}
.gd-timeline li.done .tl-dot { background: var(--pos); border-color: var(--pos); }
.gd-timeline li.now .tl-dot {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(255, 45, 120, 0.15);
}
.gd-timeline .tl-content { flex: 1; min-width: 0; }
.gd-timeline .tl-when { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-2); }
.gd-timeline .tl-what { color: var(--ink-0); font-weight: 500; }
.gd-timeline .tl-who { color: var(--ink-2); font-size: var(--t-xs); }

/* ============================================================ */
/* Modal                                                        */
/* ============================================================ */

.gd-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 10, 0.78);
  backdrop-filter: blur(10px) saturate(120%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.gd-modal {
  width: 600px;
  max-width: 100%;
  max-height: 86vh;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--brand);
  border-radius: var(--r-xl);
  box-shadow:
    0 0 0 1px rgba(255,45,120,.06),
    0 32px 80px rgba(0,0,0,.7),
    0 0 80px rgba(255,45,120,.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: rise .22s cubic-bezier(.16,1,.3,1);
}
.gd-modal.lg { width: 760px; }
.gd-modal.sm { width: 440px; }
@keyframes rise {
  from { transform: translateY(10px) scale(.99); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.gd-modal-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(150deg, rgba(255,45,120,.07) 0%, transparent 55%);
}
.gd-modal-head h3 {
  font-size: var(--t-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--brand);
}
.gd-modal-head p { font-size: var(--t-sm); color: var(--ink-2); margin: 0; }

.gd-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.gd-modal-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-2);
}

.gd-field { margin-bottom: 18px; }
.gd-field label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--brand-dim);
  margin-bottom: 7px;
  font-weight: 700;
}
.gd-field .hint { font-size: var(--t-xs); color: var(--ink-3); margin-top: 6px; }
.gd-input,
.gd-textarea,
.gd-select {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 9px 12px;
  color: var(--ink-0);
  font-size: var(--t-md);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  color-scheme: dark;
}
.gd-input:focus, .gd-textarea:focus, .gd-select:focus {
  border-color: var(--brand);
  background: var(--bg-0);
  box-shadow: 0 0 0 3px rgba(255,45,120,.12);
}
.gd-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.gd-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gd-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* Verdict / option cards */
.gd-vopts { display: flex; flex-direction: column; gap: 8px; }
.gd-vopt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--bg-0);
  cursor: pointer;
  text-align: left;
  transition: all .14s;
}
.gd-vopt:hover { background: var(--bg-2); border-color: var(--brand-dim); }

/* verdict-specific colors */
.gd-vopt.pos { border-color: var(--pos-line); }
.gd-vopt.pos:hover { border-color: var(--pos); background: var(--pos-bg); }
.gd-vopt.neutral { border-color: var(--neutral-line); }
.gd-vopt.neutral:hover { border-color: var(--neutral); background: var(--neutral-bg); }
.gd-vopt.neg { border-color: var(--neg-line); }
.gd-vopt.neg:hover { border-color: var(--neg); background: var(--neg-bg); }

/* selected states */
.gd-vopt.selected {
  border-color: var(--brand);
  background: rgba(255,45,120,.07);
  box-shadow: 0 0 0 1px rgba(255,45,120,.15) inset;
}
.gd-vopt.selected.pos { border-color: var(--pos); background: var(--pos-bg); box-shadow: none; }
.gd-vopt.selected.neutral { border-color: var(--neutral); background: var(--neutral-bg); box-shadow: none; }
.gd-vopt.selected.neg { border-color: var(--neg); background: var(--neg-bg); box-shadow: none; }

.gd-vopt .vico { font-size: 18px; flex-shrink: 0; }
.gd-vopt .vlabel { font-size: var(--t-md); font-weight: 600; color: var(--ink-0); }
.gd-vopt.pos .vlabel { color: var(--pos); }
.gd-vopt.neutral .vlabel { color: var(--neutral); }
.gd-vopt.neg .vlabel { color: var(--neg); }
.gd-vopt.selected .vlabel { color: var(--brand); }
.gd-vopt.selected.pos .vlabel { color: var(--pos); }
.gd-vopt.selected.neutral .vlabel { color: var(--neutral); }
.gd-vopt.selected.neg .vlabel { color: var(--neg); }
.gd-vopt .vdesc { font-size: var(--t-xs); color: var(--ink-2); }

/* For vopts that use <strong>/<span> instead of .vlabel/.vdesc */
.gd-vopt strong { font-size: var(--t-md); font-weight: 600; color: var(--ink-0); }
.gd-vopt span   { font-size: var(--t-xs); color: var(--ink-2); }
.gd-vopt.selected strong { color: var(--brand); }

.gd-start-skip {
  background: none; border: none; padding: 0;
  font-size: 12px; color: var(--ink-2); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line);
}
.gd-start-skip:hover { color: var(--ink-0); text-decoration-color: var(--ink-2); }

/* AI banner */
.gd-ai {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--brand-dim);
  background: linear-gradient(180deg, rgba(255, 45, 120, 0.06), rgba(255, 45, 120, 0.02));
  border-radius: var(--r-md);
  margin-bottom: 16px;
  font-size: var(--t-sm);
  color: var(--ink-1);
  line-height: 1.5;
}
.gd-ai .ai-mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.gd-ai .ai-body strong { color: var(--ink-0); }

/* Comparison table */
.gd-compare {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.gd-compare h5 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  margin: 0 0 10px;
  font-weight: 600;
}
.gd-compare-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  font-size: var(--t-sm);
}
.gd-compare-row:last-child { border-bottom: none; }
.gd-compare-row .lbl { color: var(--ink-2); }
.gd-compare-row .val { color: var(--ink-1); font-family: var(--font-mono); font-size: var(--t-xs); }
.gd-compare-row .arr { color: var(--ink-3); font-size: 10px; }
.gd-compare-row .new { color: var(--ink-0); font-family: var(--font-mono); font-weight: 600; font-size: var(--t-sm); }
.gd-compare-row .new.up { color: var(--pos); }
.gd-compare-row .new.down { color: var(--neg); }
.gd-compare-row .delta { font-family: var(--font-mono); font-size: var(--t-xs); }
.gd-compare-row .delta.up { color: var(--pos); }
.gd-compare-row .delta.down { color: var(--neg); }

/* ============================================================ */
/* Empty / generic                                               */
/* ============================================================ */

.gd-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  color: var(--ink-2);
  font-size: var(--t-md);
  gap: 8px;
}
.gd-empty p { margin: 4px 0; }
.gd-empty .ttl { color: var(--ink-0); font-weight: 500; font-size: var(--t-lg); }

.gd-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  gap: 8px;
}
.gd-loading::before {
  content: "";
  width: 12px; height: 12px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spark-svg { display: block; width: 100%; height: 100%; }

/* ============================================================ */
/* Dashboard                                                    */
/* ============================================================ */

.gd-dash {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.gd-dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.gd-dash-cell {
  padding: 22px 26px;
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.gd-dash-cell .lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  font-weight: 600;
}
.gd-dash-cell .val {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.gd-dash-cell .val.brand { color: var(--brand); }
.gd-dash-cell .val.pos { color: var(--pos); }
.gd-dash-cell .val.neg { color: var(--neg); }
.gd-dash-cell .val.neutral { color: var(--neutral); }
.gd-dash-cell .val.testing { color: var(--testing); }

/* Platform table */
.gd-plat-table {
  display: flex;
  flex-direction: column;
}
.gd-plat-row {
  display: grid;
  grid-template-columns: 220px repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
}
.gd-plat-head {
  background: var(--bg-1);
  position: sticky;
  top: 0;
  z-index: 2;
}
.gd-plat-head .gd-plat-cell {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  font-weight: 600;
  padding: 10px 14px;
}
.gd-plat-cell {
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink-0);
}
.gd-plat-cell:last-child { border-right: none; }
.gd-plat-cell.zero { color: var(--ink-3); }
.gd-plat-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: var(--t-md);
  font-weight: 500;
  color: var(--ink-0);
}
.gd-plat-logo {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  color: white;
  background: var(--bg-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.gd-plat-logo img {
  width: 20px; height: 20px;
  object-fit: contain;
  display: block;
}
.gd-plat-logo.all { background: var(--brand); color: var(--brand-ink); }

/* Funnel viz */
.gd-funnel {
  display: flex;
  align-items: stretch;
  gap: 1px;
  height: 18px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-3);
}
.gd-funnel > span {
  display: block;
  height: 100%;
}

/* ============================================================ */
/* Matrix 2x2                                                   */
/* ============================================================ */

.gd-matrix-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}
.gd-matrix {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  width: 100%;
  height: 540px;
  overflow: hidden;
}
.gd-matrix-grid {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.gd-matrix-q {
  border-right: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  padding: 12px 16px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
  position: relative;
}
.gd-matrix-q:nth-child(2) { border-right: none; }
.gd-matrix-q:nth-child(3), .gd-matrix-q:nth-child(4) { border-bottom: none; }
.gd-matrix-q:nth-child(4) { border-right: none; }
.gd-matrix-axis-x, .gd-matrix-axis-y {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.gd-matrix-axis-x { bottom: 6px; left: 50%; transform: translateX(-50%); }
.gd-matrix-axis-y { top: 50%; left: -38px; transform: rotate(-90deg) translateX(50%); transform-origin: center; }
.gd-matrix-dot {
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--bg-1);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform .15s, box-shadow .15s;
}
.gd-matrix-dot:hover {
  transform: translate(-50%, -50%) scale(1.4);
  box-shadow: 0 0 0 4px rgba(255, 45, 120, 0.2);
  z-index: 2;
}
.gd-matrix-dot.pos { background: var(--pos); }
.gd-matrix-dot.neg { background: var(--neg); }
.gd-matrix-dot.neutral { background: var(--neutral); }
.gd-matrix-dot.testing { background: var(--testing); }
.gd-matrix-dot.draft { background: var(--ink-3); }

/* ============================================================ */
/* Casca / Governance                                            */
/* ============================================================ */

.gd-casca {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-content: start;
}
.gd-casca-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.gd-casca-card.full { grid-column: 1 / -1; }
.gd-casca-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gd-casca-head h4 {
  font-size: var(--t-md);
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gd-casca-body { padding: 14px 18px; }

.gd-source-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.gd-source-row:last-child { border-bottom: none; }
.gd-source-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--t-sm);
  font-weight: 500;
}
.gd-source-name .ico {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10px;
  color: white;
  letter-spacing: 0.02em;
}
.gd-health {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--t-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.gd-health::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.gd-health.ok { color: var(--pos); }
.gd-health.warn { color: var(--pending); }
.gd-health.err { color: var(--neg); }

.gd-policy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}
.gd-policy-row:last-child { border-bottom: none; }
.gd-policy-name {
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink-0);
}
.gd-policy-desc {
  font-size: var(--t-xs);
  color: var(--ink-2);
  margin-top: 2px;
}

.gd-toggle {
  width: 32px; height: 18px;
  background: var(--bg-3);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.gd-toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink-2);
  transition: all .15s;
}
.gd-toggle.on { background: var(--brand); }
.gd-toggle.on::after { background: var(--brand-ink); transform: translateX(14px); }
.gd-toggle.locked { opacity: 0.6; cursor: not-allowed; }
.gd-toggle.locked::after { background: var(--ink-3); }

/* ============================================================ */
/* Patterns                                                     */
/* ============================================================ */

.gd-patterns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  padding: 24px 28px;
}
.gd-pattern-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gd-pattern-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.gd-pattern-title {
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--ink-0);
  line-height: 1.4;
}
.gd-pattern-desc {
  font-size: var(--t-sm);
  color: var(--ink-1);
  line-height: 1.5;
}
.gd-pattern-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: var(--t-xs);
  color: var(--ink-2);
}
.gd-pattern-suggestion {
  margin-top: 4px;
  padding: 8px 12px;
  background: rgba(255, 45, 120, 0.05);
  border: 1px solid var(--brand-dim);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  color: var(--brand-soft);
  line-height: 1.5;
}

.gd-sev {
  font-size: var(--t-xs);
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  border: 1px solid;
  flex-shrink: 0;
}
.gd-sev.high { color: var(--neg); background: var(--neg-bg); border-color: var(--neg-line); }
.gd-sev.medium { color: var(--pending); background: var(--pending-bg); border-color: var(--pending-line); }
.gd-sev.low { color: var(--ink-2); background: var(--bg-2); border-color: var(--line); }

/* ============================================================ */
/* Chat                                                         */
/* ============================================================ */

.gd-chat-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 240px;
  min-height: 0;
  overflow: hidden;
}

.gd-chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Histórico de conversas */
.gd-chat-history {
  border-left: 1px solid var(--line);
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.gd-chat-history-head {
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.gd-chat-history-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}
.gd-chat-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gd-chat-history-empty {
  padding: 20px 10px;
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.5;
}
.gd-chat-conv {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--r-md);
  text-align: left;
  border: 1px solid transparent;
  transition: background .1s, border-color .1s;
}
.gd-chat-conv:hover { background: var(--bg-2); }
.gd-chat-conv.active { background: var(--bg-3); border-color: var(--line); }
.gd-chat-conv-title {
  font-size: 12px;
  color: var(--ink-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
.gd-chat-conv.active .gd-chat-conv-title { color: var(--ink-0); font-weight: 500; }
.gd-chat-conv-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
}
.gd-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gd-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
}
/* chat logo (replaces .glyph) */
.gd-chat-logo {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: block;
}

/* message wrapper — controls alignment per role */
.gd-msg-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 78%;
}
.gd-msg-wrap.user { align-self: flex-end; align-items: flex-end; }
.gd-msg-wrap.bot  { align-self: flex-start; align-items: flex-start; }

/* sender label above each message */
.gd-msg-sender {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--ink-3);
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 0 4px;
}

/* typing indicator — three pulsing dots */
.gd-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
}
.gd-typing span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink-2);
  animation: gd-dot-pulse 1.2s ease-in-out infinite;
}
.gd-typing span:nth-child(2) { animation-delay: .2s; }
.gd-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes gd-dot-pulse {
  0%, 80%, 100% { opacity: .3; transform: scale(.8); }
  40%           { opacity: 1;  transform: scale(1);   }
}

/* collapsed history sidebar */
.gd-chat-shell[data-history-collapsed="true"] {
  grid-template-columns: 1fr 40px;
}
.gd-chat-shell[data-history-collapsed="true"] .gd-chat-history-list,
.gd-chat-shell[data-history-collapsed="true"] .gd-chat-history-label,
.gd-chat-shell[data-history-collapsed="true"] .gd-chat-history-new { display: none; }
.gd-chat-shell[data-history-collapsed="true"] .gd-chat-history {
  padding: 12px 0;
  align-items: center;
  border-left: 1px solid var(--line);
}
.gd-chat-shell[data-history-collapsed="true"] .gd-chat-history-head {
  justify-content: center;
  padding: 0;
}

.gd-chat-empty .glyph {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
}
.gd-chat-empty p { color: var(--ink-1); margin: 0; }
.gd-chat-empty small { color: var(--ink-2); font-size: var(--t-sm); }
.gd-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
  width: 100%;
  max-width: 540px;
}
.gd-suggestion {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: var(--t-sm);
  color: var(--ink-1);
  text-align: left;
  transition: all .12s;
}
.gd-suggestion:hover { border-color: var(--brand-dim); color: var(--ink-0); background: var(--bg-3); }

.gd-msg {
  max-width: 78%;
  padding: 11px 16px;
  border-radius: 14px;
  font-size: var(--t-md);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.gd-msg.user {
  align-self: flex-end;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 500;
  border-bottom-right-radius: 4px;
}
.gd-msg.bot {
  align-self: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.gd-msg.bot.loading { color: var(--ink-2); font-style: italic; }

.gd-chat-form {
  padding: 14px 28px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-1);
}
.gd-chat-form textarea {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 11px 14px;
  color: var(--ink-0);
  font-size: var(--t-md);
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color .15s;
  font-family: inherit;
}
.gd-chat-form textarea:focus { border-color: var(--brand-dim); }
.gd-chat-send {
  width: 36px; height: 36px;
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s;
}
.gd-chat-send:hover { opacity: 0.85; }
.gd-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* Darwin avatar badge */
.gd-darwin-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px; height: 13px;
  border-radius: 3px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 7px;
  font-weight: 800;
  font-family: var(--font-mono);
  flex-shrink: 0;
  letter-spacing: -.5px;
}
.gd-darwin-av.lg {
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 16px;
}

/* Darwin AI Hero */
.gd-darwin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--brand-dim);
  border-radius: var(--r-lg);
  padding: 24px 28px;
  margin: 0 0 24px;
}
.gd-darwin-hero-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.gd-darwin-hero-id {
  display: flex;
  align-items: center;
  gap: 12px;
}
.gd-darwin-hero-name {
  font-size: var(--t-lg);
  font-weight: 700;
  color: var(--ink-0);
  letter-spacing: -.02em;
}
.gd-darwin-hero-role {
  font-size: var(--t-xs);
  margin-top: 2px;
}
.gd-darwin-hero-desc {
  font-size: var(--t-md);
  color: var(--ink-1);
  line-height: 1.65;
  max-width: 560px;
  margin: 0;
}
.gd-darwin-hero-desc em {
  color: var(--neg);
  font-style: normal;
  font-weight: 600;
}
.gd-darwin-hero-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 140px;
}
.gd-darwin-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gd-darwin-stat .val {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--ink-0);
  line-height: 1;
}
.gd-darwin-stat .lbl {
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Consultar Darwin button */
.gd-darwin-consult-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: rgba(255,45,120,0.06);
  border: 1px solid rgba(255,45,120,0.2);
  border-radius: var(--r-md);
  color: var(--brand);
  font-size: var(--t-sm);
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: background .12s, border-color .12s, box-shadow .12s;
  cursor: pointer;
  margin-top: 4px;
  position: relative;
  overflow: hidden;
}
.gd-darwin-consult-btn::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
  opacity: 0.7;
}
.gd-darwin-consult-btn:hover {
  background: rgba(255,45,120,0.12);
  border-color: rgba(255,45,120,0.45);
  box-shadow: 0 0 12px rgba(255,45,120,0.08);
  color: var(--brand);
}

/* ============================================================ */
/* Toast / Casca alert                                           */
/* ============================================================ */

.gd-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 10px 16px;
  font-size: var(--t-sm);
  color: var(--ink-0);
  box-shadow: 0 12px 32px rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: rise .2s ease;
}
.gd-toast .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}
.gd-toast.error { border-color: var(--neg-line); }
.gd-toast.error .dot { background: var(--neg); }

/* ============================================================ */
/* Period / Date-range picker                                   */
/* ============================================================ */

.gd-period-picker {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.gd-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 6px 10px;
  animation: gd-slide-down .12s ease;
}

@keyframes gd-slide-down {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gd-date-range-sep {
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-family: var(--font-mono);
  letter-spacing: .04em;
  white-space: nowrap;
}

.gd-date-input {
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--ink-0);
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  padding: 4px 8px;
  height: 28px;
  outline: none;
  cursor: pointer;
  transition: border-color .12s;
  color-scheme: dark;
}
.gd-date-input:hover  { border-color: var(--ink-3); }
.gd-date-input:focus  { border-color: var(--brand); }

/* loading label next to picker */
.gd-period-loading {
  font-size: var(--t-xs);
  color: var(--ink-3);
  font-family: var(--font-mono);
  letter-spacing: .04em;
  animation: gd-blink 1.2s ease infinite;
}
@keyframes gd-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

/* utility */
.muted { color: var(--ink-2); }
.tnum { font-variant-numeric: tabular-nums; }
.text-mono { font-family: var(--font-mono); }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
