/*
 * EtherNexion 登录主题（继承 keycloak.v2）
 *
 * 色板与动效真源：design-tokens/brand.css、ethernexion-web/src/app/globals.css（``--brand-*`` / ``--ring`` / ``.enx-field-shell``）。
 * 视觉取向：浅色 macOS 登录窗（毛玻璃白卡片 + SF 系字体栈 + 单层输入框），
 * 并覆盖 Realm「暗色」开关下的 PF 变量，避免标题压在深灰底上不可读、输入框双层描边。
 * 卡片最大宽度对齐 Next ``/auth/login`` 左栏：``max-w-6xl`` + ``lg:grid-cols-2`` 下单列约 33–36rem。
 */

:root {
  /* 与 CMS / Next globals 品牌色阶一致（#4cb1e5 主色，非历史深蓝 #1e5eff） */
  --auth-background: #eef9fd;
  --auth-background-mid: #ffffff;
  --auth-foreground: #1d1d1f;
  --auth-muted: #86868b;
  --auth-brand-900: #063747;
  --auth-brand-800: #1a7aa3;
  --auth-brand-600: #4cb1e5;
  --auth-brand-500: #6bc8ee;
  --auth-brand-50: #eef9fd;
  --auth-brand-100: #dcf4fc;
  --auth-brand-200: #b8eaf7;
  --auth-surface: #ffffff;
  --auth-ring: rgba(76, 177, 229, 0.4);
  --auth-control-border: #d2d2d7;
  --auth-control-hover-border: rgba(11, 18, 32, 0.14);
  --auth-control-inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --auth-glass: rgba(255, 255, 255, 0.88);
  --auth-glass-border: rgba(255, 255, 255, 0.65);
  --auth-glass-shadow: 0 12px 40px rgba(11, 18, 32, 0.1);
  --auth-input-border: var(--auth-control-border);
  --auth-input-bg: #ffffff;
  --auth-card-max: min(calc(100vw - 2rem), 36rem);
  --auth-radius-shell: 24px;
  --auth-radius-field: 12px;
  --auth-font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --auth-ease: cubic-bezier(0.2, 0, 0, 1);
  --auth-motion-fast: 120ms;
  --auth-transition: border-color var(--auth-motion-fast) var(--auth-ease),
    background-color var(--auth-motion-fast) var(--auth-ease),
    color var(--auth-motion-fast) var(--auth-ease),
    box-shadow var(--auth-motion-fast) var(--auth-ease),
    opacity var(--auth-motion-fast) var(--auth-ease),
    transform var(--auth-motion-fast) var(--auth-ease);
}

/* 全页浅色：即使 html 带 pf-v5-theme-dark（Realm 暗色），登录页仍用浅色方案以免对比崩溃 */
html.login-pf,
html.login-pf.pf-v5-theme-dark {
  color-scheme: light;
  font-family: var(--auth-font-stack);
}

html.login-pf.pf-v5-theme-dark body,
html.login-pf body,
body#keycloak-bg {
  background-color: var(--auth-background) !important;
  background-image: linear-gradient(
    180deg,
    var(--auth-brand-50) 0%,
    var(--auth-brand-100) 38%,
    var(--auth-background-mid) 100%
  ) !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  background-attachment: fixed !important;
  color: var(--auth-foreground);
  min-height: 100vh;
}

/* 外层：整页水平居中，避免与父主题 34rem 栅格列宽打架后出现 realm 名「漂到卡片右侧」 */
.pf-v5-c-login {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: safe center !important;
  min-height: 100dvh;
  width: 100%;
  padding: 1rem;
  box-sizing: border-box;
}

/* 单块毛玻璃容器：与父主题 grid-template-columns:34rem 解耦；宽度用 --auth-card-max 对齐 Next 样稿左栏 */
.pf-v5-c-login__container {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-areas:
    "header"
    "main" !important;
  width: 100%;
  max-width: var(--auth-card-max);
  margin: clamp(1.5rem, 5vh, 3rem) auto;
  padding: 2rem 2rem 1.75rem;
  border-radius: var(--auth-radius-shell);
  background: var(--auth-glass);
  border: 1px solid var(--auth-glass-border);
  box-shadow: var(--auth-glass-shadow), 0 1px 0 rgba(255, 255, 255, 0.65) inset;
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  box-sizing: border-box;
}

/* realm 标题行占满容器宽度，避免栅格把文案挤到视口一侧 */
#kc-header.pf-v5-c-login__header {
  grid-area: header;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* 主区不再叠第二层深色底；占满容器主列以便与标题、按钮同宽 */
.pf-v5-c-login__main {
  grid-area: main;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: transparent !important;
  box-shadow: none !important;
}

.pf-v5-c-login__main-header {
  color: var(--auth-foreground);
}

/*
 * 父主题 keycloak.v2 在 ≥768px 将主标题行设为 70% / 30% 两列，语言选择在右列，
 * 导致「Sign in…」只在左 70% 内居中，与下方全宽表单、主按钮视觉错位。
 * 改为单列：标题与表单同一中线。
 */
@media (min-width: 768px) {
  div.pf-v5-c-login__main-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    grid-template-columns: none !important;
    gap: 0.75rem;
  }

  .pf-v5-c-login__main-header-utilities {
    align-self: center;
    max-width: 16rem;
    width: 100%;
  }
}

/* Realm 显示名：小号说明感，与 macOS 子标题类似（覆盖父主题浅色大字 + !important） */
#kc-header {
  text-align: center;
  margin-bottom: 0.35rem;
}

#kc-header-wrapper,
#kc-header-wrapper.pf-v5-c-brand {
  font-size: 0 !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
  line-height: 1.35 !important;
  color: var(--auth-muted) !important;
  white-space: normal !important;
}

#kc-header-wrapper > #kc-brand-logo,
#kc-brand-logo {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 40% !important;
  margin: 0 auto !important;
  object-fit: contain !important;
}

/* 页标题：高对比深色 */
/* 页标题与 CMS ``--display-heading`` / ``--foreground`` 一致，不用品牌深蓝 */
#kc-page-title,
.pf-v5-c-login__main-header .pf-v5-c-title {
  color: var(--auth-foreground) !important;
  font-weight: 600 !important;
  letter-spacing: -0.025em !important;
  text-align: center;
}

#kc-content-wrapper .pf-v5-c-login__main-header .pf-v5-c-helper-text,
#kc-content-wrapper .instruction,
#kc-registration .form-group + .form-group p,
#kc-info-wrapper {
  color: var(--auth-muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.pf-v5-c-form__label,
.pf-v5-c-form__label-text {
  color: rgba(11, 18, 32, 0.9) !important;
  font-weight: 500;
  font-size: 0.875rem;
}

/* 表单内辅助链接：默认无下划线，悬停再下划线（对齐 Next 主链路与 ``hover:underline`` 用法） */
#kc-form-wrapper a,
#kc-register-form a,
.pf-v5-c-helper-text a,
.pf-v5-c-form__helper-text a {
  text-decoration: none !important;
}

#kc-form-wrapper a:hover,
#kc-register-form a:hover,
.pf-v5-c-helper-text a:hover,
.pf-v5-c-form__helper-text a:hover {
  text-decoration: underline !important;
}

/*
 * PatternFly：span.pf-v5-c-form-control 包裹 input，默认带伪元素底边线与灰底。
 * 对齐 Next ``rounded-xl border border-black/15 bg-white … outline-none focus:border-brand-500``：
 * 纯白底、单层边框、无额外下划线、聚焦仅改边框色（无粗 outline）。
 */
span.pf-v5-c-form-control {
  box-shadow: var(--auth-control-inner-highlight);
  /* 关闭 PF 在控件底部画的「第二条线」 */
  --pf-v5-c-form-control--before--BorderBlockEndWidth: 0 !important;
  --pf-v5-c-form-control--before--BorderBlockStartWidth: 0 !important;
  --pf-v5-c-form-control--before--BorderInlineStartWidth: 0 !important;
  --pf-v5-c-form-control--before--BorderInlineEndWidth: 0 !important;
  --pf-v5-c-form-control--after--BorderBlockEndWidth: 0 !important;
  --pf-v5-c-form-control--after--BorderBlockStartWidth: 0 !important;
  --pf-v5-c-form-control--after--BorderInlineStartWidth: 0 !important;
  --pf-v5-c-form-control--after--BorderInlineEndWidth: 0 !important;

  display: flex !important;
  align-items: center;
  border-radius: var(--auth-radius-field) !important;
  border: 1px solid var(--auth-input-border) !important;
  background-color: var(--auth-input-bg) !important;
  background-image: none !important;
  box-shadow: none !important;
  min-height: 2.75rem;
  padding-inline: 1rem;
  padding-block: 0;
  transition: var(--auth-transition);
}

/* 双伪元素若仍被主题插入，直接不参与布局，避免底边「假下划线」 */
span.pf-v5-c-form-control::before,
span.pf-v5-c-form-control::after {
  display: none !important;
  content: none !important;
}

span.pf-v5-c-form-control .pf-v5-c-form-control__utilities,
span.pf-v5-c-form-control .pf-v5-c-form-control__icon {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

span.pf-v5-c-form-control input {
  flex: 1;
  min-width: 0;
  border: none !important;
  border-bottom: none !important;
  outline: none !important;
  box-shadow: none !important;
  background-color: var(--auth-input-bg) !important;
  background-image: none !important;
  color: var(--auth-foreground) !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  padding-block: 0.75rem !important;
  padding-inline: 0 !important;
  text-decoration: none !important;
  transition: var(--auth-transition);
}

span.pf-v5-c-form-control input:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Chrome 自动填充：保持白底，避免灰蓝块 */
span.pf-v5-c-form-control input:-webkit-autofill,
span.pf-v5-c-form-control input:-webkit-autofill:hover,
span.pf-v5-c-form-control input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--auth-foreground) !important;
  caret-color: var(--auth-foreground);
  transition: background-color 9999s ease-out;
  box-shadow: 0 0 0 1000px var(--auth-input-bg) inset !important;
}

span.pf-v5-c-form-control:hover:not(.pf-m-error) {
  border-color: var(--auth-control-hover-border) !important;
}

span.pf-v5-c-form-control:focus-within {
  border-color: var(--auth-brand-600) !important;
  outline: none !important;
  box-shadow: var(--auth-control-inner-highlight), 0 0 0 3px var(--auth-ring) !important;
}

span.pf-v5-c-form-control.pf-m-error {
  border-color: rgba(200, 50, 50, 0.55) !important;
  background-color: var(--auth-input-bg) !important;
}

/*
 * 注册页 User Profile 的 select（如 Country）：
 * KC 用 div.pf-v5-c-form-control 包裹 select，与 span+input 路径不同，须单独对齐白底圆角输入框。
 */
#kc-register-form div.pf-v5-c-form-control:has(select) {
  position: relative;
  box-shadow: var(--auth-control-inner-highlight);
  --pf-v5-c-form-control--before--BorderBlockEndWidth: 0 !important;
  --pf-v5-c-form-control--before--BorderBlockStartWidth: 0 !important;
  --pf-v5-c-form-control--before--BorderInlineStartWidth: 0 !important;
  --pf-v5-c-form-control--before--BorderInlineEndWidth: 0 !important;
  --pf-v5-c-form-control--after--BorderBlockEndWidth: 0 !important;
  --pf-v5-c-form-control--after--BorderBlockStartWidth: 0 !important;
  --pf-v5-c-form-control--after--BorderInlineStartWidth: 0 !important;
  --pf-v5-c-form-control--after--BorderInlineEndWidth: 0 !important;

  display: flex !important;
  align-items: center;
  border-radius: var(--auth-radius-field) !important;
  border: 1px solid var(--auth-input-border) !important;
  background-color: var(--auth-input-bg) !important;
  background-image: none !important;
  box-shadow: none !important;
  min-height: 2.75rem;
  padding-inline: 1rem;
  padding-block: 0;
  transition: var(--auth-transition);
}

#kc-register-form div.pf-v5-c-form-control:has(select)::before,
#kc-register-form div.pf-v5-c-form-control:has(select)::after {
  display: none !important;
  content: none !important;
}

#kc-register-form div.pf-v5-c-form-control select {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background-color: transparent !important;
  background-image: none !important;
  color: var(--auth-foreground) !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  padding-block: 0.75rem !important;
  padding-inline: 0 2rem !important;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

#kc-register-form div.pf-v5-c-form-control select:focus {
  outline: none !important;
  box-shadow: none !important;
}

#kc-register-form div.pf-v5-c-form-control:has(select):hover:not(.pf-m-error) {
  border-color: var(--auth-control-hover-border) !important;
}

#kc-register-form div.pf-v5-c-form-control:has(select):focus-within {
  border-color: var(--auth-brand-600) !important;
  outline: none !important;
  box-shadow: var(--auth-control-inner-highlight), 0 0 0 3px var(--auth-ring) !important;
}

#kc-register-form div.pf-v5-c-form-control:has(select) .pf-v5-c-form-control__utilities {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--auth-muted);
}

#kc-register-form div.pf-v5-c-form-control:has(select) .pf-v5-c-form-control__toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/*
 * Country 可搜索 Listbox（auth-country-combobox.js）：对齐 Next ``CountryRegionCombobox`` / ``.enx-listbox-*``。
 */
.kc-country-combobox__native-wrap {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.kc-country-combobox {
  position: relative;
  width: 100%;
}

.kc-country-combobox__trigger {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--auth-foreground);
  background-color: var(--auth-input-bg);
  border: 1px solid var(--auth-input-border);
  border-radius: var(--auth-radius-field);
  box-shadow: var(--auth-control-inner-highlight);
  transition: var(--auth-transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1rem 1rem;
}

.kc-country-combobox__trigger::placeholder {
  color: var(--auth-muted);
  opacity: 1;
}

.kc-country-combobox__trigger:hover:not(:disabled) {
  border-color: var(--auth-control-hover-border);
}

.kc-country-combobox__trigger:focus {
  outline: none;
  border-color: var(--auth-brand-600);
  box-shadow: var(--auth-control-inner-highlight), 0 0 0 3px var(--auth-ring);
}

.kc-country-combobox--open .kc-country-combobox__trigger {
  border-color: var(--auth-brand-600);
  box-shadow: var(--auth-control-inner-highlight), 0 0 0 3px var(--auth-ring);
}

.kc-country-combobox__panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  max-height: 15rem;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  display: none;
  border: 1px solid var(--auth-input-border);
  border-radius: 0.75rem;
  background-color: var(--auth-input-bg);
  box-shadow:
    0 4px 24px rgba(11, 18, 32, 0.08),
    0 1px 2px rgba(11, 18, 32, 0.06);
}

.kc-country-combobox__panel.kc-country-combobox__panel--open {
  display: block;
}

.kc-country-combobox__panel > li:first-child > .kc-country-combobox__option {
  border-top-left-radius: calc(0.75rem - 1px);
  border-top-right-radius: calc(0.75rem - 1px);
}

.kc-country-combobox__panel > li:last-child > .kc-country-combobox__option {
  border-bottom-left-radius: calc(0.75rem - 1px);
  border-bottom-right-radius: calc(0.75rem - 1px);
}

.kc-country-combobox__option {
  display: flex;
  width: 100%;
  align-items: center;
  padding: 0.625rem 1rem;
  border: 0;
  margin: 0;
  background-color: transparent;
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--auth-foreground);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--auth-motion-fast) var(--auth-ease);
}

.kc-country-combobox__option:hover:not(:disabled) {
  background-color: rgba(11, 18, 32, 0.04);
}

.kc-country-combobox__option--active {
  background-color: var(--auth-brand-50);
}

.kc-country-combobox__option--active:hover:not(:disabled) {
  background-color: var(--auth-brand-50);
}

.kc-country-combobox__option--selected {
  font-weight: 600;
  color: var(--auth-brand-800);
}

.kc-country-combobox__option--selected.kc-country-combobox__option--active,
.kc-country-combobox__option--selected:hover:not(:disabled) {
  background-color: var(--auth-brand-100);
}

.kc-country-combobox__option:focus-visible {
  outline: 2px solid var(--auth-ring);
  outline-offset: -2px;
}

.kc-country-combobox__empty {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--auth-muted);
}

/*
 * 密码框 + 显示密码：整段共用一条外边框（与 Next 单框观感一致），
 * 去掉输入与按钮之间的竖线及 PF 在 control 按钮上画的深色边。
 */
.pf-v5-c-input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
  gap: 0;
  border: 1px solid var(--auth-input-border);
  border-radius: var(--auth-radius-field);
  background-color: var(--auth-input-bg);
  box-sizing: border-box;
  overflow: hidden;
  transition: var(--auth-transition);
}

.pf-v5-c-input-group:hover:not(:has(.pf-m-error)) {
  border-color: var(--auth-control-hover-border);
}

.pf-v5-c-input-group:focus-within {
  border-color: var(--auth-brand-600);
  outline: none;
  box-shadow: var(--auth-control-inner-highlight), 0 0 0 3px var(--auth-ring);
}

.pf-v5-c-input-group > .pf-v5-c-input-group__item.pf-m-fill span.pf-v5-c-form-control {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.pf-v5-c-input-group > .pf-v5-c-input-group__item.pf-m-fill span.pf-v5-c-form-control:focus-within {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.pf-v5-c-input-group > .pf-v5-c-input-group__item:not(.pf-m-fill) {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.pf-v5-c-input-group > .pf-v5-c-input-group__item:not(.pf-m-fill) .pf-v5-c-button {
  --pf-v5-c-button--BorderWidth: 0 !important;

  height: 100%;
  min-height: 2.75rem;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--auth-muted) !important;
  text-decoration: none !important;
}

.pf-v5-c-input-group > .pf-v5-c-input-group__item:not(.pf-m-fill) .pf-v5-c-button::before,
.pf-v5-c-input-group > .pf-v5-c-input-group__item:not(.pf-m-fill) .pf-v5-c-button::after {
  display: none !important;
  content: none !important;
}

.pf-v5-c-input-group > .pf-v5-c-input-group__item:not(.pf-m-fill) .pf-v5-c-button:hover {
  background: rgba(0, 0, 0, 0.05) !important;
  color: var(--auth-foreground) !important;
}

/* 注册等页面上直接带控件类的 textarea（少见） */
textarea.pf-v5-c-form-control {
  border-radius: var(--auth-radius-field);
  border: 1px solid var(--auth-input-border);
  background-color: var(--auth-input-bg) !important;
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding-block: 0.75rem;
  padding-inline: 1rem;
  outline: none;
  box-shadow: none;
}

textarea.pf-v5-c-form-control:focus {
  border-color: var(--auth-brand-600);
  outline: none;
}

/* 主按钮：与表单同宽；修复 PF 在 form__actions 内 flex 导致的左偏/未拉满 */
#kc-form-login .pf-v5-c-form__actions,
#kc-register-form .pf-v5-c-form__actions,
#kc-reset-password-form .pf-v5-c-form__actions,
#kc-passwd-update-form .pf-v5-c-form__actions,
#kc-logout-confirm-form .pf-v5-c-form__actions {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
  gap: 0.5rem;
}

#kc-form-login .pf-v5-c-form__group:has(#kc-login),
#kc-register-form .pf-v5-c-form__group:has(#kc-register),
#kc-reset-password-form .pf-v5-c-form__group:has(#kc-form-buttons),
#kc-passwd-update-form .pf-v5-c-form__group:has(#kc-form-buttons),
#kc-logout-confirm-form .pf-v5-c-form__group:has(#kc-logout) {
  width: 100% !important;
  max-width: 100% !important;
}

/* 主按钮：对齐 Next ``/auth/login`` 与 ``supportPrimaryButtonClass``（rounded-xl、hover 变浅、focus ring） */
.pf-v5-c-button.pf-m-primary,
#kc-login,
#kc-register,
#kc-form-buttons,
#kc-logout,
#kc-register-form #kc-register,
input.pf-v5-c-button.pf-m-primary {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  margin-top: 0.25rem;
  box-sizing: border-box;
  border-radius: var(--auth-radius-field) !important;
  border: 1px solid var(--auth-brand-600) !important;
  background: var(--auth-brand-600) !important;
  color: #fff !important;
  font-weight: 600;
  font-size: 0.9375rem;
  min-height: 2.75rem;
  box-shadow: 0 1px 2px rgba(11, 18, 32, 0.06);
  transition: var(--auth-transition);
  cursor: pointer;
}

.pf-v5-c-button.pf-m-primary:disabled,
#kc-login:disabled,
#kc-register:disabled,
#kc-form-buttons:disabled,
#kc-logout:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--auth-brand-600) !important;
  transform: none !important;
}

.pf-v5-c-button.pf-m-primary:hover:not(:disabled),
#kc-login:hover:not(:disabled),
#kc-register:hover:not(:disabled),
#kc-form-buttons:hover:not(:disabled),
#kc-logout:hover:not(:disabled),
#kc-register-form #kc-register:hover:not(:disabled),
input.pf-v5-c-button.pf-m-primary:hover:not(:disabled) {
  background: var(--auth-brand-500) !important;
  border-color: var(--auth-brand-500) !important;
  box-shadow: 0 4px 14px rgba(76, 177, 229, 0.28);
}

.pf-v5-c-button.pf-m-primary:active:not(:disabled),
#kc-login:active:not(:disabled),
#kc-register:active:not(:disabled),
#kc-form-buttons:active:not(:disabled),
#kc-logout:active:not(:disabled),
#kc-register-form #kc-register:active:not(:disabled),
input.pf-v5-c-button.pf-m-primary:active:not(:disabled) {
  transform: scale(0.985);
  background: var(--auth-brand-600) !important;
  border-color: var(--auth-brand-600) !important;
  box-shadow: 0 1px 2px rgba(11, 18, 32, 0.08);
}

.pf-v5-c-button.pf-m-primary:focus-visible,
#kc-login:focus-visible,
#kc-register:focus-visible,
#kc-form-buttons:focus-visible,
#kc-logout:focus-visible,
#kc-register-form #kc-register:focus-visible,
input.pf-v5-c-button.pf-m-primary:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 2px var(--auth-surface), 0 0 0 4px var(--auth-brand-500) !important;
}

@media (prefers-reduced-motion: reduce) {
  .pf-v5-c-button.pf-m-primary,
  #kc-login,
  #kc-register,
  #kc-form-buttons,
  #kc-logout,
  #kc-register-form #kc-register,
  input.pf-v5-c-button.pf-m-primary {
    transition: opacity var(--auth-motion-fast) var(--auth-ease),
      background-color var(--auth-motion-fast) var(--auth-ease),
      border-color var(--auth-motion-fast) var(--auth-ease);
  }

  .pf-v5-c-button.pf-m-primary:active:not(:disabled),
  #kc-login:active:not(:disabled),
  #kc-register:active:not(:disabled),
  #kc-form-buttons:active:not(:disabled),
  #kc-logout:active:not(:disabled),
  #kc-register-form #kc-register:active:not(:disabled),
  input.pf-v5-c-button.pf-m-primary:active:not(:disabled) {
    transform: none;
  }
}

/* 主按钮常态无边线下划线（PF link 变体可能带 decoration） */
#kc-login,
#kc-register,
#kc-form-buttons,
#kc-logout,
#kc-register-form #kc-register {
  text-decoration: none !important;
}

.pf-v5-c-button.pf-m-secondary,
#try-another-way.pf-v5-c-button,
#kc-back.pf-v5-c-button,
#kc-logout-back,
#kc-reset-password-form a.pf-m-secondary.pf-m-block,
#kc-reset-password-form #kc-back {
  width: 100% !important;
  max-width: 100% !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 2.75rem;
  margin-top: 0.25rem;
  margin-left: 0 !important;
  margin-right: 0 !important;
  text-align: center;
  border-radius: var(--auth-radius-field) !important;
  border: 1px solid var(--auth-input-border) !important;
  background: var(--auth-input-bg) !important;
  color: var(--auth-brand-600) !important;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none !important;
  box-shadow: 0 1px 2px rgba(11, 18, 32, 0.04);
  transition: var(--auth-transition);
  cursor: pointer;
}

.pf-v5-c-button.pf-m-secondary:hover,
#try-another-way.pf-v5-c-button:hover,
#kc-logout-back:hover,
#kc-reset-password-form #kc-back:hover {
  background: var(--auth-brand-50) !important;
  border-color: var(--auth-brand-500) !important;
  color: var(--auth-brand-800) !important;
  box-shadow: 0 4px 14px rgba(76, 177, 229, 0.12);
}

.pf-v5-c-button.pf-m-secondary:active:not(:disabled),
#try-another-way.pf-v5-c-button:active,
#kc-logout-back:active,
#kc-reset-password-form #kc-back:active {
  transform: scale(0.985);
  background: var(--auth-input-bg) !important;
  border-color: var(--auth-brand-600) !important;
  box-shadow: 0 1px 2px rgba(11, 18, 32, 0.08);
}

.pf-v5-c-button.pf-m-secondary:focus-visible,
#try-another-way.pf-v5-c-button:focus-visible,
#kc-logout-back:focus-visible,
#kc-reset-password-form #kc-back:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 2px var(--auth-surface), 0 0 0 4px var(--auth-brand-500) !important;
}

@media (prefers-reduced-motion: reduce) {
  .pf-v5-c-button.pf-m-secondary,
  #kc-logout-back,
  #try-another-way.pf-v5-c-button,
  #kc-reset-password-form #kc-back {
    transition: opacity var(--auth-motion-fast) var(--auth-ease),
      background-color var(--auth-motion-fast) var(--auth-ease),
      border-color var(--auth-motion-fast) var(--auth-ease);
  }

  .pf-v5-c-button.pf-m-secondary:active:not(:disabled),
  #kc-logout-back:active,
  #try-another-way.pf-v5-c-button:active,
  #kc-reset-password-form #kc-back:active {
    transform: none;
  }
}

#kc-content-wrapper a:not(.pf-v5-c-button):not(.pf-c-button),
.login-pf-page .login-pf-signup a,
#kc-registration a {
  color: var(--auth-brand-600);
  font-weight: 500;
  text-decoration: none;
}

#kc-content-wrapper a:not(.pf-v5-c-button):not(.pf-c-button):hover,
.login-pf-page .login-pf-signup a:hover,
#kc-registration a:hover {
  color: var(--auth-brand-500);
  text-decoration: underline;
}

.pf-v5-c-alert,
.pf-c-alert {
  border-radius: var(--auth-radius-field);
  font-size: 0.875rem;
}

.pf-v5-c-alert.pf-m-danger,
.pf-v5-c-alert.pf-m-inline.pf-m-danger,
.pf-c-alert.pf-m-danger {
  border-color: rgba(200, 50, 50, 0.35);
  background: rgba(255, 230, 230, 0.85);
  color: #5c1010;
}

.pf-v5-c-alert.pf-m-success,
.pf-v5-c-alert.pf-m-inline.pf-m-success,
.pf-c-alert.pf-m-success {
  border-color: rgba(40, 140, 80, 0.35);
  background: rgba(230, 245, 235, 0.85);
  color: #0d3d1f;
}

/*
 * 提示条（warning/info）：对齐 CMS 浅色信息条，覆盖 PF 暗底黄字。
 * 用于「Choose a new password」等必填改密说明。
 */
.pf-v5-c-login__main-body .pf-v5-c-alert,
.pf-v5-c-login__main-body .pf-c-alert {
  margin: 0 0 1.25rem !important;
  padding: 0.85rem 1rem !important;
  border-radius: var(--auth-radius-field) !important;
  box-shadow: var(--auth-control-inner-highlight) !important;
}

/* warning/info：文案居中（与忘记密码页说明块一致） */
.pf-v5-c-login__main-body .pf-v5-c-alert.pf-m-warning,
.pf-v5-c-login__main-body .pf-v5-c-alert.pf-m-info,
.pf-v5-c-login__main-body .pf-c-alert.pf-m-warning,
.pf-v5-c-login__main-body .pf-c-alert.pf-m-info {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  gap: 0 !important;
}

.pf-v5-c-login__main-body .pf-v5-c-alert.pf-m-danger,
.pf-v5-c-login__main-body .pf-v5-c-alert.pf-m-success,
.pf-v5-c-login__main-body .pf-c-alert.pf-m-danger,
.pf-v5-c-login__main-body .pf-c-alert.pf-m-success {
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.65rem;
}

.pf-v5-c-login__main-body .pf-v5-c-alert .pf-v5-c-alert__icon,
.pf-v5-c-login__main-body .pf-v5-c-alert .kc-feedback-text,
.pf-v5-c-login__main-body .pf-c-alert .kc-feedback-text {
  margin: 0 !important;
  padding: 0 !important;
}

.pf-v5-c-alert.pf-m-warning .pf-v5-c-alert__icon,
.pf-v5-c-alert.pf-m-info .pf-v5-c-alert__icon {
  display: none !important;
}

.pf-v5-c-alert.pf-m-warning,
.pf-v5-c-alert.pf-m-inline.pf-m-warning,
.pf-c-alert.pf-m-warning,
.pf-v5-c-alert.pf-m-info,
.pf-v5-c-alert.pf-m-inline.pf-m-info,
.pf-c-alert.pf-m-info {
  background: var(--auth-brand-50) !important;
  border: 1px solid var(--auth-brand-200) !important;
  color: var(--auth-foreground) !important;
}

.pf-v5-c-alert.pf-m-warning .kc-feedback-text,
.pf-v5-c-alert.pf-m-info .kc-feedback-text,
.pf-v5-c-alert.pf-m-warning .pf-v5-c-alert__title,
.pf-v5-c-alert.pf-m-info .pf-v5-c-alert__title {
  display: block !important;
  width: 100% !important;
  text-align: center !important;
  color: var(--auth-foreground) !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  line-height: 1.55 !important;
}

.pf-v5-c-alert.pf-m-warning::before,
.pf-v5-c-alert.pf-m-info::before,
.pf-v5-c-alert.pf-m-warning::after,
.pf-v5-c-alert.pf-m-info::after {
  display: none !important;
  content: none !important;
}

.kc-legal-link {
  color: var(--auth-brand-600);
  text-decoration: none;
  font-weight: 500;
}

.kc-legal-link:hover {
  text-decoration: underline;
}

.kc-legal-link:focus-visible {
  outline: 2px solid var(--auth-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/*
 * 复选框：对齐 Next ``.enx-checkbox``（品牌天蓝选中态，去除系统紫色 accent）。
 */
.kc-auth-check-row {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.55rem;
  margin: 0.75rem 0 0.25rem;
  padding: 0;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.kc-auth-check-row .kc-auth-check-label {
  display: block;
  color: var(--auth-muted) !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  line-height: 1.125rem !important;
  padding: 0 !important;
  margin: 0 !important;
}

.kc-auth-check,
.kc-auth-check.pf-v5-c-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.55rem;
  margin: 0.75rem 0 0.25rem;
  grid-template-columns: none !important;
}

/* login.ftl Remember me：label 包裹 input + span */
.kc-auth-check > label.pf-v5-c-check {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.55rem;
  margin: 0;
  cursor: pointer;
}

.kc-auth-check .pf-v5-c-check__label,
.kc-auth-check > label.pf-v5-c-check .pf-v5-c-check__label {
  color: var(--auth-muted) !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  line-height: 1.125rem !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer;
}

.kc-auth-checkbox,
#kc-passwd-update-form .pf-v5-c-check__input,
#kc-form-login .pf-v5-c-check__input,
#kc-register-form .pf-v5-c-check__input,
#kc-update-profile-form .pf-v5-c-check__input,
#kc-idp-review-profile-form .pf-v5-c-check__input {
  appearance: none !important;
  -webkit-appearance: none !important;
  box-sizing: border-box !important;
  flex-shrink: 0;
  width: 1.125rem !important;
  height: 1.125rem !important;
  min-width: 1.125rem !important;
  min-height: 1.125rem !important;
  margin: 0 !important;
  border: 1px solid var(--auth-control-border) !important;
  border-radius: 0.25rem !important;
  background-color: var(--auth-input-bg) !important;
  background-image: none !important;
  box-shadow: var(--auth-control-inner-highlight) !important;
  cursor: pointer;
  transition: var(--auth-transition);
}

.kc-auth-checkbox:hover:not(:disabled),
#kc-passwd-update-form .pf-v5-c-check__input:hover:not(:disabled),
#kc-form-login .pf-v5-c-check__input:hover:not(:disabled),
#kc-register-form .pf-v5-c-check__input:hover:not(:disabled),
#kc-update-profile-form .pf-v5-c-check__input:hover:not(:disabled),
#kc-idp-review-profile-form .pf-v5-c-check__input:hover:not(:disabled) {
  border-color: var(--auth-control-hover-border) !important;
  background-color: rgba(11, 18, 32, 0.045) !important;
}

.kc-auth-checkbox:checked,
#kc-passwd-update-form .pf-v5-c-check__input:checked,
#kc-form-login .pf-v5-c-check__input:checked,
#kc-register-form .pf-v5-c-check__input:checked,
#kc-update-profile-form .pf-v5-c-check__input:checked,
#kc-idp-review-profile-form .pf-v5-c-check__input:checked {
  border-color: var(--auth-brand-600) !important;
  background-color: var(--auth-brand-600) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6l2.5 2.5L9.5 3.5' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 0.625rem 0.625rem !important;
  box-shadow: none !important;
}

.kc-auth-checkbox:checked:hover:not(:disabled),
#kc-passwd-update-form .pf-v5-c-check__input:checked:hover:not(:disabled),
#kc-form-login .pf-v5-c-check__input:checked:hover:not(:disabled),
#kc-register-form .pf-v5-c-check__input:checked:hover:not(:disabled),
#kc-update-profile-form .pf-v5-c-check__input:checked:hover:not(:disabled),
#kc-idp-review-profile-form .pf-v5-c-check__input:checked:hover:not(:disabled) {
  border-color: var(--auth-brand-500) !important;
  background-color: var(--auth-brand-500) !important;
}

.kc-auth-checkbox:focus-visible,
#kc-passwd-update-form .pf-v5-c-check__input:focus-visible,
#kc-form-login .pf-v5-c-check__input:focus-visible,
#kc-register-form .pf-v5-c-check__input:focus-visible,
#kc-update-profile-form .pf-v5-c-check__input:focus-visible,
#kc-idp-review-profile-form .pf-v5-c-check__input:focus-visible {
  outline: 2px solid var(--auth-ring) !important;
  outline-offset: 2px !important;
}

#kc-passwd-update-form .kc-auth-form-options {
  margin-bottom: 0.35rem;
}

#kc-form-options .kc-auth-check-row .kc-auth-checkbox {
  flex: 0 0 auto;
  align-self: center;
  vertical-align: middle;
}

.login-pf-signup,
#kc-registration-container,
#kc-info,
#kc-info-wrapper {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--auth-muted);
  text-align: center;
  line-height: 1.55;
}

.pf-v5-c-login__main-footer-band,
#kc-registration-container {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 0.85rem;
  margin-top: 1rem;
}

.pf-v5-c-check__label,
.pf-v5-c-check__description {
  font-size: 0.8125rem;
  color: var(--auth-muted);
}

.pf-v5-c-check__label a {
  color: var(--auth-brand-600);
  text-decoration: none !important;
}

.pf-v5-c-check__label a:hover {
  text-decoration: underline !important;
}

/* 注册页条款勾选：横向排列 checkbox + 带链接文案 */
#kc-register-form .pf-v5-c-check,
#kc-update-profile-form .pf-v5-c-check,
#kc-idp-review-profile-form .pf-v5-c-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

#kc-register-form .pf-v5-c-check__label,
#kc-register-form .pf-v5-c-check__label a.kc-legal-link,
#kc-update-profile-form .pf-v5-c-check__label,
#kc-update-profile-form .pf-v5-c-check__label a.kc-legal-link,
#kc-idp-review-profile-form .pf-v5-c-check__label,
#kc-idp-review-profile-form .pf-v5-c-check__label a.kc-legal-link {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--auth-muted);
}

#kc-register-form .pf-v5-c-check__label a.kc-legal-link,
#kc-update-profile-form .pf-v5-c-check__label a.kc-legal-link,
#kc-idp-review-profile-form .pf-v5-c-check__label a.kc-legal-link {
  color: var(--auth-brand-600);
  cursor: pointer;
}

#kc-register-form .pf-v5-c-check__label a.kc-legal-link:hover,
#kc-update-profile-form .pf-v5-c-check__label a.kc-legal-link:hover,
#kc-idp-review-profile-form .pf-v5-c-check__label a.kc-legal-link:hover {
  text-decoration: underline !important;
}

#kc-social-providers .pf-v5-c-button {
  border-radius: var(--auth-radius-field);
}

/* 语言选择等控件在浅色玻璃上可读 */
.pf-v5-c-login__main-header-utilities span.pf-v5-c-form-control,
.pf-v5-c-login__main-header-utilities select {
  color: var(--auth-foreground);
}

.pf-v5-c-login__main-header-utilities select {
  border: 1px solid var(--auth-input-border) !important;
  border-radius: var(--auth-radius-field) !important;
  background-color: var(--auth-input-bg) !important;
  font-size: 0.875rem !important;
  padding: 0.5rem 2rem 0.5rem 0.75rem !important;
  text-decoration: none !important;
  appearance: none;
  outline: none;
}

.pf-v5-c-login__main-header-utilities select:focus {
  border-color: var(--auth-brand-600) !important;
  outline: none !important;
}

/*
 * 忘记密码流：说明上移、步骤条、主按钮文案、返回链改为文字链（避免双全宽按钮堆叠）。
 * 与 Next ``/auth/login`` 样稿的信息层级对齐。
 */
.kc-reset-password-flow {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
}

.kc-reset-eyebrow {
  margin: 0 0 0.35rem;
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--auth-brand-600);
}

.kc-reset-hero {
  display: flex;
  justify-content: center;
  margin: 0.15rem 0 0.65rem;
}

.kc-reset-hero__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  background: linear-gradient(145deg, rgba(76, 177, 229, 0.2), rgba(76, 177, 229, 0.06));
  border: 1px solid rgba(76, 177, 229, 0.28);
  color: var(--auth-brand-600);
  box-shadow: var(--auth-control-inner-highlight);
  transition: var(--auth-transition);
}

.kc-reset-hero__icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.kc-reset-lead {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--auth-muted);
}

.kc-reset-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 1.35rem;
  padding: 0.75rem 0.65rem;
  list-style: none;
  border-radius: var(--auth-radius-field);
  background: var(--auth-brand-50);
  border: 1px solid var(--auth-brand-200);
}

.kc-reset-steps__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
  min-width: 0;
}

.kc-reset-steps__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  color: var(--auth-muted);
  background: rgba(11, 18, 32, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: var(--auth-transition);
}

.kc-reset-steps__item--active .kc-reset-steps__badge {
  color: #fff;
  background: var(--auth-brand-600);
  border-color: var(--auth-brand-600);
  box-shadow: 0 2px 10px rgba(76, 177, 229, 0.35);
}

.kc-reset-steps__text {
  font-size: 0.6875rem;
  line-height: 1.35;
  font-weight: 500;
  color: var(--auth-muted);
}

.kc-reset-steps__item--active .kc-reset-steps__text {
  color: var(--auth-foreground);
  font-weight: 600;
}

#kc-reset-password-form.kc-reset-password-form {
  margin-top: 0;
}

#kc-reset-password-form .pf-v5-c-form__group:first-of-type {
  margin-top: 0;
}

.kc-reset-back-wrap {
  margin: 1rem 0 0;
  text-align: center;
}

.kc-reset-back-wrap #kc-back {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: auto !important;
  max-width: none !important;
  min-height: auto !important;
  margin: 0 !important;
  padding: 0.25rem 0.5rem;
  border: none !important;
  background: transparent !important;
  color: var(--auth-brand-600) !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  border-radius: 0.375rem !important;
  transition: var(--auth-transition);
}

.kc-reset-back-wrap #kc-back::before {
  content: "←";
  font-size: 0.9375rem;
  line-height: 1;
  opacity: 0.85;
}

.kc-reset-back-wrap #kc-back:hover {
  color: var(--auth-brand-800) !important;
  background: var(--auth-brand-50) !important;
  text-decoration: underline !important;
}

.kc-reset-back-wrap #kc-back:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 2px var(--auth-surface), 0 0 0 4px var(--auth-brand-500) !important;
}

.kc-reset-security-note {
  margin: 1.15rem 0 0;
  padding: 0.75rem 0.85rem;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--auth-muted);
  border-radius: var(--auth-radius-field);
  background: var(--auth-brand-50);
  border: 1px solid var(--auth-brand-200);
}

/* 忘记密码页：页标题下留白略减（说明已上移到 flow 内） */
.kc-reset-password-flow ~ * #kc-page-title,
.pf-v5-c-login__main-body:has(.kc-reset-password-flow) #kc-page-title {
  margin-bottom: 0.15rem;
}

@media (max-width: 420px) {
  .kc-reset-steps {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    text-align: left;
  }

  .kc-reset-steps__item {
    flex-direction: row;
    align-items: center;
    text-align: left;
  }

  .kc-reset-steps__text {
    font-size: 0.75rem;
  }
}

/* 登出确认：主按钮 + 次级返回，与忘记密码页操作区对齐 */
.kc-logout-confirm-flow {
  margin-top: 0;
}

.kc-logout-lead {
  margin: 0 0 1.25rem;
  text-align: center;
  color: var(--auth-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

#kc-logout-confirm-form.kc-logout-confirm-form {
  margin-top: 0;
  width: 100% !important;
  max-width: 100% !important;
}

#kc-logout-confirm-form .pf-v5-c-form__group {
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
}

#kc-logout-confirm-form .pf-v5-c-form__actions {
  margin-top: 0;
}

#kc-logout-confirm-form .pf-v5-c-form__actions > #kc-logout,
#kc-logout-confirm-form .pf-v5-c-form__actions > #kc-logout-back {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin-inline: 0 !important;
  margin-top: 0 !important;
  flex: 0 0 auto;
  align-self: stretch;
}

/* Restart login：username 行内链（reset-credentials 页不展示独立 restart 区块） */
.kc-restart-login-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.375rem;
  color: var(--auth-brand-600) !important;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none !important;
  white-space: nowrap;
  transition: var(--auth-transition);
}

.kc-restart-login-link::before {
  content: "↻";
  font-size: 0.9375rem;
  line-height: 1;
  opacity: 0.9;
}

.kc-restart-login-link:hover {
  color: var(--auth-brand-800) !important;
  background: var(--auth-brand-50);
  text-decoration: underline !important;
}

.kc-restart-login-link:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 2px var(--auth-surface), 0 0 0 4px var(--auth-brand-500) !important;
}

.pf-v5-c-input-group .kc-restart-login-link {
  min-height: 2.75rem;
  padding-inline: 0.85rem;
}
