:root,
html[data-theme="dark"] {
  /* Westgate tokens */
  --wg-bg: #0f0d12;
  --wg-bg-deep: #09080b;
  --wg-panel: #18141d;
  --wg-panel-2: #110f15;
  --wg-plum: #2a1222;
  --wg-plum-soft: #3a1830;
  --wg-gold: #c2a35a;
  --wg-gold-soft: #a8893f;
  --wg-red: #8e3438;
  --wg-text: #e6e0d6;
  --wg-text-soft: #b9b2a6;
  --wg-text-muted: #9a9086;
  --wg-border: rgba(194, 163, 90, 0.16);
  --wg-focus: rgba(194, 163, 90, 0.34);

  /* Authentik + PatternFly variables */
  --ak-global--Color--100: var(--wg-text);
  --ak-global--Color--200: var(--wg-text-soft);
  --ak-global--Color--300: var(--wg-text-muted);
  --ak-global--BackgroundColor--100: var(--wg-bg);
  --ak-global--BackgroundColor--200: var(--wg-panel);
  --ak-global--primary: var(--wg-gold);

  --pf-global--Color--100: var(--wg-text);
  --pf-global--Color--200: var(--wg-text-soft);
  --pf-global--BackgroundColor--100: var(--wg-bg);
  --pf-global--BackgroundColor--dark-100: var(--wg-bg-deep);
  --pf-global--primary-color--100: var(--wg-gold);
  --pf-global--primary-color--200: #e0c878;
  --pf-global--link--Color: var(--wg-gold);
  --pf-global--link--Color--hover: #e0c878;
  --pf-global--BorderColor--100: var(--wg-border);
  --pf-global--FontFamily--sans-serif: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --pf-v5-global--Color--100: var(--wg-text);
  --pf-v5-global--Color--200: var(--wg-text-soft);
  --pf-v5-global--BackgroundColor--100: var(--wg-bg);
  --pf-v5-global--primary-color--100: var(--wg-gold);
  --pf-v5-global--primary-color--200: #e0c878;
  --pf-v5-global--link--Color: var(--wg-gold);
  --pf-v5-global--link--Color--hover: #e0c878;

  color-scheme: dark;
}

html,
body {
  background:
    radial-gradient(circle at 68% 18%, rgba(74, 31, 62, 0.22), transparent 36%),
    linear-gradient(145deg, #09080b 0%, #0f0d12 45%, #160f18 100%) !important;
  color: var(--wg-text-soft) !important;
  font-family:
    "Jost",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 4, 7, 0.76), rgba(10, 8, 12, 0.28), rgba(5, 4, 7, 0.72)),
    radial-gradient(circle at 50% 100%, rgba(120, 36, 84, 0.16), transparent 42%);
}

/* Current Authentik flow executor parts */
ak-flow-executor::part(main) {
  background:
    linear-gradient(135deg, rgba(255, 244, 221, 0.035), transparent 42%),
    linear-gradient(100deg, rgba(42, 18, 34, 0.52), rgba(25, 22, 31, 0.96) 30%, rgba(13, 12, 17, 0.98) 100%) !important;
  border: 1px solid rgba(194, 163, 90, 0.22);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    inset 0 0 34px rgba(96, 32, 68, 0.12),
    0 18px 46px rgba(0, 0, 0, 0.42);
  color: var(--wg-text-soft);
}

ak-flow-executor::part(branding) {
  padding-block-end: 0.75rem;
  border-block-end: 1px solid rgba(194, 163, 90, 0.12);
}

ak-flow-executor::part(footer),
ak-flow-executor::part(challenge-footer-band),
ak-flow-executor::part(challenge-additional-actions) {
  background: rgba(9, 8, 11, 0.38) !important;
  border-color: rgba(194, 163, 90, 0.14) !important;
  color: var(--wg-text-muted);
}

ak-flow-executor::part(locale-select) {
  color: var(--wg-text-soft);
}

ak-flow-executor::part(locale-select-select) {
  background-color: rgba(18, 15, 22, 0.96);
  border-color: rgba(194, 163, 90, 0.24);
  color: var(--wg-text);
}

/* Static/non-shadow fallback Authentik pages */
.pf-c-login__main {
  background:
    linear-gradient(135deg, rgba(255, 244, 221, 0.035), transparent 42%),
    linear-gradient(100deg, rgba(42, 18, 34, 0.52), rgba(25, 22, 31, 0.96) 30%, rgba(13, 12, 17, 0.98) 100%) !important;
  border: 1px solid rgba(194, 163, 90, 0.22);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    inset 0 0 34px rgba(96, 32, 68, 0.12),
    0 18px 46px rgba(0, 0, 0, 0.42);
}

.pf-c-login__main-header,
.pf-c-login__main-body,
.pf-c-login__main-footer-band,
.pf-c-login__footer {
  color: var(--wg-text-soft) !important;
}

.pf-c-title,
[data-test-id="card-title"] {
  color: var(--wg-text) !important;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0;
}

.branding-logo {
  max-height: 72px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.7)) drop-shadow(0 10px 22px rgba(0, 0, 0, 0.42));
}

.pf-c-form__label,
.pf-c-form__label-text,
label {
  color: var(--wg-text-soft) !important;
}

.pf-c-form-control,
input,
select,
textarea {
  background-color: rgba(18, 15, 22, 0.96) !important;
  border-color: rgba(194, 163, 90, 0.22) !important;
  color: var(--wg-text) !important;
}

.pf-c-form-control:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(194, 163, 90, 0.58) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.026),
    0 0 0 1px rgba(194, 163, 90, 0.3) !important;
  outline: none;
}

.pf-c-button.pf-m-primary {
  background: linear-gradient(to bottom, #5a4a1a 0%, #473914 100%) !important;
  border-color: #a8893f !important;
  color: #f0e6d8 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.24);
}

.pf-c-button.pf-m-primary:hover,
.pf-c-button.pf-m-primary:focus {
  background: linear-gradient(to bottom, #6a5720 0%, #53431a 100%) !important;
  border-color: #c2a35a !important;
  color: #fff4dd !important;
}

.pf-c-button.pf-m-secondary,
.pf-c-button:not(.pf-m-primary) {
  background: linear-gradient(to bottom, rgba(255, 244, 221, 0.018), rgba(0, 0, 0, 0.06)) !important;
  border-color: rgba(216, 194, 138, 0.3) !important;
  color: #d8cec0 !important;
}

.pf-c-button.pf-m-secondary:hover,
.pf-c-button:not(.pf-m-primary):hover {
  background-color: rgba(194, 163, 90, 0.08) !important;
  border-color: rgba(216, 194, 138, 0.48) !important;
  color: var(--wg-text) !important;
}

a {
  color: var(--wg-gold) !important;
}

a:hover,
a:focus {
  color: #e0c878 !important;
}

.pf-c-alert {
  background: rgba(18, 15, 22, 0.96) !important;
  border-color: rgba(194, 163, 90, 0.2) !important;
  color: var(--wg-text-soft) !important;
}

.pf-m-danger,
.pf-c-alert.pf-m-danger {
  --pf-global--danger-color--100: #c55a5f;
  border-color: rgba(197, 90, 95, 0.42) !important;
}

@media (max-width: 640px) {
  ak-flow-executor::part(main),
  .pf-c-login__main {
    border-radius: 8px;
    margin-inline: 0.75rem;
  }

  .branding-logo {
    max-height: 56px;
  }
}
