/* ==========================================================================
   Merlin login theme — self-contained stylesheet (no PatternFly, no CDN).
   Tokens mirror merlin-dashboard/src/app/globals.css and tailwind.config.js.
   ========================================================================== */

@font-face {
  font-family: 'Mozilla Text';
  src: url('../fonts/MozillaText-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Mozilla Text';
  src: url('../fonts/MozillaText-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('../fonts/Poppins-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  src: url('../fonts/Poppins-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand primitives */
  --primary: #370163;
  --primary-hover: #2a0049;
  --primary-soft: #F1EAF6;
  --accent-green: #31C9B6;
  --accent-green-dark: #13776C;
  --accent-light-purple: #A85EF5;

  /* Semantic tokens */
  --canvas: #F4F3F0;
  --surface: #FFFFFF;
  --surface-subtle: #F8F7F8;
  --border: #E3DFE6;
  --border-strong: #CEC7D2;
  --text: #211B27;
  --text-muted: #6F6675;
  --action: #370163;
  --action-hover: #2A0049;
  --focus: #6D2A9A;
  --positive: #13776C;
  --warning: #8A6508;
  --danger: #B42318;
  --on-action: #FFFFFF;
  --selection: #d7ccdf;

  /* Tailwind greys used by the dashboard login form */
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;

  --radius-control: 0.5rem;
  --radius-card: 1.5rem;
  --shadow-card: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);

  --font-body: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Mozilla Text', 'Poppins', system-ui, sans-serif;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background-color: var(--canvas);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2 {
  font-family: var(--font-heading);
}

::selection {
  background: var(--selection);
  color: var(--text);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Icons — CSS masks from inline SVG (lucide outlines). Colour = currentColor.
   passwordVisibility.js swaps the className of the toggle's first child, so
   each icon is a single class pair (icon icon--*).
   -------------------------------------------------------------------------- */
.icon {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  background-color: currentColor;
  -webkit-mask: var(--icon) no-repeat center / contain;
  mask: var(--icon) no-repeat center / contain;
  vertical-align: middle;
}
.icon--lg { width: 1.5rem; height: 1.5rem; }
.icon--eye { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z'/><circle cx='12' cy='12' r='3'/></svg>"); }
.icon--eye-off { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9.88 9.88a3 3 0 1 0 4.24 4.24'/><path d='M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68'/><path d='M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61'/><line x1='2' x2='22' y1='2' y2='22'/></svg>"); }
.icon--arrow-left { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m12 19-7-7 7-7'/><path d='M19 12H5'/></svg>"); }
.icon--chevron-right { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m9 18 6-6-6-6'/></svg>"); }
.icon--chevron-down { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); }
.icon--lock { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect width='18' height='11' x='3' y='11' rx='2' ry='2'/><path d='M7 11V7a5 5 0 0 1 10 0v4'/></svg>"); }
.icon--key { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='7.5' cy='15.5' r='5.5'/><path d='m21 2-9.6 9.6'/><path d='m15.5 7.5 3 3L22 7l-3-3'/></svg>"); }
.icon--smartphone { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect width='14' height='20' x='5' y='2' rx='2' ry='2'/><path d='M12 18h.01'/></svg>"); }
.icon--list { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><line x1='8' x2='21' y1='6' y2='6'/><line x1='8' x2='21' y1='12' y2='12'/><line x1='8' x2='21' y1='18' y2='18'/><line x1='3' x2='3.01' y1='6' y2='6'/><line x1='3' x2='3.01' y1='12' y2='12'/><line x1='3' x2='3.01' y1='18' y2='18'/></svg>"); }
.icon--alert { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><line x1='12' x2='12' y1='8' y2='12'/><line x1='12' x2='12.01' y1='16' y2='16'/></svg>"); }
.icon--warning { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>"); }
.icon--check-circle { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/><path d='m22 4-10 10.01-3-3'/></svg>"); }
.icon--info { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4'/><path d='M12 8h.01'/></svg>"); }
.icon--copy { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect width='14' height='14' x='8' y='8' rx='2' ry='2'/><path d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/></svg>"); }
.icon--check { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>"); }
.icon--refresh { --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8'/><path d='M21 3v5h-5'/><path d='M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16'/><path d='M8 16H3v5'/></svg>"); }

/* --------------------------------------------------------------------------
   Page shell: canvas, ambient blobs, centred card
   -------------------------------------------------------------------------- */
.page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem 1rem;
  overflow: hidden;
}
@media (min-width: 640px) { .page { padding: 2rem 1.5rem; } }
@media (min-width: 1024px) { .page { padding: 2.5rem; } }

.page__blob {
  position: absolute;
  width: 36rem;
  height: 36rem;
  border-radius: 9999px;
  filter: blur(64px);
  pointer-events: none;
}
.page__blob--left { left: -10rem; top: 0; background: rgba(168, 94, 245, 0.10); }
.page__blob--right { right: -10rem; bottom: 0; background: rgba(49, 201, 182, 0.10); }

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
@media (min-width: 1024px) {
  .card {
    display: grid;
    grid-template-columns: 42% 58%;
    max-width: 1160px;
    min-height: 620px;
  }
}

/* The wordmark is a single-colour PNG used as a mask over --primary, so it
   follows the scheme instead of vanishing as dark purple on a dark card. */
.wordmark {
  display: block;
  aspect-ratio: 680 / 163;
  background-color: var(--primary);
  -webkit-mask: url('../img/wordmark.png') no-repeat center / contain;
  mask: url('../img/wordmark.png') no-repeat center / contain;
}

/* --------------------------------------------------------------------------
   Brand panel (desktop only)
   -------------------------------------------------------------------------- */
.brand { display: none; }
@media (min-width: 1024px) {
  .brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 2.5rem;
    background: var(--canvas);
  }
}
@media (min-width: 1280px) { .brand { padding: 3rem; } }

.brand__blob {
  position: absolute;
  border-radius: 9999px;
  filter: blur(64px);
  pointer-events: none;
}
.brand__blob--purple { left: -6rem; top: -6rem; width: 20rem; height: 20rem; background: rgba(168, 94, 245, 0.10); animation: blob-drift 18s ease-in-out infinite; }
.brand__blob--teal { right: -4rem; bottom: -8rem; width: 24rem; height: 24rem; background: rgba(49, 201, 182, 0.10); animation: blob-drift 18s ease-in-out infinite; }
.brand__blob--soft { left: 25%; top: 33%; width: 16rem; height: 16rem; background: rgba(55, 1, 99, 0.05); }

.brand__dots {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: radial-gradient(circle, var(--primary) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent);
  mask-image: linear-gradient(to bottom, black, transparent);
  pointer-events: none;
}

.brand__top, .brand__mid, .brand__bottom { position: relative; z-index: 1; }
.brand__logo { width: 170px; }
.brand__mid { max-width: 28rem; }

.brand__headline {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--primary);
}
@media (min-width: 1280px) { .brand__headline { font-size: 3rem; } }

.brand__sub {
  margin: 1.25rem 0 0;
  font-size: 1.125rem;
  line-height: 1.625;
  color: var(--gray-700);
}

.brand__bottom { display: flex; flex-direction: column; gap: 1.25rem; }
.brand__stat { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.5rem; }
.brand__stat-num { font-family: var(--font-heading); font-size: 1.875rem; font-weight: 700; color: var(--primary); }
.brand__stat-text { font-size: 1rem; color: var(--gray-700); }

.badges { display: flex; flex-wrap: nowrap; align-items: center; gap: 1rem; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
  font-size: 0.875rem;
  color: var(--gray-500);
}
.badge__icon { width: 1rem; height: 1rem; flex: none; color: rgba(49, 201, 182, 0.8); }

/* --------------------------------------------------------------------------
   Form column
   -------------------------------------------------------------------------- */
.form-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.75rem;
}
@media (min-width: 640px) { .form-col { padding: 2.5rem; } }
@media (min-width: 1024px) { .form-col { padding: 3.5rem; } }

.form-inner { width: 100%; }
@media (min-width: 1024px) { .form-inner { max-width: 400px; } }

/* Compact brand header — small screens only */
.mobile-head {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}
@media (min-width: 1024px) { .mobile-head { display: none; } }
.mobile-head__logo { width: 150px; }

.fade-up { animation: fade-up 400ms ease-out both; }

.page-head { margin-bottom: 2rem; }
.page-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--gray-900);
  overflow-wrap: anywhere;
}
.page-sub { margin: 0.5rem 0 0; text-wrap: pretty; color: var(--gray-600); }
.required-hint { margin: -1rem 0 1.5rem; font-size: 0.875rem; color: var(--gray-500); }

/* Generic content typography inside the column.
   Wrapped in :where() so these defaults carry no specificity at all. Every
   paragraph modifier in this file (.page-sub, .required-hint, .info-action,
   .foot) is a single class and would otherwise lose to a ".content p"
   selector, which silently zeroed their margins. */
:where(.content) :where(p) { margin: 0 0 1rem; color: var(--gray-600); }
:where(.content) :where(p:last-child) { margin-bottom: 0; }
.content .instruction { color: var(--gray-700); }
.content a:not(.btn):not(.field__aside):not(.user-chip__reset):not(.lang__link):not(.foot__link) {
  color: var(--action);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  border-radius: 0.25rem;
}
.content a:not(.btn):hover { color: var(--action-hover); text-decoration: underline; }
.content b, .content strong { color: var(--gray-900); font-weight: 500; }
.content-block { margin-bottom: 1.5rem; color: var(--gray-700); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.form > .form-group:empty { display: none; }

.field { min-width: 0; }
.field__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.375rem;
}
.field__label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
}
.field__required { color: var(--danger); margin-left: 0.125rem; }
.field__aside {
  flex: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--action);
  text-decoration: none;
  border-radius: 0.25rem;
}
.field__aside:hover { color: var(--action-hover); text-decoration: underline; }
.field__aside:focus-visible { text-decoration: underline; }

/* The control. `.input` is placed directly on <input> by Merlin's macros; a
   few base templates put it on a wrapper element instead, hence both forms. */
input.input,
.input:not(input) > input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--surface);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-control);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  -webkit-appearance: none;
  appearance: none;
}
.input:not(input) { display: block; }
input.input::placeholder,
.input:not(input) > input::placeholder { color: var(--gray-400); }
input.input:focus,
.input:not(input) > input:focus {
  outline: none;
  border-color: var(--accent-green-dark);
  box-shadow: 0 0 0 3px rgba(49, 201, 182, 0.35);
}
input.input.is-readonly,
input.input[readonly] { background: var(--surface-subtle); color: var(--gray-600); }
.field--error input.input,
input.input.is-error { border-color: #fca5a5; }
.field--error input.input:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.18);
}
input.input.input--toggle { padding-right: 3rem; }

.input-wrap { position: relative; }
.input__toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  padding: 0 0.75rem;
  margin: 0;
  background: none;
  border: 0;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  color: var(--gray-400);
  cursor: pointer;
}
.input__toggle:hover { color: var(--gray-600); }
.input__toggle:focus-visible { color: var(--action); outline-offset: -3px; }
.input__toggle .icon { width: 1.25rem; height: 1.25rem; }

/* Error text under a field (also the container password-validation.ftl fills) */
.field__help { margin-top: 0.375rem; }
.field__help-item {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--gray-500);
}
.field__help-item.is-error { color: var(--danger); }
.field__help-item.is-error::before {
  content: '';
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.2rem;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><line x1='12' x2='12' y1='8' y2='12'/><line x1='12' x2='12.01' y1='16' y2='16'/></svg>") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><line x1='12' x2='12' y1='8' y2='12'/><line x1='12' x2='12.01' y1='16' y2='16'/></svg>") no-repeat center / contain;
}
ul.field__error-text { margin: 0; padding-left: 1.125rem; }
ul.field__error-text li + li { margin-top: 0.125rem; }
.field__extra { margin-top: 0.75rem; }

/* Checkbox */
.check { display: flex; align-items: center; gap: 0.5rem; }
.check__input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex: none;
  accent-color: var(--action);
  cursor: pointer;
}
.check__label {
  font-size: 0.875rem;
  color: var(--gray-700);
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  color: var(--gray-700);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, transform 100ms ease;
  -webkit-appearance: none;
  appearance: none;
}
.btn--block { display: flex; width: 100%; }
.btn--primary {
  color: var(--on-action);
  background: var(--action);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn--primary:hover { background: var(--action-hover); color: var(--on-action); }
.btn--primary:active { transform: scale(0.99); }
.btn--secondary {
  color: var(--gray-700);
  background: var(--surface);
  border-color: var(--gray-300);
}
.btn--secondary:hover { background: var(--surface-subtle); border-color: var(--gray-400); color: var(--gray-900); }
.btn--link {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-600);
  background: none;
}
.btn--link:hover { color: var(--gray-900); }
.btn--link:focus-visible { color: var(--action); }
.btn--link .icon { width: 1rem; height: 1rem; }
.btn:disabled,
.btn[aria-disabled="true"],
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.actions { display: flex; flex-direction: column; gap: 0.75rem; }
.actions--row { flex-direction: row; }
.actions--row > .btn,
.actions--row > form { flex: 1 1 0; min-width: 0; }
.actions--row > form > .btn { width: 100%; }
@media (max-width: 400px) { .actions--row { flex-direction: column; } }
.form-group--actions { margin-top: 0.5rem; }

.try-another { margin-top: 1rem; }
.alt-signin { margin: 1rem 0 0; font-size: 0.875rem; text-align: center; color: var(--gray-500); }

/* Base-theme forms that do not use the macros (verify-email, logout-confirm) */
#kc-form-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; }
#kc-form-buttons > .btn { flex: 1 1 auto; }
#kc-verify-email-form { margin: 1.5rem 0; }
#kc-logout-confirm .form-actions { margin-top: 1.5rem; }
#kc-info-message { margin-top: 1.5rem; }
#kc-info-message p:first-child { margin-top: 0; }
.info-action { margin-top: 1.5rem; }
#kc-error-message .instruction { overflow-wrap: anywhere; }
#kc-error-message #traceId { font-size: 0.8125rem; color: var(--gray-500); }

/* Attempted-username chip (second step of a split flow) */
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
}
.user-chip__icon { width: 1.125rem; height: 1.125rem; flex: none; color: var(--gray-500); }
.user-chip__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--gray-900);
}
.user-chip__reset {
  flex: none;
  font-weight: 500;
  color: var(--action);
  text-decoration: none;
  border-radius: 0.25rem;
}
.user-chip__reset:hover { color: var(--action-hover); text-decoration: underline; }

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid;
  border-radius: var(--radius-control);
}
.alert__icon { flex: none; width: 1rem; height: 1rem; margin-top: 0.125rem; }
.alert__icon svg { display: block; width: 1rem; height: 1rem; }
.alert__text { overflow-wrap: anywhere; }
.alert--error { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.alert--success { color: #0f5f57; background: #eef9f7; border-color: #b7e4dc; }
.alert--warning { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.alert--info { color: var(--action); background: var(--primary-soft); border-color: #d9c8ea; }
.alert a { color: inherit; text-decoration: underline; }

/* Info band (displayInfo sections, e.g. verify-email hints) */
.info-band { margin-top: 1.5rem; font-size: 0.875rem; color: var(--gray-500); }
.info-band p { color: inherit; }
.info-band__text { font-size: 0.875rem; color: var(--gray-500); }

/* Footer: contact + language */
.foot {
  margin: 2rem 0 0;
  font-size: 0.875rem;
  text-align: center;
  color: var(--gray-500);
}
.foot__text { white-space: nowrap; }
.foot__link {
  font-weight: 500;
  white-space: nowrap;
  color: var(--action);
  text-decoration: none;
  border-radius: 0.25rem;
}
.foot__link:hover, .foot__link:focus-visible { color: var(--action-hover); text-decoration: underline; }

.lang {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  font-size: 0.8125rem;
}
.lang__link {
  color: var(--gray-500);
  text-decoration: none;
  border-radius: 0.375rem;
  padding: 0.375rem 0.625rem;
}
.lang__link:hover { color: var(--gray-900); text-decoration: underline; }
.lang__link[aria-current="true"] { color: var(--action); font-weight: 500; }

/* --------------------------------------------------------------------------
   Authenticator selection & WebAuthn credential lists
   -------------------------------------------------------------------------- */
.auth-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.auth-list__title { margin: 0 0 0.5rem; font-size: 0.875rem; color: var(--gray-500); }
.auth-list__form { margin: 0; }
.auth-option {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  width: 100%;
  margin: 0;
  padding: 0.875rem 1rem;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  transition: border-color 150ms ease, background-color 150ms ease;
}
button.auth-option { cursor: pointer; }
button.auth-option:hover { border-color: var(--accent-light-purple); background: var(--surface-subtle); }
.auth-option__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  color: var(--action);
  background: var(--primary-soft);
  border-radius: 0.625rem;
}
.auth-option__glyph { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; color: var(--action); }
.auth-option__glyph svg, .auth-option__glyph img { width: 1.75rem; height: 1.75rem; }
.auth-option__body { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; gap: 0.125rem; }
.auth-option__title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--gray-900);
}
.auth-option__desc, .auth-option__sub { font-size: 0.8125rem; line-height: 1.4; color: var(--gray-500); }
.auth-option__fill { display: inline-flex; margin-left: auto; color: var(--gray-400); }
#kc-form-webauthn .auth-list { margin-bottom: 0.5rem; }

/* OTP credential tiles (login-otp.ftl, several devices) */
.otp-tile {
  display: flex;
  margin-bottom: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  cursor: pointer;
}
.otp-tile:hover { border-color: var(--accent-light-purple); }
.otp-tile.is-selected { border-color: var(--action); background: var(--primary-soft); }
.otp-tile__header { display: flex; align-items: center; gap: 0.625rem; }
.otp-tile__icon { color: var(--action); display: inline-flex; }
.otp-tile__title { font-size: 0.9375rem; font-weight: 500; color: var(--gray-900); }

/* TOTP setup */
.totp-steps {
  margin: 0 0 1.75rem;
  padding-left: 1.25rem;
  color: var(--gray-700);
}
.totp-steps > li { margin-bottom: 1rem; }
.totp-steps > li::marker { font-weight: 500; color: var(--action); }
.totp-steps p { margin: 0 0 0.5rem; color: var(--gray-700); }
.totp-apps, .totp-params {
  margin: 0.25rem 0 0;
  padding-left: 1.125rem;
  font-size: 0.9375rem;
  color: var(--gray-600);
}
.totp-qr {
  display: block;
  width: 180px;
  height: 180px;
  margin: 0.75rem 0;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}
.totp-secret {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9375rem;
  letter-spacing: 0.04em;
  color: var(--gray-900);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow-wrap: anywhere;
}

/* Recovery codes (clipboard macro + list) */
.clipboard__group .input-wrap { display: flex; gap: 0.5rem; }
.clipboard__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  flex: none;
  padding: 0;
  color: var(--gray-600);
  background: var(--surface);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-control);
  cursor: pointer;
}
.clipboard__button:hover { background: var(--surface-subtle); color: var(--gray-900); }
.clipboard__content { margin-top: 0.5rem; }
.clipboard__content pre {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
}
#kc-recovery-codes-list { columns: 2; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Panels/lists used by a few parent templates */
.panel { border: 1px solid var(--border); border-radius: 0.75rem; background: var(--surface); }
.panel__body { padding: 1rem; }
.list { padding-left: 1.25rem; color: var(--gray-700); }

/* --------------------------------------------------------------------------
   Dark scheme — html.dark, set before first paint by template.ftl when the
   client asked for it (merlin_theme=dark). Values are merlin_billed's dark
   tokens (app/ui/styles/app.css, ".dark"), so a dark billing session lands on
   a login page of the same palette. Surfaces lighten upwards, and the house
   colour lightens with its hover instead of darkening.
   -------------------------------------------------------------------------- */
.dark {
  color-scheme: dark;

  --primary: oklch(0.735 0.152 302);
  --primary-hover: oklch(0.790 0.140 302);
  --primary-soft: oklch(0.290 0.055 302);
  --accent-green-dark: oklch(0.775 0.115 182);

  --canvas: oklch(0.175 0.021 302);
  --surface: oklch(0.213 0.023 302);
  --surface-subtle: oklch(0.255 0.023 302);
  --border: oklch(0.318 0.024 302);
  --border-strong: oklch(0.382 0.028 302);
  --text: oklch(0.945 0.009 300);
  --text-muted: oklch(0.700 0.023 300);
  --action: oklch(0.735 0.152 302);
  --action-hover: oklch(0.790 0.140 302);
  --on-action: oklch(0.168 0.028 302);
  --focus: oklch(0.680 0.150 302);
  --positive: oklch(0.775 0.125 150);
  --warning: oklch(0.790 0.125 74);
  --danger: oklch(0.700 0.175 25);
  --selection: color-mix(in oklab, var(--action) 35%, transparent);

  /* The greys carry most of the text, so they invert along the same ramp. */
  --gray-300: var(--border-strong);
  --gray-400: oklch(0.580 0.020 300);
  --gray-500: var(--text-muted);
  --gray-600: oklch(0.770 0.018 300);
  --gray-700: oklch(0.850 0.014 300);
  --gray-900: var(--text);

  /* A shadow carries nothing on a dark ground; a light inner edge marks the card. */
  --shadow-card: inset 0 1px 0 color-mix(in oklab, var(--text) 10%, transparent), 0 0 0 1px var(--border);
}

.dark .brand__dots { opacity: 0.15; }

.dark .field--error input.input,
.dark input.input.is-error { border-color: color-mix(in oklab, var(--danger) 60%, var(--surface)); }
.dark .field--error input.input:focus { box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 30%, transparent); }

.dark .alert--error { color: var(--danger); background: oklch(0.300 0.070 22); border-color: oklch(0.420 0.110 24); }
.dark .alert--success { color: var(--positive); background: oklch(0.288 0.050 150); border-color: oklch(0.400 0.080 150); }
.dark .alert--warning { color: var(--warning); background: oklch(0.302 0.052 66); border-color: oklch(0.420 0.080 70); }
.dark .alert--info { border-color: oklch(0.400 0.080 302); }

/* --------------------------------------------------------------------------
   Utilities
   Last in the file on purpose: kcMarginTopClass is put on buttons and links
   whose component rules set "margin: 0", and those have the same specificity.
   -------------------------------------------------------------------------- */
.mt { margin-top: 1rem; }

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes blob-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(16px, -20px) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .fade-up, .brand__blob { animation: none; }
  .btn, input.input, .auth-option { transition: none; }
  .btn--primary:active { transform: none; }
}
