/* ==========================================================================
   Ehqaq — auth screens (login / register / OTP / password)
   Layered on top of style.bundle.css; restyles the existing markup only.
   Three themes: creditor (teal) / admin (green) / debtor (bronze)
   ========================================================================== */

.eq-auth {
  --paper:  #FFFFFF;
  --field:  #EFF3F4;
  --ink:    #0C1F24;
  --ink-2:  #3A5459;
  --ink-3:  #4C6A70;
  --muted:  #7E959B;
  --line:   rgba(12, 31, 36, 0.14);
  --radius: 10px;

  --f-display: 'Readex Pro', 'Segoe UI', Tahoma, sans-serif;
  --f-body:    'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;

  --role: #176E77; --role-dark: #0F5259; --role-tint: #E9F3F4;
  --role-soft: rgba(33, 145, 156, .10);

  /* Metronic tokens used by buttons, checkboxes and links */
  --kt-primary: var(--role);
  --kt-primary-active: var(--role-dark);
  --kt-primary-light: var(--role-tint);
  --kt-primary-inverse: #fff;
  --kt-form-check-input-checked-bg-color: var(--role);
  --kt-form-check-input-checked-border-color: var(--role);
}

.eq-auth--creditor {
  --role: #176E77; --role-dark: #0F5259; --role-tint: #E9F3F4;
  --role-soft: rgba(33, 145, 156, .10);
}
.eq-auth--admin {
  --role: #1C6B4F; --role-dark: #134E38; --role-tint: #E8F2ED;
  --role-soft: rgba(36, 138, 102, .10);
}
.eq-auth--debtor {
  --role: #8A6D28; --role-dark: #65551E; --role-tint: #F6F1E3;
  --role-soft: rgba(138, 109, 40, .10);
}

html body.app-blank {
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  background: #fff;
  overflow-x: clip;
}

/* ------------------------------------------------------------ layout --- */

.eq-auth {
  min-height: 100vh; min-height: 100dvh;
  display: grid !important;
  grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
  font-family: var(--f-body);
  color: var(--ink);
}
.eq-auth ::selection { background: var(--role); color: #fff; }

/* ------------------------------------------------------------- brand --- */

.eq-auth__brand {
  position: sticky; top: 0; align-self: start;   /* stays in view while long forms scroll */
  height: 100vh; height: 100dvh; overflow: hidden;
  background: var(--role); color: #fff;
}

/* Watermark: the Ehqaq circuit mark (already white), cropped at the panel edge — as portal-auth */
.eq-auth__brand::before {
  content: ""; position: absolute; bottom: -110px; inset-inline-start: -80px;
  width: min(600px, 120%); height: 557px;
  pointer-events: none; opacity: .18;
  background: url("../../images/auth/brand-circuit.png") no-repeat bottom right / contain;
}
[dir="ltr"] .eq-auth__brand::before { background-position: bottom left; transform: scaleX(-1); }

.eq-auth__brandin {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 48px 48px 88px;
}

.eq-auth__logo { display: flex; justify-content: center; width: 100%; line-height: 0; }
.eq-auth__logo img { width: 400px; max-width: min(100%, 500px); height: auto; filter: brightness(0) invert(1); }

.eq-auth__brandcol {
  width: 100%; max-width: 380px; margin-top: 40px;
  display: flex; flex-direction: column; align-items: center;
}

.eq-auth__client { display: flex; align-items: center; justify-content: center; gap: 16px; text-align: start; }
.eq-auth__clientlogo {
  flex: none; width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 18px; overflow: hidden; background: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .22);
}
.eq-auth__clientlogo img { width: 100%; height: 100%; object-fit: contain; }
.eq-auth__clientname {
  font-size: 17px; font-weight: 700; line-height: 1.55; color: #fff; unicode-bidi: plaintext;
}
.eq-auth__clientname span {
  display: block; margin-top: 2px;
  font-size: 12.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  color: rgba(255, 255, 255, .84); unicode-bidi: plaintext;
}

.eq-auth__hero {
  margin-top: 40px; padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, .18);
  display: flex; flex-direction: column; align-items: center;
}
.eq-auth__herotitle {
  margin: 0; font-family: var(--f-display);
  font-size: clamp(32px, 3vw, 46px); font-weight: 700; line-height: 1.3;
  color: #fff; text-wrap: balance;
}
.eq-auth__herosub {
  margin: 12px 0 0; font-family: var(--f-display);
  font-size: 20px; font-weight: 500; line-height: 1.5; color: #fff; text-wrap: balance;
}
.eq-auth__herolead {
  margin: 14px 0 0; max-width: 34ch;
  font-size: 15px; line-height: 1.9; color: rgba(255, 255, 255, .92);
}
.eq-auth__herolead a { color: #fff; font-weight: 600; unicode-bidi: isolate; text-decoration: underline; text-underline-offset: 3px; }

.eq-auth__copy {
  position: absolute; bottom: 32px; inset-inline: 48px; margin: 0;
  font-size: 12px; line-height: 1.8; color: rgba(255, 255, 255, .82);
}
.eq-auth__adminlink { display: inline-block; vertical-align: middle; margin-inline-start: 8px; opacity: .6; }
.eq-auth__adminlink:hover { opacity: 1; }
.eq-auth__adminlink img { height: 14px; width: auto; filter: brightness(0) invert(1); }

/* -------------------------------------------------------------- form --- */

.eq-auth__form {
  position: relative; background: var(--paper);
  width: auto !important; padding: 32px 24px !important;
}

.eq-auth__form .w-lg-500px,
.eq-auth__form .w-lg-600px { width: min(420px, 100%) !important; padding: 16px 0 !important; }
.eq-auth__form .w-lg-600px { width: min(480px, 100%) !important; }

.eq-auth__top { position: absolute; top: 24px; inset-inline-end: 24px; z-index: 5; }
.eq-auth__lang {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-3); font-size: 13px; font-weight: 600; line-height: 1;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.eq-auth__lang:hover { border-color: var(--role); color: var(--role); background: var(--role-soft); }
.eq-auth__lang svg { opacity: .7; }

/* Headings & copy */
.eq-auth__form h1,
.eq-auth__form h2.card-title {
  font-family: var(--f-display); font-size: 30px; font-weight: 700; line-height: 1.35;
  color: var(--ink) !important; text-wrap: balance;
}
.eq-auth__form .card-text,
.eq-auth__form .text-gray-500,
.eq-auth__form .text-muted { font-size: 14px; line-height: 1.8; color: var(--ink-2) !important; }

.eq-auth__form .form-label,
.eq-auth__form label {
  font-size: 13px; font-weight: 500; line-height: 1.5; color: var(--ink-2);
}

/* Field groups: tight inside a group, generous between groups */
.eq-auth__form form > .mb-1 { margin-bottom: 20px !important; }
.eq-auth__form .form-label { margin-bottom: 8px; }
.eq-auth__form .text-danger { color: #A32C2C !important; font-weight: 500; }

/* Fields */
.eq-auth__form .form-control,
.eq-auth__form .form-select {
  min-height: 52px; padding: 12px 16px;
  background-color: var(--field) !important;
  border: 1.5px solid transparent; border-radius: var(--radius);
  color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 400;
  box-shadow: none;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.eq-auth__form .form-control::placeholder { color: #93A8AD; }
.eq-auth__form .form-control:hover,
.eq-auth__form .form-select:hover { background-color: #E9F0F1 !important; }
.eq-auth__form .form-control:focus,
.eq-auth__form .form-select:focus {
  background-color: #fff !important; border-color: var(--role);
  box-shadow: 0 0 0 3px var(--role-soft); outline: none;
}
.eq-auth__form .input-group-merge .form-control { border-radius: var(--radius) !important; }

/* Mobile number (intl-tel-input): full field width, flag inside the field */
.eq-auth__form .input-group > .input-icon { display: none; }
.eq-auth__form .iti,
.eq-auth__form .intl-tel-input { display: block !important; flex: 1 1 100%; width: 100%; }
.eq-auth__form .iti .form-control,
.eq-auth__form .intl-tel-input .form-control { width: 100% !important; border-radius: var(--radius) !important; }

/* Password visibility toggle — sits inside the field, on the end side */
.eq-auth__form .form-password-toggle,
.eq-auth__form [data-kt-password-meter] .position-relative { position: relative; display: flex; flex-wrap: nowrap; }
.eq-auth__form .form-password-toggle .form-control,
.eq-auth__form [data-kt-password-meter] .form-control { flex: 1 1 auto; min-width: 0; padding-inline-end: 52px; }
.eq-auth__form .eq-auth__pwtoggle {
  position: absolute !important; top: 50% !important; z-index: 5;
  inset-inline-end: 6px !important; inset-inline-start: auto !important;
  transform: translateY(-50%) !important; margin: 0 !important;
  width: 40px; height: 40px; padding: 0 !important;
  display: flex; align-items: center; justify-content: center;
  background: transparent !important; border: none; border-radius: 10px;
  color: var(--muted); cursor: pointer; line-height: 1;
}
.eq-auth__form .eq-auth__pwtoggle i { font-size: 18px !important; color: inherit !important; margin: 0 !important; }
.eq-auth__form .eq-auth__pwtoggle:hover { color: var(--role); background: var(--role-soft) !important; }

/* Checkboxes — box on the start side, label flowing beside it */
.eq-auth__form .form-check-input {
  border-color: var(--role) !important; accent-color: var(--role);
}
.eq-auth__form .fv-row > .form-check-input {
  width: 20px; height: 20px; margin: 0; margin-inline-end: 10px;
  vertical-align: middle; border-width: 1.5px !important; border-radius: 5px;
}
.eq-auth__form .fv-row > .form-check-input + label { display: inline; vertical-align: middle; font-size: 14px; line-height: 1.8; }
.eq-auth__form .fv-row > .form-check-input + label .form-check-label { margin: 0 !important; color: var(--ink-2) !important; }

/* Links */
.eq-auth__form a:not(.btn):not(.eq-auth__lang) { color: var(--ink-3); }
.eq-auth__form a:not(.btn):not(.eq-auth__lang):hover { color: var(--role); }
.eq-auth__form .link-primary,
.eq-auth__form .link-primary:hover { color: var(--role) !important; font-weight: 700; }

/* Buttons */
.eq-auth__form .btn.btn-primary {
  min-height: 54px; border-radius: var(--radius);
  background-color: var(--role) !important; border: 1px solid var(--role) !important;
  color: #fff !important; font-size: 16px; font-weight: 600;
  transition: filter .2s ease, transform .15s ease;
}
.eq-auth__form .btn.btn-primary:hover,
.eq-auth__form .btn.btn-primary:focus { filter: brightness(.92); }
.eq-auth__form .btn.btn-primary:active { transform: translateY(1px); }
.eq-auth__form .btn.btn-light-primary,
.eq-auth__form .btn.btn-secondary {
  min-height: 54px; border-radius: var(--radius);
  background: var(--role-tint) !important; color: var(--role) !important; border: none;
}

/* "Forgot password" — quiet link on the start side, under the password */
.eq-auth__form form .flex-stack { justify-content: flex-start !important; margin-bottom: 0 !important; }
.eq-auth__form form .flex-stack > div:empty { display: none; }
.eq-auth__form form .flex-stack .link-primary {
  color: var(--ink-3) !important; font-weight: 400; font-size: 13px; line-height: 1.6;
}
.eq-auth__form form .flex-stack .link-primary:hover { color: var(--role) !important; }
.eq-auth__form form .btn.btn-primary { margin-top: 20px; }

/* the old wrapper is a Bootstrap .row: drop its gutter so fields, links and divider share one edge */
.eq-auth__form .auth-inner.row > * { padding-left: 0; padding-right: 0; }

/* "No account? Register" */
.eq-auth__alt { margin-top: 20px; text-align: start; font-size: 13px; line-height: 1.6; color: var(--ink-3); }

/* Other sign-ins: debtor representative + staff */
.eq-auth__switch { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.eq-auth__switchrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 13px; line-height: 1.6; color: var(--ink-3);
}
.eq-auth__form .eq-auth__debtorlink,
.eq-auth__form .eq-auth__debtorlink:hover {
  display: inline-flex; align-items: center; gap: 6px;
  color: #8A6D28 !important; font-weight: 700;   /* debtor theme */
}
.eq-auth__form .eq-auth__debtorlink:hover { color: #65551E !important; }
[dir="rtl"] .eq-auth__debtorlink svg { transform: scaleX(-1); }
.eq-auth__form .eq-auth__stafflink {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  font-size: 12.5px; color: var(--muted) !important;
}
.eq-auth__form .eq-auth__stafflink:hover { color: var(--ink-2) !important; }

/* Messages — same component as portal-auth (.auth__msg) */
.eq-auth__msgs:empty { display: none; }
.eq-auth__msg {
  margin: 20px 0; padding: 12px 16px; border-radius: 10px;
  font-size: 14px; line-height: 1.8; text-align: start;
  border: none; border-inline-start: 2px solid;
}
.eq-auth__msg strong { font-weight: 700; }
.eq-auth__msg--error { background: #FDF1F1; border-color: #A32C2C; color: #7E2323; }
.eq-auth__msg--ok    { background: var(--role-soft); border-color: var(--role); color: var(--role); }
.eq-auth__msg ul { margin: 6px 0 0; padding-inline-start: 18px; list-style: disc; }

/* Invalid field (client check or backend) */
.eq-auth__form .form-control.is-invalid,
.eq-auth__form .form-select.is-invalid {
  border-color: #A32C2C !important; background-color: #fff !important; background-image: none;
}
.eq-auth__form .form-check-input.is-invalid { border-color: #A32C2C !important; }

/* Dropdowns — portal arrow; options are untouched */
.eq-auth__form .form-select {
  appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%) !important;
  background-size: 6px 6px, 6px 6px !important;
  background-position: calc(100% - 20px) calc(50% + 1px), calc(100% - 14px) calc(50% + 1px) !important;
  background-repeat: no-repeat !important;
  padding-inline-end: 44px;
}
[dir="rtl"] .eq-auth__form .form-select {
  background-position: 14px calc(50% + 1px), 20px calc(50% + 1px) !important;   /* same left-right order as LTR */
}

.eq-auth__form :where(a, button, input, select):focus-visible { outline: 2px solid var(--role); outline-offset: 3px; }

/* -------------------------------------------------------- responsive --- */

@media (max-width: 1199.98px) {
  .eq-auth__brandin { padding: 40px 32px 80px; }
  .eq-auth__logo img { width: 300px; }
  .eq-auth__brandcol { margin-top: 32px; }
  .eq-auth__hero { margin-top: 32px; }
}

/* Mobile: brand panel collapses to a compact top bar */
@media (max-width: 991.98px) {
  .eq-auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100svh; }
  .eq-auth__brand { position: relative; height: auto; }
  .eq-auth__brand::before { display: none; }
  .eq-auth__brandin {
    min-height: 0; flex-direction: row; justify-content: space-between; gap: 16px;
    padding: 12px 20px;
  }
  .eq-auth__logo { width: auto; }
  .eq-auth__logo img { width: auto; height: 30px; }
  .eq-auth__brandcol { width: auto; max-width: none; margin: 0; }
  .eq-auth__clientlogo { width: 38px; height: 38px; border-radius: 10px; box-shadow: none; }
  .eq-auth__clientname { font-size: 12px; font-weight: 500; max-width: 180px; }
  .eq-auth__clientname span, .eq-auth__hero, .eq-auth__copy { display: none; }

  .eq-auth__form { padding: 0 20px 48px !important; }
  .eq-auth__top { position: static; margin-top: 20px; align-self: flex-start; }
  .eq-auth__form .w-lg-500px,
  .eq-auth__form .w-lg-600px { width: 100% !important; max-width: 460px; margin-inline: auto; }
  .eq-auth__form h1, .eq-auth__form h2.card-title { font-size: 28px; }
}

@media (max-width: 420px) {
  .eq-auth__clientname { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .eq-auth *, .eq-auth *::before, .eq-auth *::after { transition-duration: .01ms !important; }
}
