/* =============================================
   Leapsome OKR Dashboard — page styles
   Imports the FLBI tokens + components, then adds
   layout polish specific to this dashboard.
   ============================================= */

@import url('vendor/bi-style-guide/tokens.css');
@import url('vendor/bi-style-guide/components.css');

/* ── Page reset ── */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* The .dashboard, .sidebar, .topbar, .view, .kpi-card, .data-table, .modal etc.
   classes are all defined in components.css. We only add what's project-specific
   below. */

/* ── Sidebar brand customization ── */
.sidebar-brand {
  gap: var(--space-3);
}
.sidebar-brand-mark {
  flex-shrink: 0;
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-brand-title {
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1.2;
}
.sidebar-brand-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.sidebar-nav-icon {
  display: inline-block;
  width: 1.25em;
  text-align: center;
  margin-right: var(--space-2);
  color: var(--color-text-muted);
  font-size: 0.95em;
}
.sidebar-nav-link.active .sidebar-nav-icon {
  color: var(--color-primary);
}

/* ── Topbar ── */
.topbar-title h1 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
}
.topbar-sub {
  margin: 2px 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.topbar-stamp {
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}
.topbar-button {
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: var(--transition);
}
.topbar-button:hover {
  background: var(--color-surface-offset);
  border-color: var(--color-primary);
}

/* ── Main content area ── */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
.view {
  padding: var(--space-6);
  flex: 1 0 auto;
}

/* ── KPI strip used by Overview ── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* ── Card / panel wrapper ── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-base);
  font-weight: 600;
}
.card .sub {
  margin: 0 0 var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: var(--space-4);
}

/* ── Chart wrappers ── */
.chart-wrap {
  position: relative;
  height: 280px;
}
.chart-wrap.tall {
  height: 360px;
}

/* ── Generic helpers ── */
.muted { color: var(--color-text-muted); }
.faint { color: var(--color-text-faint); }
.tnum  { font-variant-numeric: tabular-nums; }

/* ── At-Risk / Stalled tags ── */
.flag-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.flag-pill.at-risk  { background: var(--color-error-hl);   color: var(--color-error); }
.flag-pill.stalled  { background: var(--color-warning-hl); color: var(--color-warning); }
.flag-pill.on-track { background: var(--color-success-hl); color: var(--color-success); }
.flag-pill.ahead    { background: var(--color-primary-hl); color: var(--color-primary); }
.flag-pill.complete { background: var(--color-secondary-hl); color: var(--color-secondary); }

/* ── Goal tree (By Cycle view) ── */
.goal-tree {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.goal-tree ul {
  list-style: none;
  padding-left: var(--space-6);
  margin: 0;
  border-left: 1px dashed var(--color-divider);
}
.goal-node {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
}
.goal-node:last-child { border-bottom: none; }
.goal-title {
  font-weight: 500;
  display: block;
}
.goal-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── Progress bar (used in By Team + At-Risk) ── */
.progress-bar {
  position: relative;
  height: 6px;
  width: 100%;
  background: var(--color-surface-offset);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--color-primary);
  border-radius: var(--radius-pill);
  transition: width var(--transition);
}
.progress-bar.at-risk .progress-bar-fill  { background: var(--color-error); }
.progress-bar.stalled .progress-bar-fill  { background: var(--color-warning); }
.progress-bar.complete .progress-bar-fill { background: var(--color-secondary); }

/* ── Insights view (AI narrative) ── */
.narrative-section {
  margin-bottom: var(--space-6);
}
.narrative-section h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}
.narrative-section ul {
  margin: 0;
  padding-left: var(--space-5);
}
.narrative-section li {
  margin-bottom: var(--space-2);
}
.narrative-headline {
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: var(--space-5);
}
.narrative-disclaimer {
  margin-top: var(--space-6);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── Empty / loading / error states ── */
.loading-state, .error-state {
  padding: var(--space-8) var(--space-6);
  text-align: center;
}
.error-state h2 {
  color: var(--color-error);
}
.error-detail {
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 720px;
  margin: var(--space-4) auto 0;
}

/* ── Reused-narrative banner ── */
.banner-info {
  background: var(--color-primary-hl);
  border-left: 3px solid var(--color-primary);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .view { padding: var(--space-4); }
}
