/* ============================================================
 * APEX SALES OS · SUPER ADMIN (CEO + Audit + Role Switcher)
 * Owner: Worker W21
 * Route surfaces: /ceo, /ceo/audit
 * Tokens: consumes design system vars from frontend/styles/tokens.css
 *         (--surface, --border, --bg-tint, --hover, --primary,
 *          --primary-soft, --text, --text-muted, --text-faint,
 *          --status-done-bd, --grad, --radius, --radius-lg,
 *          --shadow-lg). No hardcoded hex colors.
 * Rules: zero red. zero emojis. zero deity language. zero hash
 *        symbols. The "warn" state on a pulse row uses a muted
 *        dot with no animation, NEVER red.
 * ============================================================ */

/* ------------------------------------------------------------
 * CEO dashboard outer grid · main column + 320px right rail
 * ------------------------------------------------------------ */
.page-ceo-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}

/* ------------------------------------------------------------
 * System pulse card · platform health rows on the right rail
 * ------------------------------------------------------------ */
.page-ceo-pulse {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.page-ceo-pulse h3 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.page-ceo-pulse-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.page-ceo-pulse-row:last-child { border-bottom: 0; }
.page-ceo-pulse-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: livePulse 1.6s infinite;
}
/* warn state · muted-grey dot, no pulse · NEVER red */
.page-ceo-pulse-row.warn .dot {
  background: var(--text-muted);
  animation: none;
}
/* idle state · faint dot, no pulse */
.page-ceo-pulse-row.idle .dot {
  background: var(--text-faint);
  animation: none;
}

/* ------------------------------------------------------------
 * Audit log table row · 6-column grid
 *   time · actor avatar · description · subject · type · severity
 * ------------------------------------------------------------ */
.page-audit-row {
  display: grid;
  grid-template-columns: 110px 36px 1fr 110px 110px 90px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.page-audit-row .mono {
  font-family: 'JetBrains Mono', monospace;
}
.page-audit-row .av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tint);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--border);
}
/* root-actor row · purple gradient soft-wash plus 3px gradient left edge */
.page-audit-row.root {
  background: linear-gradient(90deg, var(--primary-soft) 0%, transparent 40%);
  position: relative;
}
.page-audit-row.root::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--grad);
}

/* ------------------------------------------------------------
 * Root chip · uppercase primary-soft pill
 * Replaces the legacy deity-mode chip. Used to mark the
 * super-admin actor in tables, drawers, and topbar context.
 * ------------------------------------------------------------ */
.root-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--status-done-bd);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ------------------------------------------------------------
 * Role switcher widget · lives in the topbar actions area
 * Button toggles a 280px popover with search + employee rows.
 * ------------------------------------------------------------ */
.page-root-switcher {
  position: relative;
}
.page-root-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--status-done-bd);
  border-radius: var(--radius);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}
.page-root-switcher-popover {
  position: absolute;
  top: 38px;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  width: 280px;
  display: none;
  z-index: 80;
}
.page-root-switcher.open .page-root-switcher-popover {
  display: block;
}
.page-root-switcher-popover input {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  background: var(--bg-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 8px;
}
.page-root-switcher-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
}
.page-root-switcher-row:hover {
  background: var(--hover);
}
.page-root-switcher-row.active {
  background: var(--primary-soft);
}
.page-root-switcher-row .av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tint);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.page-root-switcher-row .sub {
  font-size: 10.5px;
  color: var(--text-muted);
}
