/**
 * K697-Saas — طبقة هاب الدخول / البوابات فوق ثيم v9
 * لا تلمس k697-system.css؛ صقل فقط.
 */

body.hub-saas {
  --hub-gold: #e8c777;
  --hub-gold-bright: #f4e0ad;
  --hub-gold-deep: #a97d2e;
  --hub-panel: rgba(24, 21, 32, 0.78);
  --hub-border: rgba(232, 199, 119, 0.28);
  --hub-text: #ece2d0;
  --hub-muted: rgba(196, 181, 156, 0.68);
  --hub-danger: #e07070;
  --hub-warn: #e8c070;
  --hub-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ——— علامة عربية مقروءة (تفوق v9 Orbitron) ——— */
body.hub-saas .mark {
  text-align: center;
  max-width: 36rem;
  margin-inline: auto;
}

body.hub-saas .mark__brand {
  font-family: "Tajawal", sans-serif !important;
  font-weight: 800 !important;
  font-size: clamp(1.55rem, 5.2vw, 2.35rem) !important;
  letter-spacing: 0 !important;
  line-height: 1.35 !important;
  background: linear-gradient(180deg, var(--hub-gold-bright) 0%, var(--hub-gold) 48%, var(--hub-gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 22px rgba(232, 199, 119, 0.22));
}

body.hub-saas .mark__line {
  margin-top: 0.55rem;
  font-size: 0.92rem !important;
  letter-spacing: 0.02em !important;
  font-weight: 600;
  color: var(--hub-muted) !important;
  line-height: 1.55;
}

body.hub-saas .mark__line::before,
body.hub-saas .mark__line::after {
  content: none !important;
}

body.hub-saas .mark__status {
  margin-top: 0.65rem;
  font-size: 0.78rem !important;
  letter-spacing: 0.06em !important;
  font-weight: 700;
  color: rgba(232, 199, 119, 0.55) !important;
}

body.hub-saas .gate {
  gap: clamp(1.35rem, 3vw, 2rem);
  width: min(100% - 28px, 1080px);
  margin-inline: auto;
  padding-block: clamp(1.5rem, 4vh, 2.75rem) 1.25rem;
}

/* ——— تنبيهات ——— */
.hub-flash {
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  display: grid;
  gap: 8px;
}

.hub-flash__item {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--hub-border);
  background: var(--hub-panel);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--hub-text);
}

.hub-flash__item--warn {
  border-color: rgba(232, 192, 112, 0.4);
  background: linear-gradient(90deg, rgba(232, 192, 112, 0.14), transparent), var(--hub-panel);
  color: var(--hub-warn);
}

.hub-flash__item--danger {
  border-color: rgba(224, 112, 112, 0.4);
  background: linear-gradient(90deg, rgba(224, 112, 112, 0.12), transparent), var(--hub-panel);
  color: #f0a0a0;
}

/* ——— لوحة دخول موحّدة ——— */
.hub-enter {
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--hub-border);
  background:
    linear-gradient(180deg, rgba(232, 199, 119, 0.08), transparent 42%),
    var(--hub-panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.hub-enter__title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--hub-gold);
}

.hub-enter__sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--hub-muted);
  font-size: 12px;
  font-weight: 700;
}

.hub-enter__sep::before,
.hub-enter__sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hub-border), transparent);
}

.hub-enter__sep span {
  flex-shrink: 0;
}

.tenant-pick__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.tenant-pick__form {
  margin: 0;
}

.tenant-pick__btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  text-align: inherit;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--hub-border);
  background:
    linear-gradient(180deg, rgba(232, 199, 119, 0.14), rgba(232, 199, 119, 0.03)),
    rgba(12, 10, 16, 0.85);
  color: var(--hub-text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s var(--hub-ease), transform 0.2s var(--hub-ease), background 0.2s var(--hub-ease);
}

.tenant-pick__btn strong {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.tenant-pick__code {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--hub-gold);
  opacity: 0.85;
  letter-spacing: 0.04em;
}

.tenant-pick__btn:hover,
.tenant-pick__btn:focus-visible {
  border-color: rgba(232, 199, 119, 0.55);
  background:
    linear-gradient(180deg, rgba(232, 199, 119, 0.2), rgba(232, 199, 119, 0.05)),
    rgba(12, 10, 16, 0.9);
  outline: none;
}

.tenant-pick__btn:active {
  transform: scale(0.985);
}

.tenant-code__row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.tenant-code__field {
  flex: 1 1 180px;
  min-width: 0;
}

.tenant-code__field label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--hub-muted);
  margin-bottom: 6px;
}

.tenant-code__field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--hub-border);
  background: rgba(8, 7, 12, 0.9);
  color: var(--hub-text);
  font: inherit;
  font-size: 16px;
  transition: border-color 0.2s var(--hub-ease), box-shadow 0.2s var(--hub-ease);
}

.tenant-code__field input:focus {
  outline: none;
  border-color: rgba(232, 199, 119, 0.65);
  box-shadow: 0 0 0 3px rgba(232, 199, 119, 0.15);
}

.tenant-code__field input[aria-invalid="true"] {
  border-color: rgba(224, 112, 112, 0.55);
}

.tenant-code__go {
  flex: 0 0 auto;
  min-height: 46px;
  min-width: 104px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(180deg, var(--hub-gold-bright), var(--hub-gold));
  color: #1a1208;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.2s var(--hub-ease), transform 0.15s var(--hub-ease);
}

.tenant-code__go:hover,
.tenant-code__go:focus-visible {
  filter: brightness(1.06);
  outline: none;
}

.tenant-code__go:active {
  transform: scale(0.98);
}

.tenant-code__hint {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--hub-muted);
  line-height: 1.65;
  font-weight: 600;
}

.tenant-code__err {
  margin: 10px 0 0;
  color: var(--hub-danger);
  font-weight: 700;
  font-size: 13px;
}

/* ——— شريط كتيبة بعد الدخول ——— */
.tenant-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--hub-border);
  background:
    linear-gradient(90deg, rgba(232, 199, 119, 0.1), transparent 55%),
    var(--hub-panel);
}

.tenant-bar__info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  min-width: 0;
}

.tenant-bar__label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--hub-muted);
  width: 100%;
}

.tenant-bar__name {
  font-size: 15px;
  font-weight: 800;
  color: var(--hub-text);
}

.tenant-bar__code {
  font-size: 12px;
  font-weight: 700;
  color: var(--hub-gold);
  background: rgba(232, 199, 119, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

.tenant-bar__switch {
  color: var(--hub-gold);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color 0.2s var(--hub-ease), background 0.2s var(--hub-ease);
}

.tenant-bar__switch:hover,
.tenant-bar__switch:focus-visible {
  border-color: var(--hub-border);
  background: rgba(232, 199, 119, 0.08);
  outline: none;
}

/* ——— إطار البوابات ——— */
.hub-systems {
  width: 100%;
  max-width: 1020px;
  margin-inline: auto;
}

.hub-systems__title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--hub-gold);
}

body.hub-saas .hub-systems .portals {
  margin-inline: auto;
}

body.hub-saas .k697-recent,
body.hub-saas .k697-install-card {
  width: 100%;
  max-width: 1020px;
  margin-inline: auto;
  opacity: 0.92;
}

/* ——— حركات خفيفة ——— */
@media (prefers-reduced-motion: no-preference) {
  @keyframes hub-saas-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }

  body.hub-saas .hub-enter {
    animation: hub-saas-rise 0.55s var(--hub-ease) 0.2s both;
  }

  body.hub-saas .tenant-bar {
    animation: hub-saas-rise 0.45s var(--hub-ease) 0.18s both;
  }

  body.hub-saas .hub-systems {
    animation: hub-saas-rise 0.55s var(--hub-ease) 0.28s both;
  }

  body.hub-saas .hub-flash {
    animation: hub-saas-rise 0.4s var(--hub-ease) 0.12s both;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.hub-saas .hub-enter,
  body.hub-saas .tenant-bar,
  body.hub-saas .hub-systems,
  body.hub-saas .hub-flash,
  .tenant-pick__btn,
  .tenant-code__go {
    animation: none !important;
    transition: none !important;
  }
}

/* ——— موبايل ——— */
@media (max-width: 640px) {
  body.hub-saas .gate {
    width: min(100% - 20px, 1080px);
    gap: 1.15rem;
    padding-block: 1.25rem 1rem;
  }

  body.hub-saas .mark__brand {
    font-size: clamp(1.4rem, 6.5vw, 1.85rem) !important;
  }

  .hub-enter {
    padding: 14px;
    border-radius: 16px;
  }

  .tenant-pick__grid {
    grid-template-columns: 1fr;
  }

  .tenant-pick__btn {
    min-height: 56px;
  }

  .tenant-code__row {
    flex-direction: column;
    align-items: stretch;
  }

  .tenant-code__go {
    width: 100%;
  }

  .tenant-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .tenant-bar__switch {
    text-align: center;
    border-color: var(--hub-border);
  }
}
