/* Each meeting's Insights section, the Insights page and the admin switch.
   Blue is the page's own chrome. What Chief read from a call is coloured by
   what it means for the deal: green moving forward, amber at risk, red stalled,
   grey neutral. */

:root {
  --insight-positive: var(--color-success);
  --insight-positive-text: #4b7300;
  --insight-positive-tint: rgb(from var(--color-success) r g b / 0.16);
  --insight-caution: var(--color-warning);
  --insight-caution-text: #8a6100;
  --insight-caution-tint: rgb(from var(--color-warning) r g b / 0.18);
  --insight-negative: var(--color-danger);
  --insight-negative-text: #c62828;
  --insight-negative-tint: rgb(from var(--color-danger) r g b / 0.12);
  --insight-neutral: #9aa8ba;
}

.insight-hint {
  color: var(--theme-text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-lg);
}

.insight-hint-last {
  margin-bottom: 0;
}

.insight-empty-hint {
  color: var(--theme-text-muted);
  font-size: var(--font-size-sm);
}

/* A meeting's Insights section */
.insight-subheading {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--theme-text);
  margin-bottom: var(--spacing-md);
}

.insight-quote {
  margin: var(--spacing-sm) 0 var(--spacing-md);
  padding-left: var(--spacing-md);
  border-left: 2px solid var(--theme-border);
  color: var(--theme-text-muted);
  font-size: var(--font-size-sm);
  font-style: italic;
}

/* The top tip leads the section: it is the one thing to do differently */
.insight-tip {
  padding: var(--spacing-lg);
  border-top: 2px solid var(--color-primary);
  border-radius: var(--border-radius-sm);
  background: rgba(74, 158, 255, 0.08);
  margin-bottom: var(--spacing-lg);
}

.insight-tip-text {
  font-size: var(--font-size-md);
  color: var(--theme-text);
  margin-bottom: var(--spacing-sm);
}

.insight-tip-text strong {
  color: var(--color-primary-deep);
  font-weight: var(--font-weight-bold);
}

.insight-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-2xl);
  row-gap: var(--spacing-lg);
  padding: var(--spacing-lg);
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--border-radius-sm);
  background: rgba(74, 158, 255, 0.04);
  margin-bottom: var(--spacing-lg);
}

.insight-hero-level {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.insight-hero-wide {
  grid-column: 1 / -1;
}

.insight-hero-wide .insight-next-step {
  margin-top: 0;
}

.insight-impact {
  font-size: var(--font-size-sm);
  color: var(--theme-text);
  margin-bottom: 0;
}

.insight-chase {
  margin: var(--spacing-md) 0 0;
  font-size: var(--font-size-sm);
  color: var(--insight-caution-text);
}

.insight-uncertain {
  font-size: var(--font-size-xs);
  color: var(--theme-text-muted);
}

.insight-next-step {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  background: var(--theme-border-subtle);
  color: var(--theme-text-muted);
}

.insight-next-step-agreed {
  background: var(--insight-positive-tint);
  color: var(--insight-positive-text);
}

.insight-next-step-vague {
  background: var(--insight-caution-tint);
  color: var(--insight-caution-text);
}

.insight-next-step-mark {
  font-weight: var(--font-weight-bold);
}

.insight-questions {
  display: flex;
  gap: 2px;
  height: 28px;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  margin-bottom: var(--spacing-sm);
}

.insight-questions-open,
.insight-questions-closed {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.insight-questions-open { background: var(--color-primary-dark); color: #fff; }
.insight-questions-closed { background: var(--theme-border); color: var(--theme-text-muted); }

.insight-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
}

.insight-block {
  padding: var(--spacing-lg);
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--border-radius-sm);
}

.insight-tags {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.insight-tag-row {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  font-size: var(--font-size-sm);
}

.insight-tag {
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--insight-positive-tint);
  color: var(--insight-positive-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.insight-tag-concern {
  background: var(--insight-caution-tint);
  color: var(--insight-caution-text);
}

.insight-concern-state {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--insight-caution-text);
}

.insight-concern-resolved {
  color: var(--insight-positive-text);
}

.insight-tag-quote {
  color: var(--theme-text-muted);
  font-style: italic;
}

/* Interest level: green when they want to go ahead, amber when lukewarm, red when cold */
.insight-level {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.insight-level-hot { background: var(--insight-positive); color: var(--color-on-success); }
.insight-level-warm { background: var(--insight-positive-tint); color: var(--insight-positive-text); }
.insight-level-cool { background: var(--insight-caution-tint); color: var(--insight-caution-text); }
.insight-level-cold { background: var(--insight-negative-tint); color: var(--insight-negative-text); }
.insight-need-strong { background: var(--insight-positive-tint); color: var(--insight-positive-text); }
.insight-need-some { background: var(--insight-caution-tint); color: var(--insight-caution-text); }
.insight-need-none { background: var(--theme-border); color: var(--theme-text-muted); }
.insight-level-unrated { border: 1px solid var(--theme-border); color: var(--theme-text-muted); }

/* Admin: the per-organization switch */
.insight-switch-head {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.insight-switch-head .usage-section-title {
  margin-bottom: 0;
  margin-right: auto;
}

.insight-switch-state {
  font-weight: var(--font-weight-semibold);
  color: var(--theme-text-muted);
}

/* The Insights page */
.insight-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.insight-header-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-2xl);
}

.insight-grid .usage-section {
  margin-bottom: 0;
}

.insight-footnote {
  margin-top: var(--spacing-xl);
  color: var(--theme-text-muted);
  font-size: var(--font-size-xs);
  text-align: center;
}

.insight-empty {
  padding: var(--spacing-2xl);
  text-align: center;
}

/* What's driving deals / Sticking points */
.insight-themes-drivers { --insight-bar: var(--insight-positive); }
.insight-themes-sticking { --insight-bar: var(--insight-caution); }

.insight-theme-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.insight-theme-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--spacing-md);
  margin-bottom: 6px;
}

.insight-theme-name {
  font-weight: var(--font-weight-semibold);
  color: var(--theme-text);
}

.insight-tip-latest {
  font-style: normal;
  border-left-color: var(--color-primary);
}

.insight-theme-count {
  font-size: var(--font-size-xs);
  color: var(--theme-text-muted);
  white-space: nowrap;
}

.insight-theme-count strong {
  color: var(--theme-text);
  font-size: var(--font-size-sm);
}

.insight-bar {
  display: block;
  height: 8px;
  background: var(--theme-border);
  border-radius: 4px;
  overflow: hidden;
}

.insight-bar-fill {
  display: block;
  height: 100%;
  background: var(--insight-bar, var(--color-primary-dark));
  border-radius: 4px;
}

.insight-theme-quote {
  margin: var(--spacing-sm) 0 0;
  padding-left: var(--spacing-md);
  border-left: 2px solid var(--insight-bar);
  color: var(--theme-text-muted);
  font-size: var(--font-size-sm);
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Next steps: a donut for the rate, one bar for how firm they were */
.insight-next-steps {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--spacing-xl);
  align-items: center;
}

.insight-split-bar {
  display: flex;
  gap: 2px;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
}

.insight-split-dated { background: var(--insight-positive); }
.insight-split-undated { background: var(--insight-neutral); }
.insight-split-vague { background: var(--insight-caution); }
.insight-split-none { background: var(--insight-negative); }

.insight-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--theme-text);
}

.insight-legend li {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.insight-legend strong {
  margin-left: auto;
}

.insight-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.insight-donut {
  position: relative;
  width: 150px;
}

.insight-donut svg {
  width: 100%;
  height: auto;
  transform: rotate(-90deg);
}

.insight-donut-track {
  fill: none;
  stroke: var(--theme-border);
  stroke-width: 14;
}

.insight-donut-value {
  fill: none;
  stroke: var(--insight-positive);
  stroke-width: 14;
  stroke-linecap: round;
}

.insight-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.insight-donut-big {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--theme-text);
  line-height: 1;
}

.insight-donut-small {
  font-size: var(--font-size-xs);
  color: var(--theme-text-muted);
  margin-top: 4px;
}

/* Follow up: calls with a real need and no concrete next step */
.insight-chase-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.insight-chase-call {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  color: var(--theme-text);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

.insight-chase-call:hover {
  background: rgba(74, 158, 255, 0.06);
}

.insight-chase-list li + li {
  border-top: 1px solid var(--theme-border-subtle);
}

.insight-chase-title {
  font-weight: var(--font-weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-chase-state {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.insight-chase-state-vague { color: var(--insight-caution-text); }
.insight-chase-state-none { color: var(--insight-negative-text); }

.insight-chase-detail {
  grid-column: 1 / -1;
  color: var(--theme-text-muted);
  font-size: var(--font-size-xs);
}

.insight-chase-more {
  margin-top: var(--spacing-md);
}

/* The team view */
.insight-people {
  display: flex;
  flex-direction: column;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--theme-border-subtle);
}

.insight-person {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 2fr 3em;
  align-items: center;
  gap: var(--spacing-md);
  padding: 6px var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  color: var(--theme-text);
  text-decoration: none;
  font-size: var(--font-size-sm);
}

.insight-person:hover {
  background: rgba(74, 158, 255, 0.06);
}

.insight-person .insight-bar {
  height: 6px;
  --insight-bar: var(--insight-positive);
}

.insight-person-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-person-value {
  text-align: right;
  color: var(--theme-text-muted);
}

@media (max-width: 1024px) {
  .insight-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .insight-next-steps {
    grid-template-columns: 1fr;
  }
}
