/* ============================================================
   Higgsfield — Shared Design System
   All pages in the Higgsfield mini-service share this file.
   ============================================================ */

/* ---- Tokens ---- */
:root {
  --color-primary: #7C3AED;
  --color-primary-hover: #6D28D9;
  --color-primary-soft: #EDE9FE;
  --color-primary-muted: #C4B5FD;
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-text: #0F172A;
  --color-text-secondary: #64748B;
  --color-text-tertiary: #94A3B8;
  --color-border: #E2E8F0;
  --color-border-light: #F1F5F9;
  --color-accent-blue: #3B82F6;
  --color-accent-blue-soft: #DBEAFE;
  --color-accent-green: #10B981;
  --color-accent-green-soft: #D1FAE5;
  --color-accent-amber: #F59E0B;
  --color-accent-amber-soft: #FEF3C7;
  --color-error: #EF4444;
  --color-error-bg: #FEE2E2;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --grad-company: linear-gradient(90deg, #7C3AED, #A78BFA);
  --grad-employee: linear-gradient(90deg, #3B82F6, #93C5FD);
}

/* ---- Reset ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- App shell ---- */
.app { max-width: 1600px; margin: 0 auto; padding: 24px; }
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }

/* ---- Sidebar ---- */
.sidebar {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
}
.sidebar-kicker {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  margin-bottom: 10px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

/* ---- Sidebar footer ---- */
.sidebar-footer {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
}
.sidebar-footer-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sidebar-footer-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--color-primary-soft);
}
.sidebar-footer-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}
.sidebar-footer-link {
  font-size: 11px;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}
.sidebar-footer-link:hover { text-decoration: underline; }
.sidebar-footer-copy {
  font-size: 10px;
  color: var(--color-text-tertiary);
  line-height: 1.5;
}
.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  padding: 5px 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.nav-btn:hover { background: var(--color-border-light); border-color: var(--color-border); }
.nav-btn.active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-muted);
}
.nav-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--color-border-light);
  color: var(--color-text-tertiary);
  font-size: 9px;
  font-weight: 800;
  flex-shrink: 0;
}
.nav-btn.active .nav-num { background: var(--color-primary); color: white; }
.nav-label { font-size: 12px; font-weight: 600; line-height: 1.2; }
.nav-desc { display: none; }

/* ---- Page stack ---- */
.page-stack { min-width: 0; }
.page { display: none; }
.page.active { display: block; }

/* ---- Page header (universal) ---- */
.page-header { margin-bottom: 28px; }
.page-header-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  margin-bottom: 12px;
}
.page-header h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 8px;
}
.page-header .subtitle {
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text-secondary);
  max-width: 680px;
}
.timestamp { font-size: 12px; color: var(--color-text-tertiary); margin-top: 8px; }
.refresh-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
}
.refresh-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* ---- Featured card ---- */
.featured-card {
  background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.featured-left { display: flex; align-items: center; gap: 16px; }
.featured-logo { width: 56px; height: 56px; border-radius: 14px; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; flex-shrink: 0; overflow: hidden; background-size: cover; background-position: center; }
.featured-name { font-size: 22px; font-weight: 800; }
.featured-link { font-size: 13px; color: rgba(255,255,255,0.75); text-decoration: none; }
.featured-link:hover { color: white; text-decoration: underline; }
.featured-metrics { display: flex; gap: 32px; flex-wrap: wrap; }
.featured-metric { text-align: center; }
.featured-metric .num { font-size: 26px; font-weight: 800; }
.featured-metric .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.75; margin-top: 2px; }

/* ---- KPI row ---- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.kpi-card { background: var(--color-surface); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--color-border-light); }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--color-text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.kpi-value { font-size: 32px; font-weight: 800; line-height: 1; }
.kpi-sub { font-size: 12px; color: var(--color-text-secondary); margin-top: 6px; }

/* ---- Charts ---- */
/* Higgsfield gap analysis */
.hf-footnote {
  background: color-mix(in srgb, var(--color-primary) 3%, var(--color-surface));
  border: 1.5px solid color-mix(in srgb, var(--color-primary) 22%, transparent);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px color-mix(in srgb, var(--color-primary) 10%, transparent);
}
.hf-gap-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.hf-gap-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: var(--color-primary);
  border: 1.5px solid color-mix(in srgb, var(--color-primary) 22%, transparent);
  flex-shrink: 0;
}
.hf-gap-title { font-size: 16px; font-weight: 800; color: var(--color-text); }
.hf-gap-sub { font-size: 11.5px; color: var(--color-text-tertiary); margin-top: 2px; }
.hf-gap-rows { display: flex; flex-direction: column; gap: 0; }
.hf-gap-row {
  display: grid;
  grid-template-columns: 160px 1fr 70px;
  gap: 14px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid color-mix(in srgb, var(--color-primary) 10%, var(--color-border-light));
}
.hf-gap-row:first-child { border-top: none; padding-top: 0; }
.hf-gap-label { font-size: 12px; font-weight: 600; color: var(--color-text-secondary); }
.hf-gap-bars { display: flex; flex-direction: column; gap: 6px; }
.hf-gap-bar-row { display: flex; align-items: center; gap: 8px; }
.hf-gap-who {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 76px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.hf-gap-who.hf { color: var(--color-primary); }
.hf-gap-who.top { color: var(--color-text-secondary); }
.hf-gap-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.hf-gap-dot.hf { background: var(--color-primary); }
.hf-gap-dot.top { background: var(--color-text-tertiary); opacity: 0.5; }
.hf-gap-track { flex: 1; height: 8px; background: color-mix(in srgb, var(--color-primary) 8%, var(--color-border-light)); border-radius: var(--radius-full); overflow: hidden; }
.hf-gap-fill { height: 100%; border-radius: var(--radius-full); min-width: 3px; }
.hf-gap-fill.hf { background: var(--grad-company); }
.hf-gap-fill.top { background: var(--color-text-tertiary); opacity: 0.28; }
.hf-gap-num { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; width: 46px; text-align: right; flex-shrink: 0; }
.hf-gap-num.hf { color: var(--color-primary); }
.hf-gap-num.top { color: var(--color-text-tertiary); }
.hf-gap-upside { text-align: center; min-width: 64px; }
.hf-gap-x {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}
.hf-gap-x-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.hf-gap-ok { font-size: 12px; font-weight: 700; color: #16a34a; }
.hf-gap-hero {
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  border-radius: var(--radius-sm);
  margin: 0 -14px 6px;
  padding: 15px 14px !important;
  border-top: none !important;
}
.hf-gap-hero .hf-gap-label { font-size: 13px; font-weight: 800; color: var(--color-text); }
.hf-gap-hero .hf-gap-track { height: 10px; }
.hf-gap-hero .hf-gap-num { font-size: 13px; font-weight: 800; }
.hf-gap-hero .hf-gap-x { font-size: 26px; color: var(--color-primary); }

.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 28px; align-items: stretch; }
.chart-card { background: var(--color-surface); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--color-border-light); display: flex; flex-direction: column; }
.chart-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.chart-subtitle { font-size: 12px; color: var(--color-text-secondary); margin-bottom: 16px; }
.chart-legend { display: flex; gap: 16px; margin-bottom: 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--color-text-secondary); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.bar-list { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 52px; gap: 6px; align-items: center; }
.bar-row-4v { display: grid; grid-template-columns: 110px 1fr 40px 40px 40px 40px; gap: 6px; align-items: center; }
.bar-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mini-logo { width: 22px; height: 22px; border-radius: 6px; background: var(--color-border-light); display: flex; align-items: center; justify-content: center; background-size: cover; background-position: center; font-size: 10px; font-weight: 700; color: var(--color-text-tertiary); flex-shrink: 0; overflow: hidden; }
.bar-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { position: relative; height: 8px; background: var(--color-border-light); border-radius: var(--radius-full); overflow: hidden; }
.bar-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: var(--radius-full); background: var(--grad-company); }
.bar-fill-secondary { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-full); background: var(--grad-employee); }
.bar-value { font-size: 12px; font-weight: 700; color: var(--color-text-secondary); text-align: right; white-space: nowrap; }

/* ---- Matrix table ---- */
.matrix-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.matrix-table-wrap { overflow-x: auto; }
.matrix-table { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 12px; }
.matrix-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.matrix-table td {
  vertical-align: middle;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-light);
  line-height: 1.4;
}
.matrix-table tr:last-child td { border-bottom: none; }
.matrix-table tr.ref-separator td { padding-top: 20px; border-bottom: none; }
.ref-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-tertiary);
  padding-bottom: 4px;
}
.matrix-company-cell { display: flex; align-items: center; gap: 10px; }
.matrix-logo { width: 28px; height: 28px; border-radius: 7px; background: var(--color-border-light); flex-shrink: 0; overflow: hidden; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--color-text-tertiary); }
.matrix-logo img { width: 100%; height: 100%; object-fit: cover; }
.matrix-company-name { font-weight: 700; color: var(--color-text); white-space: nowrap; }
.matrix-company-name a { color: inherit; text-decoration: none; }
.matrix-company-name a:hover { color: var(--color-primary); }
.matrix-tag-row { display: flex; gap: 4px; margin-top: 2px; }
.no-info { color: var(--color-text-tertiary); font-style: italic; }
.matrix-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-border-light);
  white-space: nowrap;
}
.matrix-tag.soft { color: var(--color-accent-blue); background: var(--color-accent-blue-soft); }
.matrix-val { font-weight: 700; color: var(--color-text); }
.matrix-sub { color: var(--color-text-tertiary); }
.matrix-reason { color: var(--color-text-secondary); max-width: 260px; }
.matrix-source-note {
  padding: 10px 12px;
  border-top: 1px solid var(--color-border-light);
  font-size: 11px;
  color: var(--color-text-tertiary);
}

/* ---- Toolbar ---- */
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-input { padding: 9px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 13px; outline: none; min-width: 200px; transition: border-color 0.15s; }
.search-input:focus { border-color: var(--color-primary); }
.sort-select { padding: 9px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 13px; outline: none; cursor: pointer; }
.toggle-group { display: inline-flex; padding: 3px; border: 1px solid var(--color-border); border-radius: var(--radius-full); background: var(--color-surface); }
.toggle-btn { border: none; background: transparent; color: var(--color-text-secondary); font-size: 12px; font-weight: 600; padding: 7px 14px; border-radius: var(--radius-full); cursor: pointer; transition: all 0.15s; }
.toggle-btn.active { background: var(--color-primary-soft); color: var(--color-primary); }

/* ---- Main layout (list + detail panel) ---- */
.main-layout { display: grid; grid-template-columns: 1fr 420px; gap: 16px; }
.panel { background: var(--color-surface); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--color-border-light); min-height: 500px; }

/* ---- Company list ---- */
.company-list { display: flex; flex-direction: column; gap: 6px; }
.company-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.12s; border: 1px solid transparent; }
.company-row:hover { background: var(--color-border-light); }
.company-row.active { background: var(--color-primary-soft); border-color: var(--color-primary-muted); }
.co-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--color-border-light); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: var(--color-text-tertiary); flex-shrink: 0; overflow: hidden; background-size: cover; background-position: center; }
.co-info { flex: 1; min-width: 0; }
.co-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-sub { font-size: 12px; color: var(--color-text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-stats { display: flex; gap: 14px; flex-shrink: 0; }
.co-stat { text-align: right; }
.co-stat .num { font-size: 14px; font-weight: 700; color: var(--color-text-tertiary); }
.co-stat .lbl { font-size: 10px; color: var(--color-text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; }
.co-stat-primary .num { font-weight: 800; color: var(--color-text); }
.co-stat-primary .lbl { color: var(--color-text-secondary); }

/* ---- Detail panel ---- */
.detail-header { margin-bottom: 18px; }
.detail-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.detail-logo { width: 48px; height: 48px; border-radius: 13px; background: var(--color-border-light); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; color: var(--color-text-tertiary); flex-shrink: 0; overflow: hidden; background-size: cover; background-position: center; }
.detail-name { font-size: 20px; font-weight: 800; }
.detail-link { font-size: 13px; color: var(--color-primary); text-decoration: none; font-weight: 600; }
.detail-link:hover { text-decoration: underline; }
.detail-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.detail-kpi { padding: 12px; background: var(--color-border-light); border-radius: var(--radius-sm); }
.detail-kpi .lbl { font-size: 11px; color: var(--color-text-tertiary); margin-bottom: 4px; }
.detail-kpi .val { font-size: 16px; font-weight: 800; }

.emp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.emp-title { font-size: 14px; font-weight: 700; }
.emp-count { font-size: 12px; color: var(--color-text-tertiary); }

.emp-list { display: flex; flex-direction: column; gap: 6px; }
.emp-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--color-border-light); border-radius: var(--radius-sm); transition: border-color 0.12s; }
.emp-row:hover { border-color: var(--color-border); }
.emp-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--color-border-light); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--color-text-tertiary); flex-shrink: 0; overflow: hidden; background-size: cover; background-position: center; }
.emp-info { flex: 1; min-width: 0; }
.emp-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-name a { color: inherit; text-decoration: none; }
.emp-name a:hover { color: var(--color-primary); }
.emp-role { font-size: 11px; color: var(--color-text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-nums { display: flex; gap: 14px; flex-shrink: 0; }
.emp-num { text-align: right; }
.emp-num .num { font-size: 13px; font-weight: 700; }
.emp-num .lbl { font-size: 10px; color: var(--color-text-tertiary); text-transform: uppercase; letter-spacing: 0.03em; }

/* ---- Utility ---- */
.empty-note { text-align: center; padding: 32px 16px; font-size: 13px; color: var(--color-text-tertiary); }
.warning-note { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--color-accent-amber-soft); color: #92400E; font-size: 12px; line-height: 1.5; margin-bottom: 14px; }

/* ---- Loading / error ---- */
.loading-state { text-align: center; padding: 60px 20px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state .msg { font-size: 14px; color: var(--color-text-secondary); }
.error-state { text-align: center; padding: 40px 20px; font-size: 14px; color: var(--color-error); background: var(--color-error-bg); border-radius: var(--radius-md); }

.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .sidebar-card { border-radius: var(--radius-md); }
  .sidebar-nav { display: grid; grid-template-columns: repeat(2, 1fr); }
  .main-layout { grid-template-columns: 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .hf-gap-row { grid-template-columns: 110px 1fr 60px; }
  .hf-gap-who { width: 64px; font-size: 10px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .app { padding: 16px; }
  .sidebar-nav { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr; }
  .featured-card { flex-direction: column; align-items: flex-start; }
  .featured-metrics { width: 100%; }
  .bar-row { grid-template-columns: 100px 1fr 60px; }
  .detail-kpis { grid-template-columns: 1fr; }
  .co-stats { display: none; }
  .matrix-table th, .matrix-table td { padding: 6px 10px; }
  .insight-hero-row { grid-template-columns: repeat(2, 1fr); }
  .insight-split-chart { max-height: none; }
}

/* ============================================================
   Page 3 — Employee Leverage (Insights)
   ============================================================ */

/* Hero KPI cards */
.insight-hero-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.insight-hero {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  text-align: center;
}
.insight-hero.accent {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  color: white;
  border-color: transparent;
}
.insight-hero-num {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
}
.insight-hero.accent .insight-hero-num { color: white; }
.insight-hero-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.4;
}
.insight-hero.accent .insight-hero-label { color: rgba(255,255,255,0.8); }
.insight-hero-label strong { color: var(--color-text); font-weight: 700; }
.insight-hero.accent .insight-hero-label strong { color: white; }

/* Section blocks */
.insight-section {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  margin-bottom: 20px;
}
.insight-section-title {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 4px;
}
.insight-section-sub {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 18px;
}
.insight-section-title + .insight-split-chart,
.insight-section-title + .insight-efficiency-list { margin-top: 16px; }

/* Split bar chart (employee vs company likes) */
.insight-split-chart {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.split-row {
  display: grid;
  grid-template-columns: 120px 1fr 48px 48px 56px;
  gap: 8px;
  align-items: center;
}
.split-hdr { margin-bottom: 2px; }
.split-col-hdr {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-tertiary);
  text-align: right;
}
.split-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.split-name {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.split-bar-wrap {
  height: 12px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.split-bar {
  height: 100%;
  display: flex;
  border-radius: var(--radius-full);
  overflow: hidden;
  min-width: 2px;
}
.split-seg.co {
  background: var(--grad-company);
  height: 100%;
}
.split-seg.emp {
  background: var(--grad-employee);
  height: 100%;
}
.split-val {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.split-emp { color: var(--color-accent-blue); }
.split-co { color: var(--color-primary); }
.split-total { color: var(--color-text); }

/* Efficiency ranking */
.insight-efficiency-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.eff-row {
  display: grid;
  grid-template-columns: 28px 140px 1fr 160px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}
.eff-row:hover { background: var(--color-border-light); }
.eff-gold { background: #FFFBEB; }
.eff-silver { background: #F8FAFC; }
.eff-bronze { background: #FFF7ED; }
.eff-rank {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-text-tertiary);
  text-align: center;
}
.eff-gold .eff-rank { color: #D97706; }
.eff-silver .eff-rank { color: #64748B; }
.eff-bronze .eff-rank { color: #C2410C; }
.eff-company {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
}
.eff-company span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eff-bar-wrap {
  height: 8px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.eff-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--grad-employee);
  min-width: 2px;
}
.eff-bar-hf {
  background: var(--grad-company);
}
.eff-hf {
  background: var(--color-primary-soft);
}
.eff-hf:hover { background: var(--color-primary-soft); }
.eff-sep {
  grid-column: 1 / -1;
  padding: 10px 0 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-tertiary);
  border-top: 1px dashed var(--color-border);
}
.eff-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.eff-main {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-text);
}
.eff-main small {
  font-weight: 600;
  color: var(--color-text-tertiary);
  font-size: 10px;
}
.eff-sub {
  font-size: 10px;
  color: var(--color-text-tertiary);
}

/* Top voices */
.insight-top-voices {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.voice-row {
  display: grid;
  grid-template-columns: 24px 34px 1fr minmax(80px, 0.5fr) 140px;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}
.voice-row:hover { background: var(--color-border-light); }
.voice-rank {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-text-tertiary);
  text-align: center;
}
.voice-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-border-light);
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-tertiary);
  overflow: hidden;
}
.voice-info { min-width: 0; }
.voice-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.voice-name a { color: inherit; text-decoration: none; }
.voice-name a:hover { color: var(--color-primary); }
.voice-role {
  font-size: 11px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.voice-bar-wrap {
  height: 6px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.voice-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--grad-employee);
  min-width: 2px;
}
.voice-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.voice-main {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-text);
}
.voice-main small {
  font-weight: 600;
  color: var(--color-text-tertiary);
  font-size: 10px;
}
.voice-sub {
  font-size: 10px;
  color: var(--color-text-tertiary);
}

/* voice-row type variants */
.voice-row-founder {
  background: color-mix(in srgb, #F59E0B 7%, transparent);
}
.voice-row-founder:hover {
  background: color-mix(in srgb, #F59E0B 13%, transparent);
}
.voice-bar-founder {
  background: linear-gradient(90deg, #F59E0B, #FBBF24);
}
.voice-type-tag {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  vertical-align: middle;
}
.voice-type-founder {
  background: color-mix(in srgb, #F59E0B 18%, transparent);
  color: #B45309;
}

/* Top voices hero stats row */
.tv-hero-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0 16px;
}
.tv-hero {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.tv-hero-num {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 5px;
  color: #B45309;
}
.tv-hero-denom {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-tertiary);
}
.tv-hero-label {
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-text-secondary);
}
.tv-hero-label strong { color: var(--color-text); }

/* Top voices subtitle badges */
.tv-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.tv-badge-founder {
  background: color-mix(in srgb, #F59E0B 15%, transparent);
  color: #B45309;
}
.tv-badge-employee {
  background: color-mix(in srgb, var(--grad-employee) 12%, transparent);
  color: color-mix(in srgb, var(--grad-employee) 80%, #000);
}

/* ============================================================
   Page 4 — Founder-Led
   ============================================================ */

/* Founder gradient (accent warm) */
.split-seg.founder { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.split-founder { color: #D97706; }
.voice-bar.founder { background: linear-gradient(90deg, #F59E0B, #FBBF24); }

/* Compare bars */
.compare-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0;
}
.compare-row {
  display: grid;
  grid-template-columns: 140px 1fr 70px;
  gap: 12px;
  align-items: center;
}
.compare-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
}
.compare-bar-wrap {
  height: 18px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.compare-bar {
  height: 100%;
  border-radius: var(--radius-full);
  min-width: 4px;
}
.compare-bar.founder { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.compare-bar.employee { background: var(--grad-employee); }
.compare-bar.company { background: var(--grad-company); }
.compare-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-tertiary);
  text-align: right;
}
.compare-val-primary {
  font-size: 17px;
  font-weight: 800;
  color: var(--color-text);
}

/* Spotlight leaderboard */
.spotlight-section {
  border-left: 3px solid var(--color-primary);
}

.lb-table {
  display: grid;
  grid-template-columns: minmax(130px,1.4fr) 44px minmax(40px,0.5fr) 20px 44px minmax(40px,0.5fr) 20px 44px minmax(40px,0.5fr) 20px 44px minmax(40px,0.5fr);
  gap: 0;
  font-size: 12px;
  overflow-x: auto;
}
.lb-hdr {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-tertiary);
  padding: 6px 4px 8px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.lb-hdr-name { padding-left: 0; }
.lb-spacer { border-bottom: 1px solid var(--color-border); }
.lb-cell {
  padding: 6px 4px;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
}
.lb-cell-name { padding-left: 0; }
.lb-cell-num {
  font-weight: 700;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  justify-content: flex-end;
  text-align: right;
}
.lb-cell-gap {
  border-bottom: 1px solid var(--color-border-light);
}
.lb-row-hf {
  background: var(--color-primary-soft);
}
.lb-row-hf.lb-cell-num {
  color: var(--color-primary);
  font-weight: 800;
}
.lb-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.lb-person {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-person a { color: inherit; text-decoration: none; }
.lb-person a:hover { color: var(--color-primary); }
.lb-co {
  font-size: 10px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.lb-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--grad-employee);
  min-width: 2px;
}
.lb-bar-hf {
  background: var(--grad-company);
}

/* Gap summary cards */
.lb-gap-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.lb-gap-card {
  text-align: center;
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-border-light);
}
.lb-gap-num {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.lb-gap-label {
  font-size: 11px;
  color: var(--color-text-tertiary);
  font-weight: 600;
}
.gap-up { color: var(--color-accent-green); }
.gap-down { color: var(--color-error); }

/* ============================================================
   Page 6 — Summary
   ============================================================ */
/* ── Page 6: Key Insights & Action Items ── */

.summary-stat-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.summary-stat {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  border: 1px solid var(--color-border-light);
}
.summary-stat-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  border-color: transparent;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--color-primary) 22%, transparent);
}
.summary-stat-num {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
  color: var(--color-text);
}
.summary-stat-primary .summary-stat-num { color: #fff; }
.summary-stat-label {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--color-text-secondary);
}
.summary-stat-primary .summary-stat-label { color: rgba(255,255,255,0.8); }
.summary-stat-label strong { color: var(--color-text); }
.summary-stat-primary .summary-stat-label strong { color: #fff; }

/* Action items card */
.summary-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 24px 26px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 18%, transparent);
  box-shadow: var(--shadow-md);
}
.summary-card-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 18px;
  color: var(--color-text);
}

/* Action list */
.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.summary-action {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 16px;
  align-items: start;
  padding: 18px 16px;
  border-radius: var(--radius-sm);
}
.summary-action + .summary-action {
  border-top: 1px solid var(--color-border-light);
}
.summary-action-primary {
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
}
.summary-action-primary + .summary-action {
  border-top: none;
}
.summary-action-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-primary);
  padding-top: 2px;
  letter-spacing: 0.5px;
}
.summary-action-body { min-width: 0; }
.summary-action-title {
  font-size: 14.5px;
  font-weight: 800;
  margin-bottom: 5px;
  color: var(--color-text);
}
.summary-action-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
}
.summary-action-note {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* Founder benchmark table (action 01) */
.fbench {
  margin-top: 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.72);
  overflow: hidden;
}
.fbench-hdr {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  padding: 7px 12px 7px 48px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.fbench-row {
  display: grid;
  grid-template-columns: 26px 1fr 60px 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.fbench-row:last-child { border-bottom: none; }
.fbench-hf {
  background: color-mix(in srgb, var(--color-primary) 6%, transparent);
}
.fbench-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}
.fbench-name a { color: inherit; text-decoration: none; }
.fbench-name a:hover { color: var(--color-primary); }
.fbench-co {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--color-text-tertiary);
  margin-top: 1px;
}
.fbench-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--color-primary);
  color: white;
  vertical-align: middle;
}
.fbench-posts {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
}
.fbench-posts em {
  display: block;
  font-style: normal;
  font-size: 9.5px;
  font-weight: 400;
  color: var(--color-text-tertiary);
}
.fbench-bar-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fbench-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--color-primary);
  min-width: 2px;
  transition: width 0.3s;
}
.fbench-hf .fbench-bar {
  background: color-mix(in srgb, var(--color-primary) 40%, var(--color-text-tertiary));
}
.fbench-avg {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

/* Employee reference rows (compact) */
.summary-ref-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 14px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.summary-ref {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--color-surface);
}
.summary-ref + .summary-ref {
  border-top: 1px solid var(--color-border-light);
}
.summary-ref-info { flex: 1; min-width: 0; }
.summary-ref-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.summary-ref-name a { color: inherit; text-decoration: none; }
.summary-ref-name a:hover { color: var(--color-primary); }
.summary-ref-role {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.summary-ref-nums {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}
.summary-ref-nums span {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}
.summary-ref-nums span em {
  font-style: normal;
  font-weight: 400;
  color: var(--color-text-tertiary);
  margin-left: 3px;
  font-size: 11px;
}

/* ============================================================
   Page 7 — Company Page Action Items
   ============================================================ */

.cp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.cp-chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 20px 20px 14px;
}
.cp-chart-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 3px;
}
.cp-chart-sub {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-bottom: 14px;
}
.cp-row {
  display: grid;
  grid-template-columns: 1fr minmax(60px, 0.9fr) 58px;
  gap: 10px;
  align-items: center;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}
.cp-row:hover { background: var(--color-border-light); }
.cp-row-hf {
  background: color-mix(in srgb, var(--color-primary) 6%, transparent);
}
.cp-row-hf:hover {
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
}
.cp-row-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-bar-wrap {
  height: 6px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: visible;
  position: relative;
}
.cp-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--grad-company);
  min-width: 3px;
}
.cp-bar-hf {
  background: var(--color-primary);
  min-width: 4px;
}
.cp-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  text-align: right;
  white-space: nowrap;
}
.cp-row-hf .cp-val {
  color: var(--color-primary);
  font-size: 13px;
}

/* ============================================================
   Pages 9 & 10 — Content Ideas
   ============================================================ */

.ci-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ci-format {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.ci-format:has(.ci-posts:not(.ci-posts-closed)) {
  border-color: color-mix(in srgb, var(--color-primary) 20%, transparent);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--color-primary) 8%, transparent);
}

.ci-format-header {
  display: grid;
  grid-template-columns: 36px 1fr 24px;
  gap: 14px;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.ci-format-header:hover { background: var(--color-border-light); }

.ci-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: 0.5px;
}

.ci-format-info { min-width: 0; }

.ci-format-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 3px;
}

.ci-format-sub {
  font-size: 12.5px;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.ci-chevron {
  font-size: 16px;
  color: var(--color-text-tertiary);
  transition: transform 0.2s;
  text-align: center;
  justify-self: center;
}

/* Posts panel */
.ci-posts {
  border-top: 1px solid var(--color-border-light);
  padding: 16px 20px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.ci-posts.ci-posts-closed {
  display: none;
}
.ci-posts-empty {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: 13px;
  border: 1.5px dashed var(--color-border-light);
  border-radius: var(--radius-sm);
}

/* Post card (skeleton + future real cards) */
.ci-post-card {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
}
.ci-post-author {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
}
.ci-post-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-border-light);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  object-fit: cover;
}
.ci-post-avatar-init {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border: 1px solid color-mix(in srgb, var(--color-primary) 15%, transparent);
}
.ci-post-author-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
}
.ci-post-author-role {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 1px;
}
.ci-post-body {
  padding: 0 14px 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  flex: 1;
}
.ci-post-link {
  display: block;
  padding: 8px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  border-top: 1px solid var(--color-border-light);
}
.ci-post-link:hover { text-decoration: underline; }
.ci-post-stats {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--color-border-light);
}
.ci-post-stat {
  font-size: 11px;
  color: var(--color-text-tertiary);
}
.ci-post-stat strong {
  color: var(--color-text);
  font-weight: 700;
}

/* ---- TL;DR page ---- */
.tldr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.tldr-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  position: relative;
}
.tldr-card-num {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: 12px;
}
.tldr-card-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.tldr-card-sub {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* Card 1 — current state */
.tldr-state { border-top: 3px solid var(--color-primary); }
.tldr-metrics-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 0;
  padding-top: 4px;
}
.tldr-metric-cell {
  padding: 4px 0;
}
.tldr-metric-divider {
  width: 1px;
  background: var(--color-border);
  align-self: stretch;
  margin: 0 16px;
}
.tldr-metric-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 6px;
}
.tldr-metric-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

/* Card 2 — gap */
.tldr-gap { border-top: 3px solid #EF4444; }
.tldr-gap-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.tldr-gap-row { display: grid; grid-template-columns: 120px 1fr 52px; gap: 8px; align-items: center; }
.tldr-gap-row-accent { background: #FFF5F5; border-radius: 6px; padding: 6px 8px; margin: 0 -8px; }
.tldr-gap-label { font-size: 12px; font-weight: 600; color: var(--color-text-secondary); line-height: 1.35; }
.tldr-gap-sublabel { font-size: 10px; font-weight: 500; color: var(--color-text-tertiary); display: block; margin-top: 1px; }
.tldr-gap-bars { display: flex; flex-direction: column; gap: 3px; }
.tldr-bar-wrap { height: 6px; background: var(--color-border-light); border-radius: 4px; overflow: hidden; }
.tldr-bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.tldr-bar-hf  { background: var(--color-primary); opacity: 0.75; }
.tldr-bar-t10 { background: #EF4444; opacity: 0.25; }
.tldr-gap-right { text-align: right; min-width: 68px; }
.tldr-gap-x { font-size: 14px; font-weight: 800; color: var(--color-text-tertiary); line-height: 1; }
.tldr-gap-x-big { color: #EF4444; font-size: 15px; }
.tldr-gap-vals { font-size: 10px; color: var(--color-text-tertiary); margin-top: 2px; white-space: nowrap; }
.tldr-gap-legend { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--color-text-tertiary); }
.tldr-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 2px; }
.tldr-dot-hf  { background: var(--color-primary); }
.tldr-dot-t10 { background: #EF4444; opacity: 0.5; }

/* Levers */
.tldr-levers {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
}
.tldr-levers-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-tertiary);
  margin-bottom: 14px;
}
.tldr-levers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.tldr-lever {
  border-radius: var(--radius-md);
  padding: 20px 20px 18px;
  position: relative;
  overflow: hidden;
}
.tldr-lever-emp {
  background: linear-gradient(135deg, #EEF2FF 0%, #F5F3FF 100%);
  border: 1px solid var(--color-primary-muted);
}
.tldr-lever-co {
  background: linear-gradient(135deg, #F0FDF4 0%, #ECFDF5 100%);
  border: 1px solid #6EE7B7;
}
.tldr-lever-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 2px 8px;
  border-radius: 99px;
  margin-bottom: 12px;
}
.tldr-lever-emp .tldr-lever-badge { background: var(--color-primary); color: #fff; }
.tldr-lever-co  .tldr-lever-badge { background: #10B981; color: #fff; }
.tldr-lever-icon { font-size: 22px; margin-bottom: 8px; }
.tldr-lever-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 2px;
}
.tldr-lever-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}
.tldr-lever-x {
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 2px;
}
.tldr-lever-emp .tldr-lever-x { color: var(--color-primary); }
.tldr-lever-co  .tldr-lever-x { color: #10B981; }
.tldr-lever-views {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 10px;
  margin-top: -2px;
}
.tldr-lever-emp .tldr-lever-views { color: var(--color-primary); }
.tldr-lever-co  .tldr-lever-views { color: #10B981; }
.tldr-lever-xlabel {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 14px;
  line-height: 1.4;
}
.tldr-lever-hint {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-tertiary);
}
.tldr-note {
  font-size: 12px;
  color: var(--color-text-tertiary);
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
  font-style: italic;
}

/* ---- Page loader ---- */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.page-loader.page-loader-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.page-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.page-loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.page-loader-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  letter-spacing: 0.01em;
}

/* ---- Intro / Cover page ---- */
.intro-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 80vh;
  padding: 80px 0 40px;
}
.intro-byline {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 44px;
}
.intro-person {
  display: flex;
  align-items: center;
  gap: 12px;
}
.intro-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: var(--color-border-light);
  flex-shrink: 0;
  border: 2px solid var(--color-border);
}
.intro-byline-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.intro-byline-name:hover { color: var(--color-primary); }
.intro-for {
  font-size: 18px;
  font-weight: 400;
  color: var(--color-text-tertiary);
}
.intro-title {
  font-size: 54px;
  font-weight: 800;
  line-height: 1.08;
  color: var(--color-text);
  margin: 0 0 48px;
  letter-spacing: -0.03em;
}
.intro-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.intro-start-btn:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}
.intro-copyright {
  margin-top: 20px;
  font-size: 11px;
  color: var(--color-text-tertiary);
  line-height: 1.5;
  max-width: 480px;
  border-left: 2px solid var(--color-border);
  padding-left: 10px;
}

/* ---- Outcomes & Goals page ---- */
.offer-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding-top: 32px;
}
.offer-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 18px 28px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text);
  font-size: 16px;
  font-weight: 600;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.offer-link:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-muted);
}
.offer-icon { font-size: 22px; }
.offer-link-text { flex: 1; }
.offer-link-arrow {
  font-size: 18px;
  color: var(--color-primary);
  font-weight: 700;
}
.offer-url {
  font-size: 12px;
  color: var(--color-text-tertiary);
  padding-left: 4px;
}
.oc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.oc-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.oc-col-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 4px 12px;
  border-radius: 99px;
  display: inline-block;
  align-self: flex-start;
}
.oc-label-sprint {
  background: #FEF3C7;
  color: #92400E;
}
.oc-label-scale {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

/* Focus items (2-month col) */
.oc-focus-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.oc-focus-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.oc-focus-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.oc-focus-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 3px;
}
.oc-focus-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Result card */
.oc-result-card {
  border-radius: var(--radius-lg);
  padding: 24px 24px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.oc-result-sprint {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid #FCD34D;
}
.oc-result-x {
  font-size: 56px;
  font-weight: 900;
  color: #D97706;
  line-height: 1;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}
.oc-result-desc {
  font-size: 13px;
  font-weight: 600;
  color: #92400E;
  line-height: 1.5;
}

/* Steps (6-month col) */
.oc-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.oc-step {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.oc-step:last-child { border-bottom: none; }
.oc-step-num {
  width: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border-right: 1px solid var(--color-border);
}
.oc-step-body {
  padding: 14px 16px;
}
.oc-step-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}
.oc-step-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Timeline */
.oc-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}
.oc-tl-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.oc-tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-border);
  border: 2px solid var(--color-border);
}
.oc-tl-active .oc-tl-dot {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.oc-tl-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-tertiary);
  text-align: center;
  line-height: 1.3;
}
.oc-tl-active .oc-tl-label { color: var(--color-primary); }
.oc-tl-label span {
  font-weight: 600;
  color: var(--color-text-secondary);
}
.oc-tl-line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  margin-bottom: 20px;
}

/* ---- Content Ideas: reference profiles ---- */
.ci-refs {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}
.ci-refs-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
  margin-bottom: 14px;
}
.ci-refs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ci-ref-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s, background 0.15s;
}
.ci-ref-card:hover {
  border-color: var(--color-primary-muted);
  background: var(--color-primary-soft);
}
.ci-ref-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-border-light);
}
.ci-ref-avatar-init {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ci-ref-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}
.ci-ref-role {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 1px;
}
