/* Ground Truth UI Kit — shared styles for the click-thru prototype.
 * Builds on /colors_and_type.css with kit-specific layout + chrome.
 */

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ===== App shell ===== */
.app {
  display: grid;
  grid-template-columns: 224px 1fr;
  height: 100vh;
  overflow: hidden;
}
.app.chat-open { grid-template-columns: 224px 1fr 480px; }

/* ===== Sidebar ===== */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 6px 12px 6px;
}
.sidebar .brand svg { width: 24px; height: 24px; color: var(--foreground); }
.sidebar .brand .name {
  font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em;
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 9px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--foreground);
  cursor: pointer;
  user-select: none;
  border: none; background: transparent; text-align: left; width: 100%;
  font-family: inherit;
}
.sidebar .nav-item .icon { width: 14.5px; height: 14.5px; color: var(--muted-foreground); flex-shrink: 0; }
.sidebar .nav-item:hover { background: var(--muted); }
.sidebar .nav-item.active { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.sidebar .nav-item.active .icon { color: var(--sidebar-accent-foreground); }
.sidebar .nav-item .nav-badge {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 6px;
  border-radius: 999px;
  background: oklch(0.62 0.22 264 / 0.18);
  color: var(--gt-purple-light);
  font-size: 10px; font-weight: 600; font-family: var(--font-mono);
}
.sidebar hr {
  border: none; height: 1px; background: var(--sidebar-border);
  margin: 8px 4px;
}
.sidebar .sb-footer {
  margin-top: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 6px 4px 6px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 11.5px; color: var(--muted-foreground);
}

/* ===== Main pane ===== */
.main {
  display: flex; flex-direction: column;
  overflow: hidden;
}
.header {
  height: 52px; flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: oklch(0.14 0.006 75 / 0.95);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.header .page-title { font-size: 13.5px; font-weight: 500; }
.header .sep { width: 1px; height: 18px; background: var(--border); }
.header .spacer { flex: 1; }
.header .header-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; border: none; background: transparent;
  color: var(--foreground); cursor: pointer; position: relative;
}
.header .header-btn:hover { background: var(--muted); }
.header .header-btn .icon { width: 15px; height: 15px; }
.header .header-btn .dot {
  position: absolute; top: 4px; right: 4px;
  width: 6px; height: 6px; border-radius: 999px;
  background: oklch(0.65 0.22 27);
}
.header .avatar {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: oklch(0.62 0.22 264 / 0.15);
  color: var(--gt-purple-light);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 600;
  cursor: pointer; user-select: none;
}

.content {
  flex: 1; overflow-y: auto;
  padding: 22px 24px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: all 0.15s;
  background: var(--primary);
  color: var(--primary-foreground);
}
.btn:hover { background: oklch(0.62 0.22 264 / 0.85); box-shadow: var(--glow-purple); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn .icon { width: 14px; height: 14px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); border-color: transparent; }
.btn-secondary:hover { background: oklch(0.24 0.006 75 / 0.8); box-shadow: none; }
.btn-outline { background: transparent; color: var(--foreground); border-color: var(--border); }
.btn-outline:hover { background: var(--muted); box-shadow: none; }
.btn-ghost { background: transparent; color: var(--foreground); border-color: transparent; }
.btn-ghost:hover { background: var(--muted); box-shadow: none; }
.btn-ai { background: transparent; color: var(--gt-purple-light); border: 1px solid var(--border); }
.btn-ai:hover { background: oklch(0.62 0.22 264 / 0.08); border-color: oklch(0.62 0.22 264 / 0.4); box-shadow: none; }

/* ===== Badges & pills ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px;
  border-radius: 26px;
  font-size: 11px; font-weight: 500;
  background: var(--secondary); color: var(--secondary-foreground);
  white-space: nowrap;
}
.pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
  white-space: nowrap;
}
.pill-risk      { background: var(--signal-risk-bg);      color: var(--signal-risk); }
.pill-upsell    { background: var(--signal-upsell-bg);    color: var(--signal-upsell); }
.pill-crosssell { background: var(--signal-crosssell-bg); color: var(--signal-crosssell); }
.pill-action    { background: var(--signal-action-bg);    color: var(--signal-action); }

.health-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.health-growing   { background: color-mix(in oklch, var(--health-growing) 12%, transparent);   color: var(--health-growing); }
.health-stable    { background: color-mix(in oklch, var(--health-stable) 12%, transparent);    color: var(--health-stable); }
.health-declining { background: color-mix(in oklch, var(--health-declining) 12%, transparent); color: var(--health-declining); }
.health-at_risk   { background: color-mix(in oklch, var(--health-at-risk) 15%, transparent);   color: var(--health-at-risk); }

/* ===== Cards ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* ===== Form fields ===== */
.input {
  height: 32px;
  padding: 0 11px;
  background: oklch(0.24 0.006 75 / 0.5);
  border: 1px solid oklch(1 0.004 80 / 0.06);
  border-radius: 8px;
  color: var(--foreground);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  width: 100%;
}
.input:focus {
  background: var(--background);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px oklch(0.62 0.22 264 / 0.22);
}
.input::placeholder { color: oklch(0.60 0.006 80 / 0.6); }

.input-wrap { position: relative; display: inline-flex; align-items: center; }
.input-wrap .input { padding-left: 30px; }
.input-wrap .lead-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--muted-foreground);
  pointer-events: none;
}

/* ===== Labels ===== */
.label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted-foreground);
}
.eyebrow {
  font-size: 11.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--primary);
}
.muted { color: var(--muted-foreground); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
.h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
.h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }

/* ===== Tables ===== */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted-foreground);
  padding: 10px 10px; border-bottom: 1px solid var(--border);
  text-align: left;
  background: var(--card);
  position: sticky; top: 0; z-index: 1;
}
.table tbody td {
  padding: 10px 10px;
  border-bottom: 1px solid oklch(1 0.004 80 / 0.06);
}
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: oklch(0.24 0.006 75 / 0.4); }
.table tbody tr.selected { background: var(--sidebar-accent); }
.table tbody tr:last-child td { border-bottom: none; }
.t-right { text-align: right; }
.t-center { text-align: center; }

/* ===== Dense signal row ===== */
.list-card { padding: 0; overflow: hidden; }
.dense-row {
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; height: 48px;
  border-bottom: 1px solid oklch(1 0.004 80 / 0.06);
  cursor: pointer;
  transition: background 0.1s;
}
.dense-row:last-child { border-bottom: none; }
.dense-row:hover { background: oklch(0.24 0.006 75 / 0.4); }
.dense-row.selected { background: oklch(0.62 0.22 264 / 0.06); }
.dense-row.expanded { background: oklch(0.24 0.006 75 / 0.3); }
.dense-row .sev-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.dense-row .headline {
  flex: 1; min-width: 0;
  font-size: 13px; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dense-row .headline-text { font-weight: 500; }
.dense-row .headline-cat {
  margin-left: 5px;
  font-size: 8.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  vertical-align: super;
}
.dense-row .headline-sep { margin: 0 6px; color: oklch(0.60 0.006 80 / 0.5); }
.dense-row .headline-acct { font-size: 12px; font-weight: 600; }
.dense-row .meta-time { font-size: 11.5px; color: var(--muted-foreground); flex-shrink: 0; }
.dense-row .meta-amt {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.dense-row .chev {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted-foreground); opacity: 0.5;
  border-radius: 5px; cursor: pointer; flex-shrink: 0;
}
.dense-row:hover .chev { opacity: 1; }

.dense-row .checkbox-wrap {
  width: 16px; height: 16px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.checkbox {
  width: 14px; height: 14px;
  border-radius: 4px; border: 1.5px solid var(--border);
  background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.1s;
}
.checkbox.checked {
  background: var(--primary); border-color: var(--primary);
}
.checkbox.checked::after {
  content: ''; width: 7px; height: 4px;
  border-left: 1.5px solid white; border-bottom: 1.5px solid white;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* ===== Expanded signal panel ===== */
.signal-expand {
  padding: 18px 48px 22px 48px;
  background: oklch(0.24 0.006 75 / 0.18);
  border-bottom: 1px solid oklch(1 0.004 80 / 0.06);
  font-size: 13px; line-height: 1.5;
}
.signal-expand .meta-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.signal-expand h3 {
  font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 4px 0 4px 0;
}
.signal-expand .acct-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted-foreground); flex-wrap: wrap;
}
.signal-expand .acct-line .ico { width: 12px; height: 12px; }
.signal-expand .why {
  margin-top: 16px;
  padding: 12px;
  background: oklch(0.24 0.012 264 / 0.5);
  border: 1px solid oklch(0.62 0.22 264 / 0.25);
  border-radius: 9px;
  display: flex; gap: 10px;
}
.signal-expand .why svg { width: 16px; height: 16px; color: var(--gt-purple-light); flex-shrink: 0; margin-top: 1px; }
.signal-expand .why-text { font-size: 13px; line-height: 1.55; }
.signal-expand .section-label {
  margin-top: 16px;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted-foreground);
  margin-bottom: 8px;
}
.signal-expand .evidence-list {
  list-style: none; padding: 0; margin: 0;
}
.signal-expand .evidence-list li {
  display: flex; gap: 10px;
  padding: 4px 0; font-size: 13px;
}
.signal-expand .evidence-list li svg {
  width: 14px; height: 14px; color: var(--muted-foreground);
  flex-shrink: 0; margin-top: 3px;
}
.signal-expand .actions-row { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* ===== Top Picks card ===== */
.top-picks {
  border-radius: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, oklch(0.24 0.012 264 / 0.55) 0%, oklch(0.19 0.006 75) 100%);
  border: 1px solid oklch(0.62 0.22 264 / 0.3);
  box-shadow: var(--glow-purple), inset 0 1px 0 oklch(1 0 0 / 0.04);
  margin-bottom: 18px;
}
.top-picks .tp-head { display: flex; align-items: center; gap: 8px; }
.top-picks .tp-head svg { width: 16px; height: 16px; color: var(--gt-purple-light); }
.top-picks .tp-head .title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gt-purple-light); }
.top-picks .tp-head .count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); }
.top-picks .tp-subhead { font-size: 17px; font-weight: 700; margin: 6px 0 10px 0; letter-spacing: -0.01em; }
.top-picks .tp-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0; font-size: 12.5px;
  border-top: 1px solid oklch(1 0.004 80 / 0.06);
  cursor: pointer;
}
.top-picks .tp-item:first-of-type { border-top: none; }
.top-picks .tp-item .dot { width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; }
.top-picks .tp-item .acct { font-weight: 600; }
.top-picks .tp-item .stub { color: var(--muted-foreground); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-picks .tp-item .amt { font-family: var(--font-mono); font-weight: 600; font-size: 12px; }

/* ===== Filter rail (left of /signals) ===== */
.filter-rail {
  width: 200px; flex-shrink: 0;
  padding: 0 18px 20px 0;
  border-right: 1px solid var(--border);
}
.filter-rail .rail-section { margin-bottom: 22px; }
.filter-rail .rail-title {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted-foreground);
  margin-bottom: 10px;
}
.filter-rail .rail-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px;
  font-size: 12.5px; cursor: pointer; user-select: none;
}
.filter-rail .rail-item:hover { background: var(--muted); }
.filter-rail .rail-item.active { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); font-weight: 500; }
.filter-rail .rail-item .ico { width: 10px; height: 10px; border-radius: 999px; }
.filter-rail .rail-item .rail-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px; color: var(--muted-foreground);
}

/* ===== Slide-over panel (account detail) ===== */
.slide-over-backdrop {
  position: absolute; inset: 0;
  background: oklch(0 0 0 / 0.4); z-index: 50;
  animation: fadein 0.18s ease-out;
}
.slide-over {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 560px; max-width: 80vw;
  background: var(--card);
  border-left: 1px solid var(--border);
  z-index: 51;
  display: flex; flex-direction: column;
  animation: slidein 0.22s ease-out;
}
.app.chat-open .slide-over { right: 480px; }
.slide-over .so-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
}
.slide-over .so-content { flex: 1; overflow-y: auto; padding: 18px 22px; }
.slide-over .so-tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--border); }
.slide-over .so-tab {
  padding: 9px 12px;
  font-size: 12.5px; color: var(--muted-foreground);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; background: transparent; border-left: none; border-right: none; border-top: none;
  font-family: inherit;
}
.slide-over .so-tab.active { color: var(--foreground); border-bottom-color: var(--primary); font-weight: 500; }
.slide-over .so-close {
  margin-left: auto;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted-foreground); padding: 6px;
}

/* ===== Chat panel ===== */
.chat-panel {
  border-left: 1px solid var(--border);
  background: var(--card);
  display: flex; flex-direction: column;
}
.chat-panel .cp-header {
  height: 52px; flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid var(--border);
}
.chat-panel .cp-header .cp-title { font-size: 13.5px; font-weight: 600; }
.chat-panel .cp-content {
  flex: 1; overflow-y: auto;
  padding: 18px 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.chat-msg {
  font-size: 13px; line-height: 1.5;
}
.chat-msg.user {
  align-self: flex-end; max-width: 85%;
  background: var(--primary); color: var(--primary-foreground);
  padding: 8px 12px; border-radius: 13px; border-bottom-right-radius: 4px;
}
.chat-msg.ai {
  max-width: 95%;
}
.chat-msg.ai .who {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--gt-purple-light); margin-bottom: 4px;
}
.chat-msg.ai .who svg { width: 12px; height: 12px; }
.chat-msg.ai .action-card {
  margin-top: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--background);
  font-size: 12.5px;
}
.chat-msg.ai .action-card .label { display: block; margin-bottom: 5px; }
.chat-msg.ai .action-card .actions { display: flex; gap: 6px; margin-top: 10px; }
.chat-panel .cp-input-wrap {
  padding: 12px 14px 14px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-panel .cp-input {
  width: 100%; min-height: 60px; resize: none;
  background: var(--background); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 11px;
  color: var(--foreground); font-family: inherit; font-size: 13px;
  outline: none;
}
.chat-panel .cp-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px oklch(0.62 0.22 264 / 0.18); }
.chat-panel .cp-input-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.chat-panel .cp-input-row .hint { font-size: 10.5px; color: var(--muted-foreground); }

/* ===== Animations ===== */
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes pageenter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-enter { animation: pageenter 0.35s ease-out; }

@keyframes stagger {
  to { opacity: 1; transform: translateY(0); }
}
.stagger > * {
  opacity: 0; transform: translateY(6px);
  animation: stagger 0.3s ease-out forwards;
}
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; }

/* ===== Utility ===== */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
