/* =====================================================================
 * Studio DF — B's version: "vibe-coded app" dashboard styles (.va-*)
 * Loaded by both the home app and the authoring app. Namespaced so it never
 * collides with Erick's chart CSS or the globe's .gd-*. The whole thing is a
 * light, branded mini-app that fills a result card / the authoring canvas.
 * The selected segment's brand color flows through --va-accent.
 * ===================================================================== */
.va-app {
  --va-accent: #3f5c7a;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  height: 100%;
  min-height: 440px;
  box-sizing: border-box;
  font-family: inherit;
  color: #1f2733;
  background: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: inset 0 0 0 1px #e6e9ef;
}

/* Header — pared back to just the app name; a thin rule separates it from the
   segment filter (no tinted banner, eyebrow, subtext, or segment pill). */
.va-head {
  padding-bottom: 10px;
  border-bottom: 1px solid #eef1f5;
}
.va-title { font-size: 20px; font-weight: 800; color: #17202b; line-height: 1.1; }

/* Segment filter — each pill carries its own brand color (--va-seg); the
   active one fills solid so the "distinct branding" reads at a glance. */
.va-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.va-tab {
  --va-seg: #3f5c7a;
  border: 1px solid color-mix(in srgb, var(--va-seg) 42%, #d7dde6);
  background: #fff;
  color: #3a4453;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, color .12s, border-color .12s;
}
.va-tab:hover { background: color-mix(in srgb, var(--va-seg) 12%, #fff); }
.va-tab.is-active { background: var(--va-seg); color: #fff; border-color: var(--va-seg); }

.va-body { display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; min-height: 0; }

.va-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.va-kpi {
  --va-accent: #3f5c7a;
  border: 1px solid #e6e9ef;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fbfcfe;
}
.va-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.va-kpi-l { min-width: 0; }
.va-kpi-label { font-size: 11.5px; color: #6b7482; }
.va-kpi-val { font-size: 24px; font-weight: 800; color: #17202b; line-height: 1.1; margin-top: 3px; }
.va-kpi-sub { font-size: 11px; color: #8a94a2; margin-top: 6px; }
.va-kpi-spark { flex: 0 0 auto; width: 78px; height: 30px; }
.va-spark { width: 100%; height: 100%; display: block; }

/* Panels stack vertically — bar chart on top, trend chart directly beneath. */
.va-panels { display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; min-height: 0; }
.va-panel {
  border: 1px solid #e6e9ef;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  min-height: 190px;
}
.va-panel-h { font-size: 12px; font-weight: 700; color: #4a5462; margin-bottom: 12px; }
.va-panel-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }

/* Trend / area chart — scales uniformly to the panel width so its axis text
   stays crisp (unlike the stretched SVGs elsewhere in the prototype). */
.va-trend { flex: 1 1 auto; min-height: 140px; display: flex; align-items: center; justify-content: center; }
.va-area-svg { width: 100%; height: auto; max-height: 210px; display: block; }
.va-area-glab { font-size: 9px; fill: #97a0ad; font-family: inherit; }

/* All-segments trend legend */
.va-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.va-legend-it { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: #4a5462; }
.va-legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }

.va-bars { display: flex; flex-direction: column; gap: 10px; }
.va-bar-row { display: grid; grid-template-columns: 108px 1fr 46px; align-items: center; gap: 10px; }
.va-bar-name { font-size: 12px; color: #3a4453; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.va-bar-track { height: 9px; border-radius: 5px; background: #eef1f5; overflow: hidden; }
.va-bar-fill {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--va-accent);
  transition: width .35s cubic-bezier(.22, .61, .36, 1);
}
.va-bar-val { font-size: 12px; font-weight: 600; color: #4a5462; text-align: right; }

/* Combined seats + adoption bars: taller track, wider value column (seats +
   adoption%), and the adopted share drawn as a lighter tint inside the fill. */
.va-bars--stacked { gap: 12px; }
.va-bars--stacked .va-bar-row { grid-template-columns: 108px 1fr 92px; }
.va-bars--stacked .va-bar-track { height: 15px; border-radius: 4px; }
.va-bar-fill--stacked { position: relative; border-radius: 4px; overflow: hidden; }
.va-seg-adopted {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  display: block;
  border-radius: 4px 0 0 4px;
}
.va-bars--stacked .va-bar-val { font-weight: 500; color: #6b7482; }
.va-bars--stacked .va-bar-val b { font-weight: 700; color: #2b3542; }
.va-bars-note { font-size: 10.5px; color: #9aa3b0; margin-top: 12px; }

/* Narrow surfaces: stack KPIs + panels. */
@media (max-width: 640px) {
  .va-kpis { grid-template-columns: 1fr; }
  .va-panels { grid-template-columns: 1fr; }
}

/* ── Authoring focus mode (body.gf-vibe-app) ─────────────────────────────
   Mirror the globe's focus handling: hide the little white sheet-title strip
   and stretch the embed chain so the app fills the full sheet canvas. Scoped
   to the body flag so Erick's regular charts stay top-aligned. */
body.gf-vibe-app .sheet-title { display: none; }
body.gf-vibe-app .sheet-canvas-empty {
  align-items: stretch;
  justify-content: stretch;
  padding: 12px;
  overflow: hidden;
}
body.gf-vibe-app #sheetVisualization,
body.gf-vibe-app #sheetVisualization .gf-embed,
body.gf-vibe-app #sheetVisualization .ns-viz-plot {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
}
body.gf-vibe-app #sheetVisualization .va-app {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}
