/*
 * Copyright 2026 Ploutos Services LLC
 * SPDX-License-Identifier: Apache-2.0
 */
/* Files carry a version in their name: Keycloak serves theme resources with max-age 30 days under a path
   that does not change on redeploy, so a changed file under an old name never reaches a browser. */
/* Chowkidar wears the sign-in screen of the applications it fronts (the page before the door): a white page, one small rounded card in the
   middle, the tenant's logo (else Chowkidar's mark) and the name, then Google and Microsoft first, in one row of small buttons in
   an outline style. Keycloak's own v2 layout (dark background, wide box running off the screen) is
   overridden here, nothing in its templates is changed. */

#keycloak-bg, body {
  background: #fff !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1f2937;
}

/* The card: the container holds the header (mark + name) and the main (title, buttons, form). */
.pf-v5-c-login {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  box-sizing: border-box;
  background: none !important;
}
.pf-v5-c-login__container {
  display: block !important;
  width: 100%;
  max-width: 384px !important;
  margin: 0 auto;
  padding: 2.5rem 2rem 2rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}
.pf-v5-c-login__header {
  padding: 0 !important;
  margin: 0 0 0.75rem;
  text-align: center;
  color: #1f2937 !important;
}
#kc-header-wrapper {
  font-size: 1rem !important;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #1f2937 !important;
  padding: 0 !important;
  line-height: 1.4;
}
/* The company's logo above the name, as that page does (h-20 w-20, mb-4): the tenant's round, else
   Chowkidar's mark (no bird). The bar's script places it. */
.chowkidar-card-logo {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  object-fit: contain;
}
.chowkidar-card-logo-tenant { border-radius: 50%; object-fit: cover; }

.pf-v5-c-login__main {
  display: flex !important;
  flex-direction: column !important;
  border-top: 0 !important;
  --pf-v5-c-login__main--BorderTopWidth: 0;
  --pf-v5-c-login__main--before--BorderTopWidth: 0;
  background: none !important;
  box-shadow: none !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: none !important;
}
.pf-v5-c-login__main::before, .pf-v5-c-login__main::after { display: none !important; }
.pf-v5-c-login__main-header {
  order: 0;
  padding: 0 !important;
  margin: 0 0 1.25rem;
  text-align: center;
  display: block !important;
}
#kc-page-title {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
  color: #374151;
  line-height: 1.45;
}
/* The brokers first, as that page shows them; the password form after them while passwords still exist. */
.pf-v5-c-login__main-header, .pf-v5-c-login__main-body, .pf-v5-c-login__main-footer { border: 0 !important; }
.pf-v5-c-login__main-footer { order: 1; padding: 0 !important; margin: 0; }
.pf-v5-c-login__main-body { order: 2; padding: 0 !important; }
/* Keycloak nests the brokers' footer INSIDE the body, after the form: the body is the column that reorders. */
.pf-v5-c-login__main > .pf-v5-c-login__main-body { display: flex !important; flex-direction: column !important; }
.pf-v5-c-login__main > .pf-v5-c-login__main-body > #kc-form { order: 2; }
.pf-v5-c-login__main > .pf-v5-c-login__main-body > .pf-v5-c-login__main-footer { order: 1; }
/* Keycloak's "Try Another Way" (the certificate, the key) after the address box, never above the brokers. */
.pf-v5-c-login__main > .pf-v5-c-login__main-body > #kc-select-try-another-way-form { order: 3; margin-top: 0.75rem; }
.pf-v5-c-login__main-footer-band { display: none !important; }
/* Google and Microsoft side by side, one row, first. */
#kc-social-providers ul { display: flex !important; flex-wrap: nowrap; gap: 0.5rem; padding: 0 !important; margin: 0; list-style: none; }
#kc-social-providers li { flex: 1 1 0; min-width: 0; padding: 0 0 0.75rem !important; }
#kc-social-providers li a { width: 100%; }

/* Buttons: the outline style, 34px, the icon beside the words, "Continue with <broker>". */
.pf-v5-c-login .pf-v5-c-button.pf-m-secondary,
#kc-social-providers a.pf-v5-c-button {
  justify-content: center !important;
  gap: 0.375rem;
  min-height: 30px;
  padding: 0.25rem 0.5rem !important;
  background: #fff !important;
  color: #1f2937 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 6px !important;
  font-size: 0.8125rem !important;
  box-shadow: none !important;
  white-space: nowrap;
}
.pf-v5-c-login .pf-v5-c-button.pf-m-secondary::after { border: 0 !important; }
.pf-v5-c-login .pf-v5-c-button.pf-m-secondary:hover { background: #f9fafb !important; }
#kc-social-providers a .pf-v5-u-m-auto { margin: 0 !important; }
#kc-social-providers a svg, #kc-social-providers a img, #kc-social-providers a i { width: 16px; height: 16px; font-size: 16px; }

/* The password form, compact, below an "or" rule. */
#kc-form { margin-top: 0.25rem; padding-top: 1rem; border-top: 1px solid #e5e7eb !important; }
.pf-v5-c-login__main-header { border-bottom: 0 !important; }
#kc-social-providers li:last-child { padding-bottom: 0.5rem !important; }
.pf-v5-c-form { gap: 0.75rem !important; }
.pf-v5-c-form__label-text { font-size: 0.8125rem; font-weight: 500; color: #374151; }
.pf-v5-c-form-control {
  min-height: 34px;
  border-radius: 6px !important;
  font-size: 0.875rem;
  --pf-v5-c-form-control--before--BorderColor: #d1d5db;
  --pf-v5-c-form-control--after--BorderColor: transparent;
}
.pf-v5-c-form-control > input { padding: 0.375rem 0.625rem !important; }
#kc-login {
  min-height: 34px;
  padding: 0.375rem 0.75rem !important;
  background: #1b3052 !important;
  border-radius: 6px !important;
  font-size: 0.875rem !important;
}
#kc-login::after { border: 0 !important; }
.pf-v5-c-form__actions { margin: 0 !important; padding-top: 0.25rem !important; }
.pf-v5-c-form__actions > * { margin: 0 !important; width: 100%; }

/* Phone width: the card fills the width with a 16px gutter. */
@media (max-width: 480px) {
  .pf-v5-c-login { padding: 1rem; align-items: flex-start; }
  .pf-v5-c-login__container { padding: 2rem 1.25rem 1.5rem; }
}

/* The rule (no tenant and environment, no way in): the bar's script hides every child of the main and
   shows only "You have arrived here in error". The display rules above carry !important, so a hidden child
   must win over them here, or the sign-in reappears under the error. */
.pf-v5-c-login__main > [hidden] { display: none !important; }
.chowkidar-error { text-align: center; padding: 1rem 0 0 !important; }

