/* Khuzam CRM — centered login */

:root {
  --k-ink: #101010;
  --k-ink-soft: #5c534c;
  --k-forest-deep: #0f3328;
  --k-plum: #0a0a0a;
  --k-plum-mid: #141014;
  --k-sand: #f0e6d8;
  --k-sand-warm: #f7f1e8;
  --k-gold: #c59d71;
  --k-gold-deep: #a88755;
  --k-line: #ddd2c0;
  --k-danger: #9b3b2e;
  --k-success: #1f6f52;
  --k-white: #fffcf7;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body.khuzam-login {
  font-family: var(--font-sans);
  color: var(--k-ink);
  background: var(--k-plum);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Background — layered depth */
.khuzam-login__ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 80% at 50% 100%, #0f1a16 0%, transparent 55%),
    linear-gradient(168deg, #030303 0%, #0a080c 38%, #050505 68%, #000 100%);
}

.khuzam-login__mesh {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 55% 45% at 18% 22%, rgba(197, 157, 113, 0.22) 0%, transparent 58%),
    radial-gradient(ellipse 50% 40% at 82% 78%, rgba(45, 20, 55, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 40% 35% at 72% 18%, rgba(26, 77, 62, 0.14) 0%, transparent 50%),
    radial-gradient(ellipse 35% 30% at 8% 85%, rgba(197, 157, 113, 0.1) 0%, transparent 48%);
  animation: khuzam-login-mesh-drift 22s ease-in-out infinite alternate;
}

.khuzam-login__grid {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(197, 157, 113, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(197, 157, 113, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, #000 20%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, #000 20%, transparent 72%);
}

.khuzam-login__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  will-change: transform;
}

.khuzam-login__orb--gold {
  width: min(62vw, 520px);
  height: min(62vw, 520px);
  top: -12%;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(197, 157, 113, 0.42) 0%, rgba(197, 157, 113, 0.08) 45%, transparent 70%);
  animation: khuzam-login-orb-float-a 18s ease-in-out infinite;
}

.khuzam-login__orb--plum {
  width: min(48vw, 400px);
  height: min(48vw, 400px);
  bottom: -8%;
  left: -6%;
  background: radial-gradient(circle, rgba(75, 28, 95, 0.38) 0%, rgba(40, 12, 52, 0.1) 50%, transparent 72%);
  animation: khuzam-login-orb-float-b 24s ease-in-out infinite;
}

.khuzam-login__orb--forest {
  width: min(40vw, 340px);
  height: min(40vw, 340px);
  top: 42%;
  right: -8%;
  background: radial-gradient(circle, rgba(26, 77, 62, 0.28) 0%, rgba(15, 51, 40, 0.06) 55%, transparent 75%);
  animation: khuzam-login-orb-float-c 20s ease-in-out infinite;
}

.khuzam-login__ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(197, 157, 113, 0.12);
  box-shadow:
    0 0 60px rgba(197, 157, 113, 0.06) inset,
    0 0 40px rgba(197, 157, 113, 0.04);
}

.khuzam-login__ring--1 {
  width: min(90vw, 680px);
  height: min(90vw, 680px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.55;
  animation: khuzam-login-ring-pulse 14s ease-in-out infinite;
}

.khuzam-login__ring--2 {
  width: min(70vw, 520px);
  height: min(70vw, 520px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-color: rgba(197, 157, 113, 0.08);
  opacity: 0.4;
  animation: khuzam-login-ring-pulse 14s ease-in-out 2s infinite reverse;
}

.khuzam-login__grain {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
}

.khuzam-login__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 85% 75% at 50% 48%, transparent 35%, rgba(0, 0, 0, 0.55) 100%);
}

@keyframes khuzam-login-mesh-drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(2%, -1.5%) scale(1.04); }
}

@keyframes khuzam-login-orb-float-a {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-48%) translateY(24px); }
}

@keyframes khuzam-login-orb-float-b {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(28px, -20px); }
}

@keyframes khuzam-login-orb-float-c {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-22px, 16px); }
}

@keyframes khuzam-login-ring-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
  50% { transform: translate(-50%, -50%) scale(1.03); opacity: 0.62; }
}

@media (prefers-reduced-motion: reduce) {
  .khuzam-login__mesh,
  .khuzam-login__orb,
  .khuzam-login__ring {
    animation: none !important;
  }
}

/* Centered layout */
.khuzam-login__center {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
}

.khuzam-login__panel-card {
  width: min(100%, 420px);
  background: rgba(255, 252, 247, 0.97);
  border: 1px solid rgba(221, 210, 192, 0.85);
  border-radius: 22px;
  padding: clamp(28px, 5vw, 40px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 0 0 1px rgba(197, 157, 113, 0.08),
    0 32px 80px rgba(0, 0, 0, 0.45),
    0 8px 24px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: khuzam-login-rise 0.55s ease both;
}

@keyframes khuzam-login-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.khuzam-login__panel-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  margin-bottom: 28px;
}

.khuzam-login__panel-mark {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  background: #0a0a0a;
  padding: 5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.khuzam-login__panel-brand {
  display: grid;
  gap: 6px;
}

.khuzam-login__panel-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--k-gold-deep);
}

.khuzam-login__panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--k-forest-deep);
}

.khuzam-login__panel-sub {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--k-ink-soft);
  max-width: 32ch;
  margin-inline: auto;
}

/* Alerts */
.khuzam-login__alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
}

.khuzam-login__alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.khuzam-login__alert-icon svg {
  width: 20px;
  height: 20px;
}

.khuzam-login__alert--error {
  background: #fef2f2;
  color: var(--k-danger);
  border: 1px solid #fecaca;
}

.khuzam-login__alert--success {
  background: #ecfdf5;
  color: var(--k-success);
  border: 1px solid #a7f3d0;
}

/* Form */
.khuzam-login__form {
  display: grid;
  gap: 18px;
}

.khuzam-login-field {
  display: grid;
  gap: 8px;
}

.khuzam-login-field__label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--k-ink-soft);
  letter-spacing: 0.02em;
}

.khuzam-login-field__wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.khuzam-login-field__icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--k-gold-deep);
  pointer-events: none;
  z-index: 1;
}

.khuzam-login-field__icon svg {
  width: 18px;
  height: 18px;
}

.khuzam-login-field__input {
  width: 100%;
  height: 50px;
  border: 1px solid #d5cbb8;
  border-radius: 12px;
  padding: 0 44px;
  background: var(--k-sand-warm);
  font: inherit;
  font-size: 1rem;
  color: var(--k-ink);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.khuzam-login-field__input::placeholder {
  color: #a89888;
}

.khuzam-login-field__input:hover {
  border-color: #c9b89e;
}

.khuzam-login-field__input:focus {
  outline: none;
  border-color: var(--k-gold);
  box-shadow: 0 0 0 4px rgba(197, 157, 113, 0.22);
  background: #fff;
}

.khuzam-login-field__toggle {
  position: absolute;
  right: 6px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--k-ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.khuzam-login-field__toggle:hover {
  background: rgba(197, 157, 113, 0.12);
  color: var(--k-ink);
}

.khuzam-login-field__toggle svg {
  width: 18px;
  height: 18px;
}

.khuzam-login-field__eye-closed[hidden],
.khuzam-login-field__eye-open[hidden] {
  display: none !important;
}

/* Inline field errors */
.khuzam-login-field.has-error .khuzam-login-field__input {
  border-color: #dc8a7d;
  background: #fef5f4;
}

.khuzam-login-field.has-error .khuzam-login-field__input:focus {
  border-color: var(--k-danger);
  box-shadow: 0 0 0 4px rgba(155, 59, 46, 0.16);
}

.khuzam-login-field.has-error .khuzam-login-field__icon {
  color: var(--k-danger);
}

.khuzam-login-field__error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--k-danger);
  animation: khuzam-login-error-in 0.2s ease both;
}

.khuzam-login-field__error::before {
  content: "!";
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--k-danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

@keyframes khuzam-login-error-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Error shake */
.khuzam-login__panel-card.is-error-shake {
  animation: khuzam-login-shake 0.5s ease;
}

@keyframes khuzam-login-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

.khuzam-login__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.khuzam-login__remember {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--k-ink-soft);
  cursor: pointer;
  user-select: none;
}

.khuzam-login__remember input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.khuzam-login__remember-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid #c9b89e;
  background: #fff;
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}

.khuzam-login__remember-box::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  margin-top: -2px;
  transition: transform 0.15s;
}

.khuzam-login__remember input:checked + .khuzam-login__remember-box {
  background: var(--k-forest-deep);
  border-color: var(--k-forest-deep);
}

.khuzam-login__remember input:checked + .khuzam-login__remember-box::after {
  transform: rotate(-45deg) scale(1);
}

.khuzam-login__remember input:focus-visible + .khuzam-login__remember-box {
  box-shadow: 0 0 0 3px rgba(197, 157, 113, 0.35);
}

.khuzam-login__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
  border: none;
  border-radius: 12px;
  padding: 0 20px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--k-sand);
  cursor: pointer;
  background: linear-gradient(180deg, #1a1418 0%, #0a0a0a 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 8px 24px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}

.khuzam-login__submit:hover {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 12px 28px rgba(0, 0, 0, 0.28);
}

.khuzam-login__submit:active {
  transform: translateY(1px);
}

.khuzam-login__submit:disabled {
  opacity: 0.72;
  cursor: wait;
}

.khuzam-login__submit-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(240, 230, 216, 0.35);
  border-top-color: var(--k-sand);
  border-radius: 50%;
  animation: khuzam-login-spin 0.7s linear infinite;
}

@keyframes khuzam-login-spin {
  to { transform: rotate(360deg); }
}

.khuzam-login__panel-foot {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #efe8df;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.khuzam-login__secure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--k-ink-soft);
}

.khuzam-login__secure svg {
  width: 14px;
  height: 14px;
  color: var(--k-gold-deep);
}

.khuzam-login__copy {
  font-size: 0.72rem;
  color: #a89888;
}

/* RTL */
[dir="rtl"] .khuzam-login-field__icon {
  left: auto;
  right: 14px;
}

[dir="rtl"] .khuzam-login-field__toggle {
  right: auto;
  left: 6px;
}

@media (max-width: 560px) {
  .khuzam-login__center {
    padding-inline: 16px;
  }

  .khuzam-login__panel-card {
    padding: 24px 20px;
    border-radius: 18px;
  }

  .khuzam-login__panel-title {
    font-size: 1.5rem;
  }

  .khuzam-login-field__input {
    font-size: 16px;
  }
}
