/* @ekm-tags: style, misc */
/* =============================================================================
   EKM Portal: one button system (owner 2026-10-28: "a lot of buttons throughout the portal needs fixed";
   decisions 1B, 2A, 3B, chosen from screenshots).

   - Size and shape: every action button and filter chip is at least 44px tall with 12px corners. No pills (1B).
     Same values as the Wave 1 kit (--k-target, --k-r-control), so the portal has one height and one radius.
   - Disabled (2A): a muted solid button whose label still reads at AA (4.5:1) in every look. Never faded with
     opacity: the old global rule forced a light grey label on every disabled control in dark looks, whatever its
     fill, so a light primary turned white on white (Request Outside Records -> Prepare).
   - Main button in dark looks (3B): deep tinted glass, the look's accent mixed into the box, a fine accent edge and
     light ink, in place of the light lacquer. The shared kit primary keeps its own accent-family finish (css/ekm-ui.css
     owns that class; tests/ui-pr11-premium-finish).
   Loaded after every other stylesheet. Appearance only. Guard: tests/button-system-browser.test.mjs.
   The rules carry :not(#ekm-btn-none) (one id's weight) so they win over the older !important rules for the same buttons
   (css/ekm-accessibility-force.css paints a disabled .btn-primary white on #6b6560, 1.03:1 in Pearl); the disabled rules
   carry two, over the Pearl lacquer finish (css/ekm-pearl-luxe.css, :is(#home-action-box ...) weighs one id).
   ============================================================================= */

:root {
  --btn-h: 44px;
  --btn-r: 12px;
  --btn-dis-bg: color-mix(in srgb, var(--c-ink, #1c1917) 9%, var(--c-box, #fff));
  --btn-dis-ink: color-mix(in srgb, var(--c-ink, #1c1917) 68%, var(--c-box, #fff));
  --btn-dis-rule: color-mix(in srgb, var(--c-ink, #1c1917) 14%, transparent);
}
html[data-dark] {
  --btn-dis-bg: color-mix(in srgb, #000 30%, var(--c-box, #171a20));
  --btn-dis-ink: color-mix(in srgb, var(--c-ink, #f5f5f4) 62%, #000);
  --btn-dis-rule: transparent;
  --btn-pri-bg: color-mix(in srgb, var(--c-accent, #8fa3c8) 36%, var(--c-box, #171a20));
  --btn-pri-bg-hover: color-mix(in srgb, var(--c-accent, #8fa3c8) 46%, var(--c-box, #171a20));
  --btn-pri-ink: var(--c-ink, #f5f5f4);
  --btn-pri-rule: color-mix(in srgb, var(--c-accent, #8fa3c8) 60%, transparent);
}

/* ---- Size and shape: action buttons, filter chips, and the ad-hoc pill buttons drawn with inline styles ---- */
html:not(#ekm-btn-none) body :is(.btn-primary, .btn-secondary, .btn-danger, .btn-ghost, .eui-btn, .rrc-btn, .cds-btn, .appt-wf-action, .lrb-btn,
  .cf-btn, .os-quick-btn, .wf-date-nav-btn, .wf-today-btn, .csh-academy-card__btn, .msr-noshow-log-btn,
  .potd-filter-btn, .msg-inbox-filter-btn, .msg-status-btn, .mf-filter, .mg-chip, .pq-tab, .ekm-text-scale-btn, .cf-chip, .hfp-btn,
  button[style*="border-radius:999px"], button[style*="border-radius: 999px"]) {
  min-height: var(--btn-h) !important;
  border-radius: var(--btn-r) !important;
}

/* ---- Disabled (2A): muted solid, readable, never faded ---- */
html:not(#ekm-btn-none):not(#ekm-btn-none-2) body :is(button, [role="button"], input[type="button"], input[type="submit"], input[type="reset"], a[class*="btn"]):is(:disabled, [aria-disabled="true"]) {
  background: var(--btn-dis-bg) !important;
  color: var(--btn-dis-ink) !important;
  -webkit-text-fill-color: var(--btn-dis-ink) !important;
  border-color: var(--btn-dis-rule) !important;
  box-shadow: none !important;
  text-shadow: none !important;
  opacity: 1 !important;
  cursor: not-allowed;
}
/* text inside a disabled button takes its label colour (a coloured count or a span would otherwise keep its own) */
html:not(#ekm-btn-none):not(#ekm-btn-none-2) body :is(button, [role="button"], a[class*="btn"]):is(:disabled, [aria-disabled="true"]) :not(svg, svg *) {
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
  opacity: 1 !important;
}
/* any other disabled element in a dark look (it replaces the old global muted-grey rule) */
html[data-dark] [disabled]:not(input):not(select):not(textarea) {
  color: var(--btn-dis-ink) !important;
  opacity: 1 !important;
}

/* ---- Main button in dark looks (3B): deep tinted glass ---- */
html[data-dark]:not(#ekm-btn-none) body :is(.btn-primary, .rrc-primary, .hfp-btn-primary):not(:disabled):not([aria-disabled="true"]) {
  background: var(--btn-pri-bg) !important;
  color: var(--btn-pri-ink) !important;
  -webkit-text-fill-color: var(--btn-pri-ink) !important;
  border: 1px solid var(--btn-pri-rule) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12) !important;
  text-shadow: none !important;
}
html[data-dark]:not(#ekm-btn-none) body :is(.btn-primary, .rrc-primary, .hfp-btn-primary):not(:disabled):not([aria-disabled="true"]):hover {
  background: var(--btn-pri-bg-hover) !important;
}

/* ---- Labels below AA found by the 2026-10-28 audit (Pearl unless noted) ---- */
html:not([data-dark]) .pwa-install-dismiss { color: var(--c-ink2, #4a4038) !important; }
.wf-today-btn { color: var(--c-ink, #1c1917) !important; }                       /* Pearl, Navy, Plum: accent text was 3.05:1 */
.lrb-btn.primary { color: var(--btn-primary-fg, var(--c-accent-text, #fff)) !important; } /* dark text on the bronze accent: 2.79:1 */
html:not([data-dark]) :is(.msr-noshow-log-btn, .mg-chip--review) { color: var(--status-danger-ink, #9a2f22) !important; }
html:not([data-dark]) .cf-btn-primary { color: var(--c-ink, #1c1917) !important; }
html:not([data-dark]) .mf-filter { color: var(--c-ink2, #4a4038) !important; }
