.portal-page {
  min-height: 100vh;
  overflow-x: hidden;
}

.portal-page.is-auth-screen {
  background:
    radial-gradient(circle at 50% 48%, rgba(228, 191, 79, 0.12), transparent 32%),
    linear-gradient(145deg, #020201 0%, #080705 48%, #020201 100%);
  color: var(--white);
}

.portal-shell {
  margin: 0 auto;
  max-width: 1280px;
  padding: 70px 30px 110px;
  width: min(100%, 1280px);
}

.portal-page.is-auth-screen .portal-shell {
  align-items: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(228, 191, 79, 0.12), transparent 24%),
    radial-gradient(circle at 84% 80%, rgba(228, 191, 79, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(5, 5, 4, 0.72), #050504 62%),
    #050504;
  display: grid;
  min-height: 100svh;
  max-width: none;
  overflow: hidden;
  padding: 54px 20px;
  place-items: center;
  position: relative;
  width: 100%;
}

.portal-page.is-auth-screen .portal-shell::before,
.portal-page.is-auth-screen .portal-shell::after {
  content: "";
  pointer-events: none;
  position: absolute;
}

.portal-page.is-auth-screen .portal-shell::before {
  animation: authLogoDrift 12s ease-in-out infinite;
  background: url("assets/dahab-app-icon.png") center / contain no-repeat;
  filter: drop-shadow(0 0 60px rgba(228, 191, 79, 0.18));
  height: min(78vw, 760px);
  inset: auto auto -18svh -10vw;
  opacity: 0.08;
  width: min(78vw, 760px);
}

.portal-page.is-auth-screen .portal-shell::after {
  animation: authGoldSweep 9s ease-in-out infinite;
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(228, 191, 79, 0.18) 48%, transparent 54% 100%),
    linear-gradient(65deg, transparent 0 58%, rgba(228, 191, 79, 0.08) 62%, transparent 68% 100%);
  inset: -30%;
  opacity: 0.42;
  transform: rotate(-8deg);
}

.portal-header {
  z-index: 8;
}

.portal-page.is-auth-screen .portal-header {
  display: none;
}

.portal-intro {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(0, 1fr) 220px;
  margin-bottom: 28px;
  padding: 24px 0 42px;
}

.portal-intro h1 {
  font-size: clamp(2rem, 5vw, 4.7rem);
  line-height: 1.15;
  margin: 0 0 16px;
  max-width: 920px;
}

.portal-intro > div > p:last-child,
.workspace-head p,
.workspace-message {
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
}

.portal-mark {
  align-items: center;
  background: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  min-height: 220px;
  overflow: hidden;
  place-items: center;
}

.portal-mark img {
  height: 180px;
  width: 180px;
}

.connection-banner {
  background: rgba(47, 125, 106, 0.12);
  border: 1px solid rgba(47, 125, 106, 0.28);
  border-radius: 8px;
  color: var(--ink);
  font-weight: 850;
  line-height: 1.7;
  margin: 0 0 22px;
  padding: 15px 18px;
}

.portal-page.is-auth-screen .connection-banner {
  background: rgba(179, 79, 66, 0.14);
  border-color: rgba(228, 191, 79, 0.3);
  color: #fff4d0;
  margin: 0 auto 16px;
  max-width: 520px;
  position: relative;
  z-index: 1;
}

.connection-banner.error,
.workspace-message.error {
  background: rgba(179, 79, 66, 0.12);
  border-color: rgba(179, 79, 66, 0.32);
  color: var(--clay);
}

.auth-shell {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(330px, 0.78fr) minmax(420px, 1.22fr);
}

.auth-shell-compact {
  grid-template-columns: minmax(0, 620px);
  justify-content: center;
}

.portal-page.is-auth-screen .auth-shell-compact {
  grid-template-columns: minmax(0, 640px);
  position: relative;
  width: min(100%, 640px);
  z-index: 2;
}

.auth-quick-links {
  align-items: center;
  background: rgba(10, 9, 7, 0.74);
  border: 1px solid rgba(228, 191, 79, 0.26);
  border-radius: 999px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.38);
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  justify-self: center;
  margin-bottom: 18px;
  padding: 6px;
}

.auth-quick-links a {
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
  font-weight: 950;
  min-width: 104px;
  padding: 11px 18px;
  text-align: center;
  text-decoration: none;
}

.auth-quick-links a:hover,
.auth-quick-links a:focus-visible {
  background: rgba(228, 191, 79, 0.16);
  color: #f5d76c;
}

.auth-panel,
.surface-list,
.workspace-head,
.merchant-state,
.admin-gate {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.auth-panel,
.surface-list,
.merchant-state,
.admin-gate {
  padding: clamp(18px, 3vw, 28px);
}

.soft-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.form-note {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
  margin: 0;
}

.portal-page.is-auth-screen .auth-panel {
  background:
    radial-gradient(circle at 50% 8%, rgba(228, 191, 79, 0.14), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 40%),
    #070705;
  border: 1px solid rgba(228, 191, 79, 0.34);
  box-shadow:
    0 34px 110px rgba(0, 0, 0, 0.66),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 18px;
  isolation: isolate;
  min-height: min(78svh, 700px);
  overflow: hidden;
  padding: clamp(18px, 4vw, 34px);
  place-content: center;
  position: relative;
}

.portal-page.is-auth-screen .auth-mode-control,
.portal-page.is-auth-screen .auth-mode-panel {
  justify-self: center;
  max-width: 100%;
  width: clamp(320px, 56vw, 560px);
}

.portal-page.is-auth-screen .auth-panel::before {
  animation: authCardPulse 10s ease-in-out infinite;
  background:
    radial-gradient(circle at center, rgba(228, 191, 79, 0.12), transparent 45%),
    url("assets/dahab-app-icon.png") center / min(46vw, 360px) no-repeat;
  content: "";
  inset: 0;
  opacity: 0.18;
  position: absolute;
  z-index: -1;
}

.portal-page.is-auth-screen .auth-panel::after {
  background:
    linear-gradient(90deg, transparent, rgba(228, 191, 79, 0.36), transparent),
    linear-gradient(0deg, transparent, rgba(228, 191, 79, 0.1), transparent);
  content: "";
  height: 1px;
  inset: 0 28px auto;
  position: absolute;
  z-index: 0;
}

@supports (backdrop-filter: blur(18px)) {
  .portal-page.is-auth-screen .auth-panel {
    backdrop-filter: blur(18px);
  }
}

.auth-logo-tile {
  align-items: center;
  background:
    radial-gradient(circle at center, rgba(228, 191, 79, 0.12), transparent 54%),
    #11100d;
  border: 1px solid rgba(228, 191, 79, 0.24);
  border-radius: 8px;
  display: grid;
  min-height: clamp(150px, 28svh, 280px);
  overflow: hidden;
  place-items: center;
}

.portal-page.is-auth-screen .auth-logo-tile {
  background: none;
  border: none;
  min-height: unset;
  overflow: visible;
  padding-top: 8px;
}

.auth-logo-tile img {
  border-radius: 10px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
  height: clamp(92px, 18vw, 150px);
  object-fit: cover;
  width: clamp(92px, 18vw, 150px);
}

.portal-page.is-auth-screen .auth-logo-tile img {
  border-radius: 22px;
  box-shadow:
    0 0 0 1.5px rgba(228, 191, 79, 0.32),
    0 20px 56px rgba(0, 0, 0, 0.58);
  height: 90px;
  width: 90px;
}

.portal-page.is-auth-screen .auth-brand-title {
  color: rgba(255, 255, 255, 0.96);
  font-size: 2rem;
  font-weight: 950;
  letter-spacing: -0.025em;
  margin: 10px 0 2px;
  position: relative;
  text-align: center;
  z-index: 1;
}

.portal-page.is-auth-screen .auth-brand-subtitle {
  color: rgba(255, 255, 255, 0.44);
  font-size: 0.85rem;
  font-weight: 800;
  margin: 0 0 18px;
  position: relative;
  text-align: center;
  z-index: 1;
}

.panel-heading {
  margin-bottom: 22px;
}

.primary-auth-panel {
  box-shadow: 0 22px 58px rgba(17, 17, 15, 0.1);
}

.panel-heading h2,
.workspace-head h2 {
  font-size: clamp(1.45rem, 2.7vw, 2.5rem);
  line-height: 1.3;
  margin: 0;
}

.auth-note {
  color: var(--muted);
  line-height: 1.75;
  margin: 12px 0 0;
}

.auth-mode-control {
  background: #f0eee8;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
  padding: 4px;
}

.portal-page.is-auth-screen .auth-mode-control,
.portal-page.is-auth-screen .auth-mode-panel {
  position: relative;
  z-index: 1;
}

.portal-page.is-auth-screen .auth-mode-control {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(228, 191, 79, 0.24);
  border-radius: 999px;
  gap: 6px;
  margin-bottom: 22px;
  padding: 5px;
}

.auth-mode-control button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  min-height: 44px;
}

.portal-page.is-auth-screen .auth-mode-control button {
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.7);
  min-height: 48px;
}

.auth-mode-control button.active {
  background: var(--ink);
  color: var(--gold);
}

.portal-page.is-auth-screen .auth-mode-control button.active {
  background: linear-gradient(135deg, #e8c957, #a77c22);
  color: #11110f;
  box-shadow: 0 12px 30px rgba(228, 191, 79, 0.2);
}

.form-stack,
.form-grid {
  display: grid;
  gap: 14px;
}

.support-email-note {
  border: 1px solid rgba(228, 191, 79, 0.22);
  border-radius: 8px;
  color: var(--gold-strong);
  font-weight: 900;
  margin: 0;
  padding: 12px 14px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .wide,
.wide-surface {
  grid-column: 1 / -1;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.92rem;
  font-weight: 850;
  gap: 7px;
}

.portal-page.is-auth-screen label {
  color: rgba(255, 255, 255, 0.74);
}

.portal-page.is-auth-screen .auth-mode-panel label > span.lang,
.portal-page.is-auth-screen .business-fields legend {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

input,
select,
textarea {
  background: #f5f3ed;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  letter-spacing: 0;
  min-height: 48px;
  padding: 11px 13px;
  width: 100%;
}

.portal-page.is-auth-screen input,
.portal-page.is-auth-screen select,
.portal-page.is-auth-screen textarea {
  background: rgba(255, 255, 255, 0.065);
  border-color: rgba(228, 191, 79, 0.28);
  color: var(--white);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.portal-page.is-auth-screen input:focus,
.portal-page.is-auth-screen select:focus,
.portal-page.is-auth-screen textarea:focus {
  border-color: rgba(245, 215, 108, 0.78);
  box-shadow:
    0 0 0 3px rgba(228, 191, 79, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  outline: none;
}

.portal-page.is-auth-screen input::placeholder,
.portal-page.is-auth-screen textarea::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.portal-page.is-auth-screen select option {
  background: #11110f;
  color: var(--white);
}

.password-field {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 48px;
}

.password-field input {
  min-width: 0;
}

.password-toggle {
  background: var(--ink);
  border: 0;
  border-radius: 8px;
  color: var(--gold);
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  min-height: 48px;
}

.portal-page.is-auth-screen .password-toggle {
  background: rgba(228, 191, 79, 0.14);
  border: 1px solid rgba(228, 191, 79, 0.18);
  color: var(--gold);
}

.portal-page.is-auth-screen .form-actions .primary-action,
.portal-page.is-auth-screen #register-form > .primary-action {
  justify-content: center;
  width: 100%;
}

.portal-page.is-auth-screen .business-fields {
  border-color: rgba(228, 191, 79, 0.18);
  margin: 0;
  padding: 0;
}

@keyframes authLogoDrift {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(3vw, -2svh, 0) scale(1.035);
  }
}

@keyframes authGoldSweep {
  0%, 100% {
    transform: translateX(-4%) rotate(-8deg);
  }
  50% {
    transform: translateX(4%) rotate(-8deg);
  }
}

@keyframes authCardPulse {
  0%, 100% {
    opacity: 0.14;
    transform: scale(1);
  }
  50% {
    opacity: 0.24;
    transform: scale(1.025);
  }
}

/* ─── PWA splash screen ─────────────────────────────────────────────────── */

#pwa-splash {
  display: none;
}

@media (display-mode: standalone) {
  #pwa-splash {
    align-items: center;
    animation: splashFadeOut 2s 0.6s cubic-bezier(0.7, 0, 0.84, 0) forwards;
    background:
      radial-gradient(circle at 50% 42%, rgba(228, 191, 79, 0.12), transparent 36%),
      #11110f;
    display: grid;
    inset: 0;
    justify-items: center;
    place-content: center;
    position: fixed;
    z-index: 9999;
  }

  #pwa-splash.gone {
    display: none;
  }

  #pwa-splash img {
    border-radius: 24px;
    box-shadow:
      0 0 0 1.5px rgba(228, 191, 79, 0.28),
      0 24px 64px rgba(0, 0, 0, 0.6);
    height: 96px;
    margin-bottom: 18px;
    width: 96px;
  }

  #pwa-splash p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 2rem;
    font-weight: 950;
    letter-spacing: -0.025em;
    margin: 0;
  }

  #pwa-splash small {
    color: rgba(255, 255, 255, 0.38);
    display: block;
    font-size: 0.82rem;
    font-weight: 800;
    margin-top: 6px;
    text-align: center;
  }

  /* ─── Standalone auth screen ─────────────────────────────────────────── */
  .portal-page.is-auth-screen .portal-shell {
    padding-top: max(env(safe-area-inset-top, 0px), 24px);
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 24px);
  }

  .auth-quick-links {
    display: none;
  }

  .portal-page.is-auth-screen .auth-panel {
    min-height: calc(100svh - max(env(safe-area-inset-top, 0px), 24px) - max(env(safe-area-inset-bottom, 0px), 24px) - 40px);
  }
}

@keyframes splashFadeOut {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

textarea {
  min-height: 112px;
  resize: vertical;
}

button {
  letter-spacing: 0;
}

.form-actions,
.workspace-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.otp-step {
  background: rgba(228, 191, 79, 0.12);
  border: 1px solid rgba(143, 103, 20, 0.22);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.customer-qr-card {
  margin: 18px 0;
}

.qr-display {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: 180px minmax(0, 1fr);
  min-width: 0;
}

.qr-display img {
  aspect-ratio: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: block;
  height: auto;
  padding: 10px;
  width: 180px;
}

.qr-display b {
  color: var(--ink);
  display: block;
  font-size: clamp(1.3rem, 4vw, 2.4rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.text-action {
  background: transparent;
  border: 0;
  color: var(--mint);
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  min-height: 44px;
}

.secondary-form-action {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  min-height: 48px;
  padding: 11px 16px;
}

.phone-auth {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 16px;
}

.phone-auth summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 950;
  margin-bottom: 16px;
}

.demo-login-box {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
}

.demo-login-box p {
  color: var(--muted);
  font-weight: 900;
  margin: 0;
}

.demo-login-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.demo-login-actions button {
  background: #181713;
  border: 0;
  border-radius: 8px;
  color: var(--gold);
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  min-height: 46px;
  padding: 10px;
}

fieldset {
  border: 1px dashed var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 16px;
}

legend {
  color: var(--gold-deep);
  font-weight: 950;
  padding: 0 8px;
}

.hidden {
  display: none !important;
}

.workspace {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.workspace-head {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: clamp(18px, 3vw, 28px);
}

.workspace-head h2 {
  margin-bottom: 6px;
}

.workspace-tabs {
  background: var(--ink);
  border-radius: 8px;
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}

.workspace-tabs button {
  background: #23221e;
  border: 0;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  min-height: 62px;
  padding: 14px;
}

.workspace-tabs button.active {
  background: var(--gold);
  color: var(--ink);
}

.workspace-message {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 0;
  padding: 0;
}

.workspace-message:not(:empty) {
  background: var(--white);
  border-color: var(--line);
  padding: 14px 16px;
}

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-grid article {
  background: var(--ink);
  border-radius: 8px;
  color: var(--white);
  display: grid;
  gap: 10px;
  min-height: 128px;
  min-width: 0;
  padding: 22px;
}

.metric-grid small {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 900;
}

.metric-grid b {
  color: var(--gold);
  font-size: clamp(1.4rem, 2.8vw, 2.9rem);
  overflow-wrap: anywhere;
}

.dashboard-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.surface-list-wide {
  grid-column: 1 / -1;
}

.section-title-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title-row h3 {
  margin: 0;
}

.nearby-surface {
  overflow: hidden;
}

.partner-map-preview {
  background:
    linear-gradient(135deg, rgba(228, 191, 79, 0.28), transparent 42%),
    linear-gradient(160deg, rgba(47, 125, 106, 0.18), transparent 48%),
    #0f100d;
  border: 1px solid rgba(228, 191, 79, 0.34);
  border-radius: 8px;
  min-height: 210px;
  overflow: hidden;
  position: relative;
  margin-bottom: 12px;
}

.partner-map-preview::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  content: "";
  inset: 0;
  opacity: 0.32;
  position: absolute;
}

.map-status {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(228, 191, 79, 0.38);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 900;
  inset-inline: 12px;
  line-height: 1.5;
  padding: 9px 11px;
  position: absolute;
  top: 12px;
  z-index: 2;
}

.map-pin {
  align-items: center;
  color: var(--white);
  display: inline-flex;
  gap: 7px;
  max-width: 160px;
  position: absolute;
  text-decoration: none;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.map-pin span {
  align-items: center;
  background: var(--gold);
  border: 2px solid rgba(255, 255, 255, 0.84);
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
  color: #15130c;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 1000;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.map-pin b {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.76rem;
  line-height: 1.35;
  overflow: hidden;
  padding: 6px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nearby-record {
  background: #fbfaf6;
}

.surface-list h3 {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.4;
  margin: 0 0 18px;
}

.surface-list .section-title-row h3 {
  margin: 0;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record {
  background: #f6f4ee;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 13px;
}

.record-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.record strong {
  font-size: 1rem;
  line-height: 1.5;
}

.record p,
.record small,
.merchant-state p,
.admin-gate p {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
}

.partner-offers {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.partner-offer {
  align-items: center;
  background: rgba(228, 191, 79, 0.08);
  border: 1px solid rgba(228, 191, 79, 0.22);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 7px 10px;
}

.partner-offer-title {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.partner-offers-empty {
  display: block;
  margin-top: 6px;
  opacity: 0.7;
}

.mini-action {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 950;
  min-height: 38px;
  padding: 7px 11px;
}

.mini-action.primary {
  background: var(--gold);
  border-color: var(--gold);
}

.mini-action.danger {
  color: var(--clay);
}

.tag {
  background: rgba(47, 125, 106, 0.12);
  border-radius: 8px;
  color: var(--mint);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 950;
  padding: 6px 8px;
  white-space: nowrap;
}

.tag.pending {
  background: rgba(228, 191, 79, 0.22);
  color: var(--gold-deep);
}

.tag.suspended,
.tag.rejected {
  background: rgba(179, 79, 66, 0.13);
  color: var(--clay);
}

.merchant-state {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.merchant-state b {
  color: var(--gold-deep);
  font-size: clamp(1.35rem, 3vw, 2.5rem);
}

.admin-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-grid {
  margin-top: 12px;
}

.admin-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.admin-filter-chip {
  align-items: center;
  background: rgba(17, 16, 12, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 950;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
}

.admin-filter-chip b {
  background: rgba(228, 191, 79, 0.22);
  border-radius: 999px;
  color: var(--gold-deep);
  font-size: 0.78rem;
  min-width: 28px;
  padding: 3px 8px;
  text-align: center;
}

.admin-filter-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--gold);
}

.admin-filter-chip.active b {
  background: var(--gold);
  color: var(--ink);
}

.admin-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}

.admin-table {
  border-collapse: collapse;
  min-width: 780px;
  width: 100%;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.55;
  padding: 11px 12px;
  text-align: start;
  vertical-align: top;
}

.admin-table th {
  background: #11100c;
  color: var(--gold);
  font-weight: 950;
  padding: 0;
  white-space: nowrap;
}

.admin-table th > span,
.admin-sort {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  display: inline-flex;
  font: inherit;
  gap: 5px;
  justify-content: flex-start;
  min-height: 48px;
  padding: 11px 12px;
  text-align: start;
  width: 100%;
}

.admin-sort {
  cursor: pointer;
}

.admin-sort:hover,
.admin-sort:focus-visible,
.admin-sort.active {
  background: rgba(228, 191, 79, 0.12);
  outline: none;
}

.admin-sort-indicator {
  color: #f7d86a;
  font-size: 0.82rem;
  min-width: 1.3em;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table td {
  background: rgba(255, 255, 255, 0.82);
}

.table-number {
  color: var(--gold-deep);
  display: inline-block;
  font-weight: 950;
  white-space: nowrap;
}

.table-status {
  color: var(--muted);
  display: inline-block;
  font-weight: 900;
  white-space: nowrap;
}

.table-status.active,
.table-status.approved,
.table-status.redeemed {
  color: var(--gold-deep);
}

.table-status.suspended,
.table-status.rejected {
  color: var(--clay);
}

.table-actions {
  gap: 6px;
  margin: 0;
}

.table-actions .mini-action {
  min-height: 32px;
  padding: 5px 9px;
}

.support-modal {
  align-items: center;
  background: rgba(5, 5, 4, 0.58);
  display: grid;
  inset: 0;
  padding: 18px;
  position: fixed;
  z-index: 50;
}

.support-modal-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: auto;
  max-height: min(760px, 90svh);
  overflow: auto;
  padding: 20px;
  width: min(100%, 760px);
}

.support-modal-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
}

.support-modal-head h2 {
  margin: 0;
}

.support-detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.support-detail-grid article,
.support-message-body {
  background: rgba(244, 241, 233, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.support-detail-grid small,
.support-message-body small {
  color: var(--muted);
  display: block;
  font-weight: 900;
  margin-bottom: 5px;
}

.support-message-body {
  line-height: 1.9;
  margin-top: 12px;
  white-space: pre-wrap;
}

.support-resolve-form {
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
}

.support-resolve-notes {
  background: rgba(244, 241, 233, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.65;
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}

.support-resolve-btn {
  align-self: flex-start;
}

.check-row {
  align-items: center;
  display: flex;
  gap: 9px;
}

.check-row input {
  min-height: 20px;
  width: 20px;
}

@media (max-width: 960px) {
  .support-detail-grid {
    grid-template-columns: 1fr;
  }

  .portal-shell {
    padding-inline: 18px;
  }

  .portal-intro,
  .auth-shell,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .portal-mark {
    min-height: 140px;
  }

  .portal-mark img {
    height: 120px;
    width: 120px;
  }

  .metric-grid,
  .admin-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .portal-page.is-auth-screen .portal-shell {
    padding: 18px 12px;
  }

  .portal-page.is-auth-screen .auth-panel {
    min-height: calc(100svh - 36px);
  }

  .form-grid,
  .metric-grid,
  .admin-metrics,
  .demo-login-actions {
    grid-template-columns: 1fr;
  }

  .workspace-head,
  .merchant-state {
    align-items: start;
    flex-direction: column;
  }

  .workspace-tabs {
    grid-template-columns: 1fr;
  }

  .qr-display {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

/* ─── Wallet card ────────────────────────────────────────────────────────── */

.customer-wallet-card {
  background:
    linear-gradient(135deg,
      #080807 0%,
      #111110 28%,
      #2e2509 62%,
      #7a5514 88%,
      #a97a1e 100%);
  border-radius: 18px;
  color: #fff;
  min-height: 190px;
  overflow: hidden;
  padding: 20px 22px;
  position: relative;
}

.customer-wallet-card:empty {
  display: none;
}

.wallet-card-circles {
  border-radius: 50%;
  content: "";
  pointer-events: none;
  position: absolute;
}

.wallet-card-circles::before,
.wallet-card-circles::after {
  border-radius: 50%;
  content: "";
  position: absolute;
}

.customer-wallet-card::before {
  border: 34px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  content: "";
  height: 164px;
  left: -56px;
  pointer-events: none;
  position: absolute;
  top: 114px;
  width: 164px;
}

.customer-wallet-card::after {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  content: "";
  height: 176px;
  pointer-events: none;
  position: absolute;
  right: -50px;
  top: -82px;
  width: 176px;
}

.wallet-card-row {
  align-items: center;
  display: flex;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.wallet-card-top { margin-bottom: 4px; }
.wallet-card-mid {
  align-items: baseline;
  margin-bottom: 6px;
}
.wallet-card-bottom {
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 6px;
  padding-top: 10px;
}

.wallet-card-mark {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #e4bf4f;
  display: flex;
  font-size: 1.1rem;
  font-weight: 950;
  height: 42px;
  justify-content: center;
  min-width: 42px;
  width: 42px;
}

.wallet-card-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wallet-card-brand {
  color: #e4bf4f;
  font-size: 1.05rem;
  font-weight: 950;
}

.wallet-card-holder {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.88rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-card-pts-value {
  color: #fff;
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
}

.wallet-card-pts-label {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.88rem;
  font-weight: 600;
}

.wallet-card-code-label {
  color: rgba(255, 255, 255, 0.88);
  font-size: 1rem;
  font-weight: 900;
}

.wallet-card-code {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Business offers section (customer view) ────────────────────────────── */

.biz-offers-grid {
  display: grid;
  gap: 10px;
}

.biz-card {
  background: var(--surface, #f5f3ed);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.biz-card-head {
  align-items: baseline;
  background: var(--ink);
  color: #e4bf4f;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 8px 12px;
}

.biz-card-head strong { font-size: 0.9rem; font-weight: 950; }
.biz-card-head small  { color: rgba(228, 191, 79, 0.62); font-size: 0.78rem; }

.biz-offer-row {
  border-top: 1px solid var(--line);
  padding: 8px 12px;
}

.biz-offer-row:first-of-type { border-top: none; }

.biz-offer-info {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.biz-offer-title {
  font-size: 0.88rem;
  font-weight: 900;
}

.biz-offer-pts {
  background: rgba(228, 191, 79, 0.14);
  border: 1px solid rgba(228, 191, 79, 0.28);
  border-radius: 999px;
  color: var(--gold-deep);
  font-size: 0.78rem;
  font-weight: 900;
  padding: 2px 8px;
  white-space: nowrap;
}

.biz-offer-details {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 4px 0 0;
}

.offer-exp {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  margin-top: 3px;
}

/* ─── Input-with-scan (QR scan button inline with input) ─────────────────── */

.input-with-scan {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.scan-btn {
  align-items: center;
  background: var(--ink);
  border: 0;
  border-radius: 8px;
  color: #e4bf4f;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-size: 0.7rem;
  font-weight: 900;
  gap: 4px;
  justify-content: center;
  min-height: 48px;
  padding: 6px 12px;
}

.scan-btn:hover { background: #1e1d1a; }

/* ─── QR scanner overlay ─────────────────────────────────────────────────── */

.qr-scanner-overlay {
  align-items: center;
  background: rgba(0, 0, 0, 0.84);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 10000;
}

.qr-scanner-overlay.hidden { display: none !important; }

.qr-scanner-card {
  background: #11110f;
  border: 1px solid rgba(228, 191, 79, 0.3);
  border-radius: 16px;
  max-width: 420px;
  overflow: hidden;
  width: 100%;
}

.qr-scanner-head {
  align-items: center;
  border-bottom: 1px solid rgba(228, 191, 79, 0.18);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 18px;
}

.qr-scanner-head h3 {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 950;
  margin: 0;
}

.qr-scanner-head button {
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  min-height: 32px;
  min-width: 32px;
  padding: 4px 8px;
}

.qr-scanner-viewport {
  aspect-ratio: 1;
  background: #000;
  overflow: hidden;
  position: relative;
  width: 100%;
}

#qr-video {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.qr-aim {
  border: 2px solid rgba(228, 191, 79, 0.8);
  border-radius: 6px;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.38);
  height: 54%;
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 54%;
}

.qr-hint {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.84rem;
  margin: 0;
  padding: 12px 18px 14px;
  text-align: center;
}

/* ===== Unified theme overrides — match the new landing (CSS only, no JS changes) ===== */
.portal-page,
.portal-page input,
.portal-page button,
.portal-page select,
.portal-page textarea { font-family: 'Tajawal', system-ui, sans-serif; }

/* golden starfield behind the auth screen */
#stars { position: fixed; inset: 0; z-index: 0; display: block; background: #000; pointer-events: none; }
.portal-page.is-auth-screen { background: #000; }
.portal-page.is-auth-screen .portal-shell { background: transparent; }
.portal-page header, .portal-page main, .portal-shell, #pwa-splash { position: relative; z-index: 1; }

/* gold-gradient primary buttons to match the homepage */
.portal-page .primary-action,
.portal-page .mini-action.primary {
  background: linear-gradient(135deg, #FCEFB4, #C9982E) !important;
  color: #1a1306 !important;
  border: 0 !important;
  box-shadow: 0 8px 28px rgba(201, 152, 46, 0.32);
}

/* ============================================================================
   Dahab portal — DARK + GOLD theme to match the phone app (no more white
   surfaces). Re-scopes --ink to light inside the formerly-light cards so their
   text flips to light while gold accents (var(--gold)) stay gold; backgrounds
   are forced dark. The QR image stays white so it remains scannable.
   ============================================================================ */
.portal-page {
  background:
    radial-gradient(circle at 50% 14%, rgba(232, 199, 90, 0.09), transparent 46%),
    #080807 !important;
}
.portal-page .auth-panel,
.portal-page .surface-list,
.portal-page .workspace-head,
.portal-page .merchant-state,
.portal-page .admin-gate,
.portal-page .secondary-form-action,
.portal-page .workspace-message:not(:empty),
.portal-page .nearby-record,
.portal-page .record,
.portal-page .mini-action,
.portal-page .support-modal-card,
.portal-page .biz-card,
.portal-page .auth-mode-control,
.portal-page .map-status,
.portal-page .map-pin b {
  --ink: #FBF8F0;
  background: #121110 !important;
  border-color: rgba(232, 199, 90, 0.16) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}
.portal-page input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.portal-page select,
.portal-page textarea {
  --ink: #FBF8F0;
  background: #1a1812 !important;
  color: #FBF8F0 !important;
  border-color: rgba(232, 199, 90, 0.22) !important;
}
.portal-page input::placeholder,
.portal-page textarea::placeholder { color: rgba(251, 248, 240, 0.42) !important; }
.portal-page select option { background: #121110; color: #FBF8F0; }
.portal-page .admin-table td,
.portal-page .admin-table th {
  --ink: #FBF8F0;
  background: #121110 !important;
  border-color: rgba(232, 199, 90, 0.14) !important;
}
.portal-page .admin-table tr:nth-child(even) td { background: #15140f !important; }
.portal-page .qr-display img { background: #fff !important; } /* keep the QR white to scan */
