:root {
  --agent-ink: #080808;
  --agent-panel: #111111;
  --agent-panel-soft: #171717;
  --agent-white: #ffffff;
  --agent-pink: #f425c7;
  --agent-pink-dark: #d70aad;
  --agent-lime: #caff00;
}

/* Keep Cal's component system intact, but feed it the Agentifizierung brand colors. */
[class*="--cal-brand"] {
  --cal-brand: var(--agent-pink) !important;
  --cal-brand-emphasis: var(--agent-pink-dark) !important;
  --cal-brand-subtle: var(--agent-lime) !important;
  --cal-brand-text: var(--agent-white) !important;
}

.logo img[src^="/api/logo"] {
  width: 2.5rem !important;
  height: 2.5rem !important;
  object-fit: contain;
  filter: none !important;
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--agent-lime) !important;
  outline-offset: 3px !important;
}

/* Branded authentication shell. :has() keeps these rules away from booking pages. */
body:has(form[data-testid="login-form"]) {
  background: var(--agent-ink) !important;
  color: var(--agent-white);
}

body:has(form[data-testid="login-form"]) .flex.min-h-screen.flex-col {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 18%, rgb(244 37 199 / 20%), transparent 28rem),
    radial-gradient(circle at 85% 82%, rgb(202 255 0 / 10%), transparent 30rem),
    var(--agent-ink) !important;
}

body:has(form[data-testid="login-form"]) .flex.min-h-screen.flex-col::before {
  position: absolute;
  z-index: -2;
  inset: 0;
  background-image:
    linear-gradient(rgb(255 255 255 / 3.5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 3.5%) 1px, transparent 1px);
  background-size: 56px 56px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 92%);
}

body:has(form[data-testid="login-form"]) .flex.min-h-screen.flex-col::after {
  position: absolute;
  z-index: -1;
  width: 19rem;
  height: 19rem;
  right: -7rem;
  top: -8rem;
  border: 1px solid rgb(202 255 0 / 45%);
  border-radius: 999px;
  box-shadow:
    0 0 0 3rem rgb(202 255 0 / 2%),
    0 0 0 7rem rgb(244 37 199 / 2%);
  content: "";
}

body:has(form[data-testid="login-form"]) .logo.mx-auto.mb-auto {
  display: grid;
  margin-top: 0;
  color: var(--agent-white);
  place-items: center;
}

body:has(form[data-testid="login-form"]) .logo.mx-auto.mb-auto strong {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

body:has(form[data-testid="login-form"]) .logo.mx-auto.mb-auto img {
  width: 3.25rem !important;
  height: 3.25rem !important;
  object-fit: contain;
}

body:has(form[data-testid="login-form"]) .logo.mx-auto.mb-auto strong::after {
  color: var(--agent-white);
  content: "AGENTIFIZIERUNG";
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  line-height: 1;
}

body:has(form[data-testid="login-form"]) .logo.mx-auto.mb-auto::after {
  margin-top: -0.35rem;
  margin-left: 4rem;
  color: var(--agent-lime);
  content: "TEAMKALENDER";
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.2em;
}

body:has(form[data-testid="login-form"]) h2.font-cal {
  color: var(--agent-white) !important;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif !important;
  font-size: clamp(1.9rem, 5vw, 2.35rem);
  font-weight: 900;
  letter-spacing: -0.045em;
}

body:has(form[data-testid="login-form"]) h2.font-cal::before {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--agent-lime);
  content: "INTERNER ZUGANG";
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.2em;
}

body:has(form[data-testid="login-form"]) div:has(> form[data-testid="login-form"]) {
  border: 1px solid rgb(255 255 255 / 14%) !important;
  border-radius: 1.5rem !important;
  background: rgb(17 17 17 / 92%) !important;
  box-shadow:
    0 1.5rem 5rem rgb(0 0 0 / 45%),
    0 0 0 1px rgb(244 37 199 / 4%);
  backdrop-filter: blur(18px);
}

body:has(form[data-testid="login-form"]) form[data-testid="login-form"] label,
body:has(form[data-testid="login-form"]) form[data-testid="login-form"] .text-default,
body:has(form[data-testid="login-form"]) form[data-testid="login-form"] .text-emphasis {
  color: var(--agent-white) !important;
}

body:has(form[data-testid="login-form"]) form[data-testid="login-form"] label {
  letter-spacing: 0.015em;
}

body:has(form[data-testid="login-form"]) form[data-testid="login-form"] input#email,
body:has(form[data-testid="login-form"]) form[data-testid="login-form"] div:has(> input#password) {
  height: 2.9rem !important;
  border: 1px solid rgb(255 255 255 / 16%) !important;
  border-radius: 0.8rem !important;
  background: var(--agent-panel-soft) !important;
  color: var(--agent-white) !important;
  box-shadow: none !important;
}

body:has(form[data-testid="login-form"]) form[data-testid="login-form"] input#email:focus,
body:has(form[data-testid="login-form"]) form[data-testid="login-form"] div:has(> input#password):focus-within {
  border-color: var(--agent-pink) !important;
  box-shadow: 0 0 0 3px rgb(244 37 199 / 18%) !important;
}

body:has(form[data-testid="login-form"]) form[data-testid="login-form"] input::placeholder {
  color: rgb(255 255 255 / 34%) !important;
}

body:has(form[data-testid="login-form"]) form[data-testid="login-form"] a {
  color: var(--agent-pink) !important;
  font-weight: 750;
}

body:has(form[data-testid="login-form"]) form[data-testid="login-form"] a:hover {
  color: var(--agent-lime) !important;
}

body:has(form[data-testid="login-form"]) form[data-testid="login-form"] button[type="submit"] {
  min-height: 3rem;
  border: 0 !important;
  border-radius: 0.85rem !important;
  background: var(--agent-lime) !important;
  color: var(--agent-ink) !important;
  box-shadow: 0 0.8rem 2.5rem rgb(202 255 0 / 12%) !important;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

body:has(form[data-testid="login-form"]) form[data-testid="login-form"] button[type="submit"]:hover {
  background: var(--agent-pink) !important;
  color: var(--agent-white) !important;
}

body:has(form[data-testid="login-form"]) div.mb-auto.mt-8 > .text-default.mt-8.text-center.text-sm {
  color: rgb(255 255 255 / 48%) !important;
  font-size: 0;
  pointer-events: none;
}

body:has(form[data-testid="login-form"]) div.mb-auto.mt-8 > .text-default.mt-8.text-center.text-sm > * {
  display: none;
}

body:has(form[data-testid="login-form"]) div.mb-auto.mt-8 > .text-default.mt-8.text-center.text-sm::after {
  content: "Zugang nur für das Agentifizierung-Team";
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  body:has(form[data-testid="login-form"]) .flex.min-h-screen.flex-col {
    padding-top: 2.25rem;
    padding-bottom: 2.25rem;
  }

  body:has(form[data-testid="login-form"]) div:has(> form[data-testid="login-form"]) {
    margin-inline: 1rem;
    padding: 2rem 1.25rem;
  }
}
