/* RevenuePoint overrides — the few things theme tokens cannot express.
 * Everything else (colors, radii, shadow, fonts, chrome) is THEME_DEFAULT tokens
 * in superset_config.py. Keep this file minimal; it loads on every page via the
 * head_custom_extra.html hook. Locked brand primary: #8B0A39. */

/* Ledger focus ring — exact 2px crimson, offset (antd's soft glow is handled by
 * the controlOutline/controlOutlineWidth tokens). */
body :focus-visible {
  outline: 2px solid #8B0A39;
  outline-offset: 1px;
}

/* Ledger numerals: figures line up column-to-column in tables and metrics. */
.ant-table,
.virtual-table,
[class*='MetricOption'],
[class*='Metric'] {
  font-variant-numeric: tabular-nums;
}
code,
pre,
kbd {
  font-feature-settings: 'tnum' 1, 'zero' 1;
}

/* The navbar Settings dropdown renders unconditionally (RightMenu.tsx pushes it
 * with no guard) and is EMPTY for anonymous sessions, i.e. on the login page.
 * The Login anchor renders ONLY when anonymous — use it as the scope: hide the
 * Settings submenu whenever the right-menu container also shows Login. Signed-in
 * navbars have no Login anchor, so Settings is untouched there. */
header.top div:has(> a[href='/login/']) .submenu-with-caret {
  display: none !important;
}

/* Ledger header contract. Upstream's header has no height of its own — the nav
 * menu props it open on app pages, and on the login page (empty nav) it collapses
 * to the logo height. The columns are flex with default align-items:stretch, so
 * nothing is ever truly centered. Impose it: a floor on both columns and real
 * vertical centering; the brand-text divider stretches back to full height so its
 * hairlines span the header. */
header.top#main-menu > .ant-row > .ant-col {
  align-items: center;
  min-height: 56px;
}
header.top#main-menu > .ant-row > .ant-col:first-of-type > div:has(> span) {
  align-self: stretch; /* the 'Unified Analytics' block keeps full-height hairlines */
}

/* The wordmark img is display:inline + vertical-align:middle inside a block
 * wrapper that carries line-height:22px from the 14px UI font — inline baseline
 * layout drops the image 3.4px below its perfectly-centered wrapper (measured on
 * the live page: wrapper center 28.0, img center 31.39). display:block removes
 * the image from inline layout so it fills its brandLogoHeight wrapper exactly. */
header.top .ant-image > img.ant-image-img {
  display: block;
}

/* Header air: upstream runs the wordmark tight to the header edge and the
 * divider hairlines tight to the wordmark. Inset the brand block and give the
 * divider room on both sides; the mark's SIZE is the brandLogoHeight token in
 * superset_config.py, not CSS. Structural selectors only — emotion class
 * hashes are not stable across builds. */
header.top#main-menu > .ant-row > .ant-col:first-of-type > span:first-child {
  margin-left: 10px;
}
header.top#main-menu > .ant-row > .ant-col:first-of-type > div:has(> span) {
  margin-left: 10px;
  padding-left: 20px;
  padding-right: 20px;
}

/* Login page emphasis. RevenuePoint ID (Zitadel) is now the ONLY provider — staff federate
 * Entra behind it (2026-08-19) — so this is one deliberate primary button rather than a
 * hierarchy. Kept explicit rather than inherited: upstream renders OAuth buttons as
 * ant-btn-primary already, and pinning the brand crimson here means a theme-token change
 * cannot quietly restyle the one control an unauthenticated client sees. The TEXT is set in
 * branding/tail_js_custom_extra.html, because Superset 6.1 renders this page in React
 * (t('Sign in with') + capitalize(provider.name)); only the emphasis lives here.
 *
 * Keyed on the /login/<provider-key> href PREFIX: the key is load-bearing and stable (it is
 * the OAuth callback path registered in both IdPs), the prefix carries the ?next=… the bundle
 * appends, and structural selectors are the rule in this file anyway. !important is required
 * — antd injects its CSS-in-JS <style> tags into <head> at RUNTIME, i.e. after this
 * stylesheet's <link>, so equal-specificity rules would lose. */
a.ant-btn[href^='/login/zitadel'] {
  background: #8B0A39 !important;
  border-color: #8B0A39 !important;
  color: #ffffff !important;
}
a.ant-btn[href^='/login/zitadel']:hover,
a.ant-btn[href^='/login/zitadel']:focus-visible {
  background: #6B0829 !important;
  border-color: #6B0829 !important;
  color: #ffffff !important;
}
