/*
 * Custom CSS for the Chatwoot dashboard (every account, every user).
 *
 * Served at /custom/dashboard.css on every Chatwoot host. Publish changes with
 *   ./helm/chatwoot/apply-dashboard-custom.sh
 * No Helm upgrade or restart. See README "Dashboard customisation".
 *
 * This only hides things. Hidden pages still open by URL and the API still
 * works, so it is not access control.
 *
 * The sidebar has no stable ids or data attributes. Select links by route,
 * which changes less often than class names, and re-check after every
 * Chatwoot image bump.
 *
 * dashboard.js sets data-cw-account="<id>" on <html> for the open account, so
 * a rule can apply to one client only.
 *
 * Example, hide Campaigns in account 3 only:
 *   html[data-cw-account="3"] a[href*="/campaigns/"] { display: none !important; }
 */

/*
 * Captain menu, all accounts.
 * The group header, its sub-items and the collapsed-sidebar icon all link to
 * /app/accounts/<id>/captain/..., so hiding the <li> that holds such a link
 * hides the whole group in both sidebar states. Settings > Captain
 * (/settings/captain) stays visible. (Checked against v4.18.0.)
 */
aside nav li:has(a[href*="/captain/"]:not([href*="/settings/"])) {
  display: none !important;
}

/*
 * Crafture logo on the login, SSO login and signup pages. dashboard.js swaps
 * Chatwoot's logo for it and sets data-crafture-logo. The logo is an upright
 * mark, so it gets more height than Chatwoot's 2rem wordmark. The SVG is white:
 * invert it to black for the light-mode copy, keep it white in dark mode.
 */
img[data-crafture-logo] {
  height: 4rem;
}

img[data-crafture-logo="light"] {
  filter: invert(1);
}
