/* ============================================================
   BuildBarrel login theme, "Technical drawing, refined".

   The owner's two-column take on the blueprint concept, refined: the
   lockup in the page's top-left corner; the sign-in form on the open page
   in the left half, centred, with visible labels and no card; and a
   drawing panel in the right half (grid paper inside a hairline frame with
   registration marks, and a 225 L barrique drawn to scale in half section
   with six stored builds inside).

   Dark-first: the default tokens are the dark sheet. The OS light scheme
   and the comparison page's forced data-theme both swap in the light
   sheet; every scheme-dependent value, including the art, goes through
   the tokens below. The drawing is one SVG used as a mask over --bb-ink.

   Layered over keycloak.v2 (PatternFly v5): PF global variables first,
   then targeted rules on Keycloak's stable ids/classes for 26.4.2.
   ============================================================ */

:root {
  color-scheme: dark;

  /* Brand lockup (staves mark and Geist Bold wordmark, outlined), generated
     by design/brand/build.py and drawn only through this variable, as a
     mask, so it takes the text color in both schemes. */
  --bb-logo: url("../img/buildbarrel-lockup.f4469f71674a.svg");

  /* Sheet */
  --bb-paper: #111111;
  --bb-ink: #c2c2c2;                 /* the one ink: drawing, grid, frame */
  /* The drawing's inline code ("uv") in the danger red. The drawing is
     one mask over the ink, so the red rides in as a background image
     drawn to the same box, one file per scheme. */
  --bb-drawing-code: url("../img/barrel-section-code-dark.85ba1c590376.svg");
  /* Grid, frame and crop marks are tints of the same ink. They resolve on
     :root against whichever --bb-ink the scheme blocks below cascade in,
     so they follow both the media and the forced path unrepeated. */
  --bb-grid-minor: color-mix(in srgb, var(--bb-ink) 2.5%, transparent);
  --bb-grid-major: color-mix(in srgb, var(--bb-ink) 4.5%, transparent);
  --bb-frame: color-mix(in srgb, var(--bb-ink) 30%, transparent);

  /* Card and controls */
  --bb-surface: #181818;
  --bb-surface-subtle: #1f1f1f;
  --bb-field-bg: #171717;
  --bb-hover: rgba(255, 255, 255, 0.06);
  --bb-secondary-hover: #272727;
  --bb-card-border: #3a3a3a;
  --bb-border: #353535;
  --bb-border-subtle: #2a2a2a;
  --bb-control-border: #666666;      /* 3.3:1 on the paper */
  --bb-control-border-hover: #8c8c8c;
  --bb-text-primary: #f2f2f2;
  --bb-text-secondary: #d0d0d0;
  --bb-text-muted: #a6a6a6;
  --bb-text-faint: #8c8c8c;          /* placeholders: 5.6:1 on fields */
  --bb-accent: #e2e2e2;
  --bb-accent-strong: #ffffff;
  --bb-focus-border: #d6d6d6;
  --bb-focus-ring: rgba(255, 255, 255, 0.14);
  --bb-danger: #ff7b8f;
  --bb-danger-rgb: 255, 123, 143;
  --bb-inverse-bg: #f2f2f2;
  --bb-inverse-bg-hover: #d0d0d0;
  --bb-inverse-text: #111111;
  --bb-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 48px -18px rgba(0, 0, 0, 0.7);

  /* Geometry and type */
  --bb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --bb-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bb-radius-card: 10px;
  --bb-radius-control: 6px;
  --bb-control-h: 52px;
  --bb-form-w: 420px;
  --bb-sheet-inset: 20px;
  --bb-grid: 12px;                   /* minor pitch; major is 5 of these */

  /* PatternFly v5 globals consumed by keycloak.v2's compiled sheet */
  --pf-v5-global--FontFamily--sans-serif: var(--bb-font);
  --pf-v5-global--FontFamily--text: var(--bb-font);
  --pf-v5-global--FontFamily--heading: var(--bb-font);
  --pf-v5-global--primary-color--100: var(--bb-accent);
  --pf-v5-global--primary-color--200: var(--bb-accent-strong);
  --pf-v5-global--active-color--100: var(--bb-accent);
  --pf-v5-global--link--Color: var(--bb-accent);
  --pf-v5-global--link--Color--hover: var(--bb-accent-strong);
  --pf-v5-global--danger-color--100: var(--bb-danger);
  --pf-v5-global--danger-color--200: var(--bb-danger);
  --pf-v5-global--BackgroundColor--100: var(--bb-surface);
  --pf-v5-global--BackgroundColor--200: var(--bb-paper);
  --pf-v5-global--BorderColor--100: var(--bb-border);
  --pf-v5-global--Color--100: var(--bb-text-primary);
  --pf-v5-global--Color--200: var(--bb-text-secondary);
  --pf-v5-global--BorderRadius--sm: var(--bb-radius-control);
}

/* Light sheet when the OS prefers light (unless the demo forces dark). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;

    --bb-paper: #f3f3f3;
    --bb-ink: #4a4a4a;
    --bb-drawing-code: url("../img/barrel-section-code-light.422eb849eeb4.svg");

    --bb-surface: #ffffff;
    --bb-surface-subtle: #f7f7f7;
    --bb-field-bg: #ffffff;
    --bb-hover: rgba(0, 0, 0, 0.045);
    --bb-secondary-hover: #eeeeee;
    --bb-card-border: #d2d2d2;
    --bb-border: #dadada;
    --bb-border-subtle: #e6e6e6;
    --bb-control-border: #8a8a8a;
    --bb-control-border-hover: #6b6b6b;
    --bb-text-primary: #161616;
    --bb-text-secondary: #3d3d3d;
    --bb-text-muted: #5c5c5c;
    --bb-text-faint: #6e6e6e;
    --bb-accent: #0969da;
    --bb-accent-strong: #0757b4;
    --bb-focus-border: #0969da;
    --bb-focus-ring: rgba(9, 105, 218, 0.14);
    --bb-danger: #a40e26;
    --bb-danger-rgb: 164, 14, 38;
    --bb-inverse-bg: #161616;
    --bb-inverse-bg-hover: #3d3d3d;
    --bb-inverse-text: #ffffff;
    --bb-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.06), 0 18px 44px -20px rgba(0, 0, 0, 0.18);
  }
}

/* Forced light (comparison page): same values as the media block. */
:root[data-theme="light"] {
  color-scheme: light;

  --bb-paper: #f3f3f3;
  --bb-ink: #4a4a4a;
  --bb-drawing-code: url("../img/barrel-section-code-light.422eb849eeb4.svg");

  --bb-surface: #ffffff;
  --bb-surface-subtle: #f7f7f7;
  --bb-field-bg: #ffffff;
  --bb-hover: rgba(0, 0, 0, 0.045);
  --bb-secondary-hover: #eeeeee;
  --bb-card-border: #d2d2d2;
  --bb-border: #dadada;
  --bb-border-subtle: #e6e6e6;
  --bb-control-border: #8a8a8a;
  --bb-control-border-hover: #6b6b6b;
  --bb-text-primary: #161616;
  --bb-text-secondary: #3d3d3d;
  --bb-text-muted: #5c5c5c;
  --bb-text-faint: #6e6e6e;
  --bb-accent: #0969da;
  --bb-accent-strong: #0757b4;
  --bb-focus-border: #0969da;
  --bb-focus-ring: rgba(9, 105, 218, 0.14);
  --bb-danger: #a40e26;
  --bb-danger-rgb: 164, 14, 38;
  --bb-inverse-bg: #161616;
  --bb-inverse-bg-hover: #3d3d3d;
  --bb-inverse-text: #ffffff;
  --bb-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.06), 0 18px 44px -20px rgba(0, 0, 0, 0.18);
}

/* Forced dark (comparison page): same values as the default. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bb-paper: #111111;
  --bb-ink: #c2c2c2;
  --bb-drawing-code: url("../img/barrel-section-code-dark.85ba1c590376.svg");

  --bb-surface: #181818;
  --bb-surface-subtle: #1f1f1f;
  --bb-field-bg: #171717;
  --bb-hover: rgba(255, 255, 255, 0.06);
  --bb-secondary-hover: #272727;
  --bb-card-border: #3a3a3a;
  --bb-border: #353535;
  --bb-border-subtle: #2a2a2a;
  --bb-control-border: #666666;
  --bb-control-border-hover: #8c8c8c;
  --bb-text-primary: #f2f2f2;
  --bb-text-secondary: #d0d0d0;
  --bb-text-muted: #a6a6a6;
  --bb-text-faint: #8c8c8c;
  --bb-accent: #e2e2e2;
  --bb-accent-strong: #ffffff;
  --bb-focus-border: #d6d6d6;
  --bb-focus-ring: rgba(255, 255, 255, 0.14);
  --bb-danger: #ff7b8f;
  --bb-danger-rgb: 255, 123, 143;
  --bb-inverse-bg: #f2f2f2;
  --bb-inverse-bg-hover: #d0d0d0;
  --bb-inverse-text: #111111;
  --bb-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 48px -18px rgba(0, 0, 0, 0.7);
}

/* --- Page shell: the drawing sheet ---------------------------------- */
* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

/* keycloak.v2 paints a background image on the stable body id; the
   shorthand with !important drops it. The grid lives on the sheet below. */
body#keycloak-bg {
  margin: 0;
  background: var(--bb-paper) !important;
  font-family: var(--bb-font);
  color: var(--bb-text-primary);
}

/* Two equal halves: the form column on the left and the drawing panel on
   the right. At every two-column width a half holds the form plus its
   margins (the narrowest, 960px, gives 480px against 424px), and the form
   is centred in it, so neither half crowds the other. */
.pf-v5-c-login {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  background: transparent;
}

/* The drawing panel: grid paper inside a hairline frame, with a
   registration mark in each corner. It is pinned to the viewport, so a
   tall form (register) scrolls past it. */
.pf-v5-c-login::after {
  --bb-mark: linear-gradient(var(--bb-frame), var(--bb-frame));
  content: "";
  grid-area: 1 / 2;
  align-self: start;
  position: sticky;
  top: 0;
  z-index: -1;
  height: calc(100vh - 2 * var(--bb-sheet-inset));
  height: calc(100dvh - 2 * var(--bb-sheet-inset));
  margin: var(--bb-sheet-inset);
  border: 1px solid var(--bb-frame);
  background:
    var(--bb-mark) left 17px top 24px / 15px 1px no-repeat,
    var(--bb-mark) left 24px top 17px / 1px 15px no-repeat,
    var(--bb-mark) right 17px top 24px / 15px 1px no-repeat,
    var(--bb-mark) right 24px top 17px / 1px 15px no-repeat,
    var(--bb-mark) left 17px bottom 24px / 15px 1px no-repeat,
    var(--bb-mark) left 24px bottom 17px / 1px 15px no-repeat,
    var(--bb-mark) right 17px bottom 24px / 15px 1px no-repeat,
    var(--bb-mark) right 24px bottom 17px / 1px 15px no-repeat,
    linear-gradient(var(--bb-grid-major) 1px, transparent 1px) -1px -1px / calc(var(--bb-grid) * 5) calc(var(--bb-grid) * 5),
    linear-gradient(90deg, var(--bb-grid-major) 1px, transparent 1px) -1px -1px / calc(var(--bb-grid) * 5) calc(var(--bb-grid) * 5),
    linear-gradient(var(--bb-grid-minor) 1px, transparent 1px) -1px -1px / var(--bb-grid) var(--bb-grid),
    linear-gradient(90deg, var(--bb-grid-minor) 1px, transparent 1px) -1px -1px / var(--bb-grid) var(--bb-grid);
  pointer-events: none;
}

/* The drawing: one SVG, masked over the ink token, contained inside the
   panel, with its inline code drawn to the same box. It shares the
   panel's grid cell and stickiness. */
.pf-v5-c-login::before {
  content: "";
  grid-area: 1 / 2;
  align-self: start;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  padding: clamp(56px, 9vh, 112px) clamp(48px, 5vw, 112px);
  background: var(--bb-drawing-code) center / contain no-repeat content-box, var(--bb-ink);
  -webkit-mask: url("../img/barrel-section.58c6bec342a7.svg") center / contain no-repeat content-box;
  mask: url("../img/barrel-section.58c6bec342a7.svg") center / contain no-repeat content-box;
  pointer-events: none;
}

/* The form column: the lockup in its top-left corner and the form centred
   on the page. The rows above and below the form stay equal and never
   shorter than the lockup's row, so the form sits at the page's middle
   and, on a short page (register), moves down rather than under the
   lockup. The areas are PatternFly's own names, which the header and main
   already claim. */
.pf-v5-c-login__container {
  grid-area: 1 / 1;
  align-self: stretch;
  display: grid;
  grid-template-areas: "header" "main" ".";
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr auto 1fr;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 32px;
}

/* Product lockup: in flow in the top row, so it can never overlap the form
   however tall the form gets. Its centre line meets the drawing panel's
   top registration marks. */
.pf-v5-c-login__header {
  align-self: start;
  justify-self: start;
  position: static;
  margin: 0;
  padding: 35px 0 44px;
  transform: none;
  text-align: left;
}

/* Keep the page title available to assistive technology on the sign-in
   page, which shows its own welcome heading. */
.pf-v5-c-login__main-header {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  border-top: 0; /* keycloak.v2 paints a 4px brand stripe here */
}

/* Every other page (register, device, consent, errors) has no in-body
   heading, so its page title becomes the visible heading. */
body:not([data-page-id="login-login"]) .pf-v5-c-login__main-header {
  position: static;
  display: block;
  width: auto;
  height: auto;
  margin: 0 0 24px;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

#kc-page-title {
  margin: 0;
  color: var(--bb-text-primary);
  font-family: var(--bb-font);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.024em;
  text-align: left;
}

/* The lockup is a size up from an app header: its capitals match a 26px
   Geist Bold title (cap height 0.71 em), and the mark is 1.15 times that
   cap height, as design/brand draws it. The realm title (loginTitleHtml)
   stays in the element as the accessible name, moved out of view; the
   outlined lockup is painted in its place. */
#kc-header-wrapper.pf-v5-c-brand {
  --bb-lockup-cap: 18.46px;
  display: block;
  height: calc(var(--bb-lockup-cap) * 1.15);
  aspect-ratio: 613.18 / 81.65;
  width: auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bb-text-primary);
  -webkit-mask: var(--bb-logo) left center / contain no-repeat;
  mask: var(--bb-logo) left center / contain no-repeat;
  color: transparent !important;
  font-size: 16px;
  line-height: 1;
  text-indent: 100%;
  white-space: nowrap;
}

/* --- Form column (no card) ---------------------------------------- */
/* The form sits on the open page; __main and its body carry no chrome. */
.pf-v5-c-login__main {
  position: relative;
  display: block;
  justify-self: center;
  width: min(var(--bb-form-w), 100%);
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.pf-v5-c-login__main::before {
  display: none; /* PF's branded top stripe */
}

/* The social-provider UL reuses the __main-body class; only the direct
   child of __main is the form body. */
.pf-v5-c-login__main > .pf-v5-c-login__main-body {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.bb-login-heading {
  margin: 0 0 32px;
  color: var(--bb-text-primary);
  font-size: 38px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-align: left;
}

/* Placeholder provider actions: plain type=button controls until real
   identity providers are wired, so they cannot submit the form. Before
   launch this should come from the realm's identity providers instead. */
.bb-provider-actions {
  display: grid;
  gap: 12px;
}

.bb-provider-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--bb-control-h);
  padding: 8px 16px;
  border: 1px solid var(--bb-control-border);
  border-radius: var(--bb-radius-control);
  background: transparent;
  color: var(--bb-text-primary);
  font-family: var(--bb-font);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}

.bb-provider-button:hover {
  background: var(--bb-hover);
  border-color: var(--bb-control-border-hover);
}

.bb-provider-button:focus-visible {
  outline: 2px solid var(--bb-focus-border);
  outline-offset: 2px;
}

.bb-provider-icon {
  flex: none;
  width: 20px;
  height: 20px;
}

.bb-login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--bb-text-muted);
  font-size: 13px;
  line-height: 1;
  text-align: center;
}

.bb-login-divider::before,
.bb-login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--bb-border);
}

/* footer.ftl is an empty macro; keep its slot from adding phantom space. */
.pf-v5-c-login__main > .pf-v5-c-login__main-footer {
  padding: 0;
  margin: 0;
}

.pf-v5-c-login__main-body .pf-v5-c-login__main-footer {
  padding: 0;
  margin: 0;
}

/* --- Alerts (bad credentials, info banners) ----------------------- */
.pf-v5-c-alert {
  padding: 12px 14px;
  background: var(--bb-surface-subtle);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius-control);
  box-shadow: none;
}

.pf-v5-c-alert.pf-m-danger {
  background: rgba(var(--bb-danger-rgb), 0.08);
  border-color: rgba(var(--bb-danger-rgb), 0.4);
}

/* keycloak.v2 leaves the feedback icon properties empty (no icon font
   ships), so the icon cell is dead space; drop it. */
.pf-v5-c-alert__icon {
  display: none;
}

.pf-v5-c-alert__title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--bb-text-primary);
}

.pf-v5-c-alert.pf-m-danger .pf-v5-c-alert__title {
  color: var(--bb-danger);
}

/* --- Form structure ------------------------------------------------ */
.pf-v5-c-form {
  display: grid;
  gap: 20px;
}

.pf-v5-c-form__group {
  margin: 0;
}

/* Labels are visible on every page; the sign-in fields drop their
   placeholders (login.ftl no longer passes them). */
.pf-v5-c-form__group-label {
  padding: 0 0 8px !important;
}

.pf-v5-c-form__label,
.pf-v5-c-form__label-text {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--bb-text-secondary);
}

/* Register: the "* Required fields" note as a quiet annotation. */
body[data-page-id="login-register"] .subtitle {
  margin: -8px 0 20px;
}

body[data-page-id="login-register"] .subtitle .pf-v5-c-helper-text__item-text {
  color: var(--bb-text-muted);
  font-size: 12px;
}

/* --- Text inputs ---------------------------------------------------- */
.pf-v5-c-form-control {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--bb-control-h);
  padding: 0;
  overflow: hidden;
  background: var(--bb-field-bg);
  border: 1px solid var(--bb-control-border);
  border-radius: var(--bb-radius-control);
  box-shadow: none;
  transition: border-color 0.12s, box-shadow 0.12s, background-color 0.12s;
}

.pf-v5-c-form-control::before,
.pf-v5-c-form-control::after {
  display: none; /* PF status underlines */
}

.pf-v5-c-form-control > input,
.pf-v5-c-form-control > select,
.pf-v5-c-form-control > textarea {
  width: 100%;
  min-height: calc(var(--bb-control-h) - 2px);
  padding: 0 14px;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--bb-font);
  font-size: 16px;
  line-height: normal;
  color: var(--bb-text-primary);
}

.pf-v5-c-form-control input::placeholder,
.pf-v5-c-form-control textarea::placeholder {
  color: var(--bb-text-faint);
  opacity: 1;
}

.pf-v5-c-form-control:hover {
  border-color: var(--bb-control-border-hover);
}

.pf-v5-c-form-control:focus-within {
  border-color: var(--bb-focus-border);
  box-shadow: 0 0 0 3px var(--bb-focus-ring);
}

/* The wrapper carries the focus treatment; keep the inner element's own
   ring from doubling it. */
.pf-v5-c-form-control > :is(input, select, textarea):focus,
.pf-v5-c-form-control > :is(input, select, textarea):focus-visible {
  outline: none;
}

.pf-v5-c-form-control.pf-m-error {
  border-color: var(--bb-danger);
}

/* Empty-glyph status icon cell inside inputs (no icon font). */
.pf-v5-c-form-control__utilities {
  display: none;
}

/* --- Password group (input + visibility toggle) --------------------- */
.pf-v5-c-input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: var(--bb-control-h);
  overflow: hidden;
  background: var(--bb-field-bg);
  border: 1px solid var(--bb-control-border);
  border-radius: var(--bb-radius-control);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.pf-v5-c-input-group:hover {
  border-color: var(--bb-control-border-hover);
}

.pf-v5-c-input-group:focus-within {
  border-color: var(--bb-focus-border);
  box-shadow: 0 0 0 3px var(--bb-focus-ring);
}

.pf-v5-c-input-group__item {
  display: flex;
}

.pf-v5-c-input-group__item.pf-m-fill {
  flex: 1;
  min-width: 0;
}

.pf-v5-c-input-group .pf-v5-c-form-control {
  min-height: calc(var(--bb-control-h) - 2px);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.pf-v5-c-input-group .pf-v5-c-form-control:focus-within {
  box-shadow: none;
}

.pf-v5-c-input-group:has(input.pf-m-error),
.pf-v5-c-input-group:has(input[aria-invalid="true"]) {
  border-color: var(--bb-danger);
}

.pf-v5-c-input-group .pf-v5-c-button.pf-m-control {
  display: grid;
  place-items: center;
  width: 48px;
  min-height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--bb-text-muted);
  cursor: pointer;
}

.pf-v5-c-input-group .pf-v5-c-button.pf-m-control:hover {
  background: var(--bb-hover);
  color: var(--bb-text-primary);
}

/* keycloak.v2 references Font Awesome classes but ships no icon font;
   supply the glyphs as currentColor masks. */
.pf-v5-c-button.pf-m-control i {
  display: block;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: var(--bb-icon) center / contain no-repeat;
  mask: var(--bb-icon) center / contain no-repeat;
}

.pf-v5-c-button.pf-m-control i.fa-eye {
  --bb-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M1%2012s4-8%2011-8%2011%208%2011%208-4%208-11%208-11-8-11-8z'/%3E%3Ccircle%20cx='12'%20cy='12'%20r='3'/%3E%3C/svg%3E");
}

.pf-v5-c-button.pf-m-control i.fa-eye-slash {
  --bb-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M17.94%2017.94A10.07%2010.07%200%200%201%2012%2020c-7%200-11-8-11-8a18.45%2018.45%200%200%201%205.06-5.94M9.9%204.24A9.12%209.12%200%200%201%2012%204c7%200%2011%208%2011%208a18.5%2018.5%200%200%201-2.16%203.19m-6.72-1.07a3%203%200%201%201-4.24-4.24'/%3E%3Cline%20x1='1'%20y1='1'%20x2='23'%20y2='23'/%3E%3C/svg%3E");
}

.pf-v5-c-button.pf-m-control i.fa-sync-alt {
  --bb-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpolyline%20points='23%204%2023%2010%2017%2010'/%3E%3Cpolyline%20points='1%2020%201%2014%207%2014'/%3E%3Cpath%20d='M3.51%209a9%209%200%200%201%2014.85-3.36L23%2010M1%2014l4.64%204.36A9%209%200%200%200%2020.49%2015'/%3E%3C/svg%3E");
}

input:-webkit-autofill {
  -webkit-text-fill-color: var(--bb-text-primary);
  caret-color: var(--bb-text-primary);
  box-shadow: 0 0 0 1000px var(--bb-field-bg) inset;
}

/* --- Buttons --------------------------------------------------------- */
.pf-v5-c-button {
  font-family: var(--bb-font);
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--bb-radius-control);
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}

/* PF draws button borders on ::after; the skin owns real borders. */
.pf-v5-c-button::after {
  border: 0 !important;
}

.pf-v5-c-form__actions {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding-top: 8px !important;
}

.pf-v5-c-button.pf-m-primary {
  width: 100%;
  min-height: var(--bb-control-h);
  margin: 0;
  padding: 0 16px;
  border: 0;
  background-color: var(--bb-inverse-bg);
  color: var(--bb-inverse-text);
  box-shadow: none;
}

.pf-v5-c-button.pf-m-primary:hover,
.pf-v5-c-button.pf-m-primary:active {
  background-color: var(--bb-inverse-bg-hover);
  color: var(--bb-inverse-text);
}

.pf-v5-c-button.pf-m-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--bb-control-h);
  padding: 0 16px;
  background: var(--bb-surface-subtle);
  border: 1px solid var(--bb-border);
  color: var(--bb-text-primary);
  text-decoration: none;
}

.pf-v5-c-button.pf-m-secondary:hover {
  background: var(--bb-secondary-hover);
  border-color: var(--bb-control-border);
  color: var(--bb-text-primary);
}

.pf-v5-c-button.pf-m-block {
  width: 100%;
}

.pf-v5-c-button:focus-visible {
  outline: 2px solid var(--bb-focus-border);
  outline-offset: 2px;
}

/* Register submits with an <input>, which sits outside .pf-v5-c-form. */
#kc-form-buttons {
  margin-top: 8px;
}

/* --- Social providers (rendered when IdPs exist) --------------------- */
ul.pf-v5-c-login__main-body {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

a[id^="social-"] {
  gap: 10px;
  justify-content: center !important;
}

a[id^="social-"] svg {
  flex: none;
  width: 20px;
  height: 20px;
}

a[id^="social-"] .pf-v5-u-m-auto {
  margin: 0 !important;
}

/* "or" band above the social list, and the register/back-to-login bands. */
.pf-v5-c-login__main-footer-band {
  margin: 24px 0 0;
  padding: 0;
  border: 0; /* PF band top rule */
  text-align: left;
}

/* keycloak.v2 recolors brand SVGs with a blue hue filter; keep them on the
   button's text color instead (Google keeps its own brand colors). */
#kc-social-providers svg:not(.google) {
  filter: none;
  fill: currentColor;
}

.pf-v5-c-login__main-footer-band-item {
  font-size: 14px;
  line-height: 1.5;
  color: var(--bb-text-muted);
}

.pf-v5-c-login__main-footer-band-item a {
  color: var(--bb-text-primary);
  font-size: inherit;
  font-weight: 600;
  text-decoration: none;
}

.pf-v5-c-login__main-footer-band-item a:hover {
  text-decoration: underline;
}

#kc-social-providers {
  margin: 0;
}

/* Registration/info band (hidden while registration is disabled). */
#kc-info {
  margin-top: 28px;
  padding-top: 0;
  border-top: 0;
  text-align: left;
}

/* The sign-up line sits centred under the sign-in button; other pages'
   info text (reset instructions and the like) stays left-aligned. */
#kc-registration {
  text-align: center;
}

/* --- Links, helper rows, errors, checkboxes -------------------------- */
a {
  color: var(--bb-accent);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--bb-accent-strong);
}

a:focus-visible {
  outline: 2px solid var(--bb-focus-border);
  outline-offset: 2px;
  border-radius: 2px;
}

a.pf-v5-c-button {
  font-size: 15px;
  text-decoration: none;
}

.pf-v5-c-form__helper-text {
  margin: 0;
}

/* Keycloak renders user-profile annotations outside PatternFly's helper-text
   classes. Keep this permanent-username note legible but quieter than labels,
   entered values, and validation errors. */
body[data-page-id="login-register"] #form-help-text-after-username {
  margin-top: 6px;
  color: var(--bb-text-muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Password recovery sits on the password label's row, right-aligned, where
   people look for it. CSS only: keycloak.v2 renders the link in the helper
   text after the field, so the group becomes a two-column grid. (If the
   realm turns on "Remember me", its checkbox renders in the same helper row
   and this needs a field.ftl change instead.) */
body[data-page-id="login-login"] .pf-v5-c-form__group:has(#password) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
}

body[data-page-id="login-login"] .pf-v5-c-form__group:has(#password) > .pf-v5-c-form__group-label {
  grid-area: 1 / 1;
}

body[data-page-id="login-login"] .pf-v5-c-form__group:has(#password) > .pf-v5-c-form__helper-text {
  grid-area: 1 / 2;
  margin: 0;
}

body[data-page-id="login-login"] .pf-v5-c-form__group:has(#password) > .pf-v5-c-input-group {
  grid-area: 2 / 1 / 3 / 3;
}

body[data-page-id="login-login"] .pf-v5-c-form__group:has(#password) > [id^="input-error-container"] {
  grid-area: 3 / 1 / 4 / 3;
}

body[data-page-id="login-login"] .pf-v5-c-form__group:has(#password) .pf-v5-c-helper-text__item-text a {
  color: var(--bb-text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

body[data-page-id="login-login"] .pf-v5-c-form__group:has(#password) .pf-v5-c-helper-text__item-text a:hover {
  color: var(--bb-text-primary);
  text-decoration: underline;
}

.pf-v5-c-helper-text__item-text {
  font-size: 13px;
  color: var(--bb-text-secondary);
}

.pf-v5-c-helper-text__item-text.pf-m-error,
.pf-v5-c-helper-text__item.pf-m-error .pf-v5-c-helper-text__item-text {
  color: var(--bb-danger);
}

#input-error-container-username .pf-v5-c-form__helper-text {
  margin-top: 6px;
}

.pf-v5-c-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pf-v5-c-check__input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--bb-inverse-bg);
}

.pf-v5-c-check__label {
  font-size: 13px;
  color: var(--bb-text-secondary);
}

/* --- Device sign-in (RFC 8628) ---------------------------------------- */
/* Two pages: the code-entry form (login-oauth2-device-verify-user-code) and
   the consent screen (login-oauth-grant). */

.bb-lede {
  margin: -8px 0 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--bb-text-secondary);
  text-align: left;
}

/* Closing caution: guidance, not an error, but the last thing read before
   acting, so it keeps a visible rule. */
.bb-caution {
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--bb-border-subtle);
  font-size: 12px;
  line-height: 1.5;
  color: var(--bb-text-muted);
  text-align: left;
}

/* The code field: one wide, centred, monospace field, set large and tracked
   out so the code reads back exactly as the terminal printed it.
   text-transform is presentation only; Keycloak compares the submitted
   value case-insensitively. */
#kc-device-verify .pf-v5-c-form-control {
  min-height: 64px;
}

#kc-device-verify input#device_user_code {
  min-height: 62px;
  padding: 0 12px;
  font-family: var(--bb-mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.22em;
  /* Tracking adds a trailing gap after the last glyph; pull the text back
     by half of it so the value stays optically centred. */
  text-indent: 0.22em;
  text-align: center;
  text-transform: uppercase;
}

#kc-device-verify input#device_user_code::placeholder {
  font-size: 22px;
  letter-spacing: 0.22em;
  color: var(--bb-text-faint);
  text-transform: uppercase;
}

/* --- Device code: one box per character ------------------------------ */
/* device-code.js replaces the single code field with one box per
   character, grouped like the placeholder, and keeps the original field
   hidden as the submitted value. Each box is a .pf-v5-c-form-control, so
   the field, hover, focus and error styles above apply to it; these rules
   size the row and set the glyphs. The single field (shown only when
   scripts are blocked) has the same height, so the swap moves nothing. */
#kc-device-verify .pf-v5-c-form-control {
  min-height: 56px;
}

#kc-device-verify input#device_user_code {
  min-height: 54px;
}

.bb-code {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bb-code__group {
  display: flex;
  flex: 1 1 0;
  gap: 8px;
  min-width: 0;
}

.bb-code__separator {
  flex: none;
  width: 10px;
  height: 2px;
  background: var(--bb-text-muted);
}

#kc-device-verify .bb-code__cell {
  flex: 1 1 0;
  min-width: 0;
  height: 56px;
}

#kc-device-verify .bb-code__box {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 0;
  font-family: var(--bb-mono);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

/* Focusing a filled box selects its character so typing replaces it; tint
   the selection with the focus ring instead of the system highlight. */
#kc-device-verify .bb-code__box::selection {
  background: var(--bb-focus-ring);
  color: var(--bb-text-primary);
}

@media (max-width: 480px) {
  .bb-code {
    gap: 6px;
  }

  .bb-code__group {
    gap: 5px;
  }

  #kc-device-verify .pf-v5-c-form-control {
    min-height: 52px;
  }

  #kc-device-verify input#device_user_code {
    min-height: 50px;
  }

  #kc-device-verify .bb-code__cell {
    height: 52px;
  }
}

/* Consent: the requested-privileges list. */
#kc-oauth h3 {
  margin: 0 0 10px;
  font-family: var(--bb-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bb-text-muted);
}

#kc-oauth ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

#kc-oauth ul li {
  padding: 9px 12px;
  margin-bottom: 6px;
  background: var(--bb-surface-subtle);
  border: 1px solid var(--bb-border-subtle);
  border-radius: var(--bb-radius-control);
  font-size: 13px;
  color: var(--bb-text-primary);
}

/* --- Pages beyond sign-in ------------------------------------------------ */
/* keycloak.v2 puts "Back to sign in" (password reset) and "No" (consent) in
   the actions grid as secondary buttons. PF's child margins would inset
   them; here they sit flush, full width, outlined like the provider button. */
.pf-v5-c-form__actions > .pf-v5-c-button {
  margin: 0;
}

.pf-v5-c-button.pf-m-secondary {
  background: transparent;
  border: 1px solid var(--bb-control-border);
}

.pf-v5-c-button.pf-m-secondary:hover {
  background: var(--bb-hover);
  border-color: var(--bb-control-border-hover);
}

/* User-profile fields (register, update profile) mark an error with
   aria-invalid on the input only, not with pf-m-error on the wrapper. */
.pf-v5-c-form-control:has(> input[aria-invalid="true"]) {
  border-color: var(--bb-danger);
}

/* Consent: the question above the scope list, in the form's voice. */
#kc-oauth h3 {
  font-family: var(--bb-font);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--bb-text-secondary);
}

/* --- Mid widths: a slimmer form and a tighter drawing inset ----------- */
@media (max-width: 1199px) {
  :root {
    --bb-form-w: 360px;
  }

  .pf-v5-c-login::before {
    padding: clamp(40px, 7vh, 72px) 32px;
  }
}

/* --- Short screens: a tighter rhythm keeps the form above the fold ----- */
@media (min-width: 960px) and (max-height: 760px) {
  :root {
    --bb-control-h: 48px;
  }

  .pf-v5-c-login__header {
    padding-bottom: 28px;
  }

  .bb-login-heading {
    margin-bottom: 20px;
    font-size: 30px;
  }

  .bb-login-divider {
    margin: 18px 0;
  }

  .pf-v5-c-form {
    gap: 16px;
  }

  #kc-info {
    margin-top: 22px;
  }
}

/* --- Narrow screens: one column, no drawing, no heading ---------------- */
@media (max-width: 959px) {
  .pf-v5-c-login {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The drawing and the heading collapse together, so they share one
     rule. The visually hidden page title still names the page. */
  .pf-v5-c-login::before,
  .pf-v5-c-login::after,
  .bb-login-heading {
    display: none;
  }

  /* No registration marks to meet: an even corner inset. */
  .pf-v5-c-login__header {
    padding: 32px 0 40px;
  }
}

@media (max-width: 480px) {
  :root {
    --bb-control-h: 48px;
  }

  .pf-v5-c-login__container {
    padding: 0 16px;
  }

  .pf-v5-c-login__header {
    padding: 24px 0 32px;
  }

  #kc-page-title {
    font-size: 26px;
  }
}
