    /* Keycloak / PatternFly shell: dark masthead and sidebar, light content. */
    :root {
      --kc-masthead-bg: #151515;
      --kc-sidebar-bg: #212427;
      --kc-sidebar-hover: #3c3f42;
      --kc-sidebar-active: #4f5255;
      --kc-sidebar-active-edge: #73bcf7;
      --kc-sidebar-text: #f0f0f0;
      --kc-sidebar-muted: #b8bbbe;
      --radius: 4px;
      --radius-sm: 3px;
    }

    body[data-theme="light"] {
      --bg: #f0f0f0;
      --surface: #fafafa;
      --border: #d2d2d2;
      --border-strong: #b8bbbe;
      --accent: #0066cc;
      --accent-hover: #004080;
      --muted: #6a6e73;
      --text: #151515;
    }

    body {
      background: var(--bg);
    }

    .af-tabs[hidden],
    .af-config-subtabs[hidden],
    .af-panel > .af-section-head[hidden],
    .kc-user-group[hidden],
    [data-kc-section][hidden],
    .kc-page-tabs[hidden],
    .kc-group[hidden],
    [data-kc-panel][hidden] {
      display: none !important;
    }

    header.kc-masthead {
      padding: 0 16px;
      background: var(--kc-masthead-bg);
      border-bottom: 1px solid #000;
      color: #fff;
      backdrop-filter: none;
    }

    .kc-masthead .header-inner {
      display: flex;
      align-items: center;
      gap: 16px;
      min-height: 56px;
    }

    .kc-brand {
      display: grid;
      gap: 2px;
      margin-right: auto;
    }

    .kc-masthead h1 {
      font-size: calc(18px * var(--kc-fs-scale, 1));
      font-weight: 600;
      color: #fff;
    }

    .kc-masthead .subtitle {
      margin: 0;
      font-size: calc(12px * var(--kc-fs-scale, 1));
      color: var(--kc-sidebar-muted);
    }

    .kc-masthead .subtitle code {
      background: transparent;
      border-color: #3c3f42;
      color: #f0f0f0;
    }

    .kc-realm-switch {
      display: flex;
      align-items: center;
      gap: 8px;
      margin: 0;
      font-size: calc(12px * var(--kc-fs-scale, 1));
      color: var(--kc-sidebar-muted);
    }

    .kc-realm-switch select {
      min-width: 180px;
      background: #26292d;
      color: #fff;
      border-color: #4f5255;
    }

    body:not([data-console="af"]) .kc-realm-switch {
      display: none;
    }

    .kc-masthead .console-nav .secondary {
      background: transparent;
      color: #f0f0f0;
      border-color: #4f5255;
    }

    .kc-masthead .console-nav .secondary.is-active {
      background: #0066cc;
      border-color: #0066cc;
      color: #fff;
    }

    body[data-console="af"] main,
    body[data-console="checklist"] main {
      grid-template-columns: 260px minmax(0, 1fr);
      gap: 0;
      padding: 0;
      overflow: hidden;
    }

    body[data-console="checklist"] main > .grid {
      overflow: auto;
      padding: var(--space-3);
    }

    body[data-console="af"] main > .grid {
      min-height: 0;
      overflow: hidden;
      padding: 0;
    }

    aside.kc-sidebar {
      display: flex;
      flex-direction: column;
      gap: 0;
      min-height: 0;
      padding: 0;
      border-radius: 0;
      box-shadow: none;
      overflow-y: auto;
      background: var(--kc-sidebar-bg);
      color: var(--kc-sidebar-text);
      border-right: 1px solid #000;
    }

    .kc-nav {
      display: flex;
      flex-direction: column;
      padding: 8px 0 16px;
    }

    body:not([data-console="af"]) .kc-nav {
      display: none;
    }

    .kc-nav-group {
      margin: 16px 16px 4px;
      font-size: calc(12px * var(--kc-fs-scale, 1));
      font-weight: 600;
      letter-spacing: 0.02em;
      text-transform: uppercase;
      color: var(--kc-sidebar-muted);
    }

    .kc-nav-item {
      display: block;
      width: 100%;
      margin: 0;
      padding: 8px 16px 8px 20px;
      border: 0;
      border-left: 3px solid transparent;
      border-radius: 0;
      background: transparent;
      color: var(--kc-sidebar-text);
      font-weight: 400;
      text-align: left;
      box-shadow: none;
    }

    .kc-nav-item:hover {
      background: var(--kc-sidebar-hover);
      color: #fff;
    }

    .kc-nav-item.is-active {
      background: var(--kc-sidebar-active);
      border-left-color: var(--kc-sidebar-active-edge);
      color: #fff;
      font-weight: 600;
    }

    .kc-nav-sub[hidden] {
      display: none;
    }

    .kc-nav-subitem {
      display: block;
      width: 100%;
      margin: 0;
      padding: 6px 16px 6px 36px;
      border: 0;
      border-left: 3px solid transparent;
      border-radius: 0;
      background: transparent;
      color: var(--kc-sidebar-muted);
      font-size: calc(13px * var(--kc-fs-scale, 1));
      font-weight: 400;
      text-align: left;
      box-shadow: none;
    }

    .kc-nav-subitem:hover {
      background: var(--kc-sidebar-hover);
      color: #fff;
    }

    .kc-nav-subitem.is-active {
      border-left-color: var(--kc-sidebar-active-edge);
      color: #fff;
      font-weight: 600;
    }

    .kc-connection {
      margin: auto 12px 12px;
      padding: 10px 12px;
      border: 1px solid #3c3f42;
      border-radius: var(--radius);
      background: #1b1d21;
      color: var(--kc-sidebar-text);
    }

    .kc-connection > summary {
      cursor: pointer;
      list-style: none;
    }

    .kc-connection > summary::-webkit-details-marker {
      display: none;
    }

    .kc-connection > summary h2::before {
      content: "▸ ";
    }

    .kc-connection[open] > summary h2::before {
      content: "▾ ";
    }

    .kc-connection label,
    .kc-connection .small {
      color: var(--kc-sidebar-muted);
    }

    .kc-connection input,
    .kc-connection select {
      background: #26292d;
      color: #fff;
      border-color: #4f5255;
    }

    body[data-console="af"] .af-dashboard.card {
      grid-template-rows: auto minmax(0, 1fr);
      gap: 0;
      padding: 0;
      border: 0;
      border-radius: 0;
      box-shadow: none;
      background: transparent;
    }

    .kc-page-header {
      display: grid;
      gap: 4px;
      padding: 16px 24px 0;
      background: var(--panel);
      border-bottom: 1px solid var(--border);
    }

    .kc-page-header h2 {
      margin: 0;
      font-size: calc(24px * var(--kc-fs-scale, 1));
      font-weight: 400;
    }

    .kc-page-header > p {
      margin: 0 0 12px;
    }

    .kc-breadcrumb {
      display: flex;
      gap: 6px;
      color: var(--muted);
    }

    .kc-page-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 0;
      margin: 0 -24px;
      padding: 0 24px;
    }

    .kc-page-tab {
      width: auto;
      margin: 0;
      padding: 10px 16px;
      border: 0;
      border-bottom: 3px solid transparent;
      border-radius: 0;
      background: transparent;
      color: var(--muted);
      font-weight: 400;
      box-shadow: none;
    }

    .kc-page-tab:hover {
      color: var(--text);
      background: transparent;
      border-bottom-color: var(--border-strong);
    }

    .kc-page-tab.is-active {
      color: var(--text);
      border-bottom-color: var(--accent);
    }

    body[data-console="af"] .af-dashboard > .af-panel {
      margin: 16px 24px 24px;
      padding: 16px 24px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: var(--panel);
    }

    .af-dashboard[data-kc-config="on"] .af-config-panel .af-config-section {
      display: grid;
    }

    .af-dashboard[data-kc-config="on"] .af-config-panel .af-config-section:not(:has(> .kc-group:not([hidden]))):not(.kc-group) {
      display: none;
    }

    .af-dashboard[data-kc-config="on"] .af-config-panel .af-config-section.kc-group[hidden] {
      display: none;
    }

    .af-config-section > .kc-group {
      display: grid;
      gap: inherit;
      align-content: start;
    }

    @media (max-width: 900px) {
      body[data-console="af"] main,
      body[data-console="checklist"] main {
        grid-template-columns: minmax(0, 1fr);
      }

      aside.kc-sidebar {
        max-height: 40vh;
      }

      .kc-realm-switch,
      .kc-masthead .subtitle {
        display: none;
      }
    }

    .kc-toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--space-2);
      margin: var(--space-2) 0;
    }

    .kc-toolbar > button {
      width: auto;
    }

    .af-users-panel .kc-user-group {
      display: grid;
      gap: var(--space-2);
      align-content: start;
    }

    body[data-console="af"] .af-dashboard > .kc-panel {
      display: grid;
      align-content: start;
      gap: var(--space-3);
      min-height: 0;
      overflow-y: auto;
      margin: 16px 24px 24px;
      padding: 16px 24px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: var(--panel);
    }

    .kc-panel > section {
      display: grid;
      gap: var(--space-2);
    }

    .kc-tool {
      margin: var(--space-2) 0;
      padding: var(--space-2) var(--space-3);
      border: 1px solid var(--border);
      border-radius: var(--radius);
    }

    .kc-tool > summary {
      cursor: pointer;
      font-weight: 600;
    }

    .kc-panel .af-toolbar-row,
    .kc-tool .af-toolbar-row,
    .kc-user-group .af-toolbar-row,
    [data-kc-group$="-test"] .af-toolbar-row,
    [data-kc-section^="clients:test"] .af-toolbar-row {
      flex-wrap: wrap;
      align-items: flex-end;
    }

    .kc-panel .af-toolbar-row > button,
    .kc-tool .af-toolbar-row > button,
    .kc-user-group .af-toolbar-row > button,
    [data-kc-group$="-test"] .af-toolbar-row > button,
    [data-kc-section^="clients:test"] .af-toolbar-row > button,
    .kc-user-group > button {
      width: auto;
    }

    /* CF: Keycloak login card and Account Console */
    body[data-console="cf"] main:has(.auth-card:not([data-auth-view="session"])) {
      background: linear-gradient(160deg, #1b1d21 0%, #2b3a4a 55%, #1f4f82 100%);
    }

    body[data-console="cf"] .auth-card:not([data-auth-view="session"]) {
      border: 0;
      border-top: 4px solid var(--accent);
      border-radius: 4px;
      box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    }

    body[data-console="cf"] .auth-card:not([data-auth-view="session"]) #authTitle {
      text-align: center;
      font-size: calc(24px * var(--kc-fs-scale, 1));
      font-weight: 400;
    }

    body[data-console="cf"] .auth-tabs {
      padding: 0;
      gap: 0;
      border: 0;
      border-bottom: 1px solid var(--border);
      border-radius: 0;
      background: transparent;
    }

    body[data-console="cf"] .auth-tab {
      border: 0;
      border-bottom: 3px solid transparent;
      border-radius: 0;
      background: transparent;
      color: var(--muted);
      font-size: calc(14px * var(--kc-fs-scale, 1));
    }

    body[data-console="cf"] .auth-tab.is-active {
      background: transparent;
      border-bottom-color: var(--accent);
      color: var(--text);
      box-shadow: none;
    }

    .cf-resend-row {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--space-2);
    }

    .cf-resend-row button {
      width: auto;
    }

    .cf-resend-row label {
      display: flex;
      align-items: center;
      gap: 6px;
      margin: 0;
    }

    .cf-resend-row select {
      width: auto;
    }

    .cf-account-layout {
      display: grid;
      grid-template-columns: 232px minmax(0, 1fr);
      gap: 0;
      align-items: start;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: var(--panel);
      min-height: 560px;
    }

    .cf-nav {
      display: grid;
      align-content: start;
      gap: 2px;
      padding: 16px 0;
      border-right: 1px solid var(--border);
      background: var(--surface);
      align-self: stretch;
    }

    .cf-nav .cf-nav-item {
      width: 100%;
      flex: none;
      text-align: left;
      padding: 10px 20px;
      border: 0;
      border-left: 3px solid transparent;
      border-radius: 0;
      background: transparent;
      color: var(--text);
      font-size: calc(14px * var(--kc-fs-scale, 1));
      font-weight: 400;
      box-shadow: none;
    }

    .cf-nav .cf-nav-item:hover {
      background: var(--panel);
    }

    .cf-nav .cf-nav-item.is-active {
      border-left-color: var(--accent);
      background: var(--panel);
      color: var(--text);
      font-weight: 600;
      box-shadow: none;
    }

    .cf-nav .cf-nav-sub {
      padding-left: 36px;
    }

    .cf-nav-group {
      margin: 8px 0 2px;
      padding: 0 20px;
      color: var(--muted);
      font-size: calc(12px * var(--kc-fs-scale, 1));
      font-weight: 600;
    }

    .cf-account-content {
      display: grid;
      gap: var(--space-3);
      min-width: 0;
      padding: 24px 28px;
    }

    .cf-page-head {
      grid-column: 1 / -1;
      display: grid;
      gap: 4px;
      padding-bottom: 12px;
      border-bottom: 1px solid var(--border);
    }

    .cf-page-head h2 {
      margin: 0;
      font-size: calc(24px * var(--kc-fs-scale, 1));
      font-weight: 400;
    }

    .cf-page-head p {
      margin: 0;
    }

    .cf-dashboard[data-cf-tab="linked"] .cf-linked-panel,
    .cf-dashboard[data-cf-tab="applications"] .cf-applications-panel,
    .cf-dashboard[data-cf-tab="organizations"] .cf-organizations-panel {
      display: grid;
    }

    .cf-dashboard .af-users-actions > button {
      width: auto;
    }

    @media (max-width: 900px) {
      .cf-account-layout {
        grid-template-columns: 1fr;
      }

      .cf-nav {
        border-right: 0;
        border-bottom: 1px solid var(--border);
      }
    }

    .auth-card[data-auth-view="session"] .api-exchange {
      order: 10;
    }
