:root {
  --gold: #fec013;
  --gold-dark: #c99408;
  --radius: 26px;
  --radius-sm: 16px;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.4);
  --hair: 1px;
}
[data-theme="dark"] {
  --ink: #101418;
  --surface: #101418;
  --card: rgba(255, 255, 255, 0.06);
  --card-2: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f9fafb;
  --muted: rgba(249, 250, 251, 0.62);
  --danger: #ef4444;
  --success: #22c55e;
  --app-bg: radial-gradient(circle at top, rgba(254,192,19,.14), transparent 32%), linear-gradient(160deg, #161b22 0%, #07090d 100%);
}
[data-theme="light"] {
  --ink: #1a1407;
  --surface: #f7f4ee;
  --card: #ffffff;
  --card-2: #fbf8f2;
  --border: rgba(20, 16, 7, 0.08);
  --text: #211b0e;
  --muted: rgba(33, 27, 14, 0.58);
  --danger: #dc2626;
  --success: #16a34a;
  --app-bg: radial-gradient(circle at top, rgba(254,192,19,.16), transparent 30%), linear-gradient(160deg, #fdfbf6 0%, #f1ebdf 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--surface); color: var(--text); font-family: "Tajawal", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; transition: background-color .3s ease, color .3s ease; touch-action: pan-x pan-y; }

/* App shell */
.visit-app { height: 100dvh; display: flex; align-items: stretch; justify-content: center; background: var(--app-bg); overflow: hidden; touch-action: pan-x pan-y; }
.app-shell { width: 100%; max-width: 480px; height: 100dvh; display: flex; flex-direction: column; background: var(--card); position: relative; overflow: hidden; }
@media (min-width: 521px) { .app-shell { border-inline: var(--hair) solid var(--border); backdrop-filter: blur(20px); box-shadow: var(--shadow); } }
.app-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--card); z-index: 5; border-bottom: var(--hair) solid var(--border); }
.app-back { width: 38px; height: 38px; flex: none; border-radius: 999px; border: var(--hair) solid var(--border); background: var(--card-2); color: var(--text); font-size: 26px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0 0 3px 0; font-family: inherit; }
.app-back:hover { background: var(--border); }
body[dir="rtl"] .app-back { transform: scaleX(-1); }
.app-back-spacer { width: 38px; flex: none; }
.app-brand { display: flex; align-items: center; gap: 10px; }
.app-logo { width: 32px; height: 32px; border-radius: 10px; background: var(--gold); color: var(--ink); display: grid; place-items: center; font-weight: 900; font-size: 16px; }
.app-brand-name { font-size: 16px; font-weight: 800; letter-spacing: .01em; }
.app-content { flex: 1; overflow: hidden; padding: 16px 18px; display: flex; flex-direction: column; justify-content: flex-start; }
.app-actions { padding: 12px 18px; padding-bottom: calc(max(12px, env(safe-area-inset-bottom)) + var(--keyboard-offset, 0px)); background: var(--card); border-top: var(--hair) solid var(--border); display: grid; gap: 8px; transition: padding-bottom .15s ease; }
.topbar { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.lang-toggle { border: var(--hair) solid var(--border); background: var(--card-2); color: var(--text); font-weight: 800; font-size: 12px; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-family: inherit; }
.lang-toggle:hover { background: var(--border); }
.theme-btn { width: 34px; height: 34px; border-radius: 999px; border: var(--hair) solid var(--border); background: var(--card-2); color: var(--text); cursor: pointer; font-size: 16px; display: grid; place-items: center; line-height: 1; font-family: inherit; }

/* Content */
.visit-step { display: inline-flex; align-items: center; gap: 8px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
h1 { margin: 0 0 8px; font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
h1::after { content: ""; display: block; width: 30px; height: 3px; border-radius: 999px; background: var(--gold); margin-top: 10px; }
p { line-height: 1.55; margin: 0; }
.muted { color: var(--muted); }
.property { border: var(--hair) solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin: 14px 0; background: var(--card-2); }
.property-title { font-weight: 800; margin-bottom: 8px; }
.property-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; color: var(--muted); font-size: 14px; }
body[dir="rtl"] .property-grid { text-align: right; }
.field { margin: 14px 0; }
.phone-row { display: flex; border: var(--hair) solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--card-2); }
.phone-prefix { padding: 16px 14px; border-inline-end: 1px solid var(--border); color: var(--text); font-weight: 800; }
input, textarea { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); padding: 16px; font: inherit; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .6; }
.otp-brand { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 8px auto 14px; padding: 8px 12px; border-radius: 999px; background: rgba(37, 211, 102, 0.12); color: #25d366; font-size: 13px; font-weight: 800; }
.otp-brand-icon { width: 22px; height: 22px; border-radius: 999px; display: inline-grid; place-items: center; background: #25d366; color: #fff; font-size: 12px; }
.otp { display: flex; gap: 8px; direction: ltr; justify-content: center; margin: 16px 0 8px; }
.otp input { width: 44px; height: 54px; text-align: center; border: var(--hair) solid var(--border); border-radius: 14px; font-size: 22px; background: var(--card-2); }
.otp-meta { display: grid; gap: 6px; margin: 8px 0 0; color: var(--muted); font-size: 13px; text-align: center; justify-items: center; }
.otp-meta span:first-child { color: var(--gold); font-weight: 800; }
.otp-state { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 24px; color: var(--gold); font-weight: 700; font-size: 13px; }
.mini-spin { width: 14px; height: 14px; border: 2px solid rgba(254,192,19,.25); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.btn { width: 100%; min-height: 54px; border: 0; border-radius: var(--radius-sm); padding: 14px 20px; background: var(--gold); color: var(--ink); font-weight: 900; font-size: 16px; cursor: pointer; transition: opacity .15s ease, transform .05s ease; font-family: inherit; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--card-2); color: var(--text); border: var(--hair) solid var(--border); }
.btn.danger { background: rgba(239,68,68,.14); color: var(--danger); border: var(--hair) solid rgba(239,68,68,.35); }
.alert { border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px 0; background: var(--card-2); border: var(--hair) solid var(--border); }
.warn-alert { display: flex; gap: 10px; align-items: flex-start; background: rgba(254,192,19,.1); border-color: rgba(254,192,19,.28); color: var(--gold-dark); }
[data-theme="dark"] .warn-alert { color: #f1c453; }
.warn-alert .alert-icon { flex: none; font-size: 16px; line-height: 1.5; }
.rec-chip { display: inline-flex; align-items: center; gap: 7px; margin: 12px 0 4px; padding: 7px 13px; border-radius: 999px; background: var(--card-2); border: var(--hair) solid var(--border); color: var(--muted); font-size: 12px; }
.rec-chip .rec-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--danger); animation: recblink 1.4s infinite; }
.error { color: var(--danger); border-color: rgba(239,68,68,.35); }
.success { color: var(--success); border-color: rgba(34,197,94,.32); }
.geo-notice { color: var(--gold-dark); background: rgba(254,192,19,.1); border-color: rgba(254,192,19,.25); font-size: 13px; }
.loc-icon { font-size: 56px; text-align: center; margin: 18px 0 8px; }

/* Reusable step hero */
.step-hero { position: relative; min-height: 170px; display: grid; place-items: center; margin: clamp(12px, 7vh, 72px) 0 18px; }
.step-hero-aura { position: absolute; inset: 50% auto auto 50%; width: 180px; height: 180px; transform: translate(-50%, -50%); border-radius: 999px; background: radial-gradient(circle, rgba(254,192,19,.18) 0%, rgba(254,192,19,.06) 34%, transparent 72%); filter: blur(6px); opacity: .95; }
.step-hero-frame { position: relative; width: 168px; height: 168px; border-radius: 999px; display: grid; place-items: center; color: var(--gold); border: 1px solid rgba(254,192,19,.14); background: radial-gradient(circle at center, rgba(255,255,255,.02), transparent 70%); }
.step-hero-frame::before,
.step-hero-frame::after { content: ""; position: absolute; border-radius: 999px; border: 1px solid rgba(254,192,19,.14); }
.step-hero-frame::before { inset: 18px; }
.step-hero-frame::after { inset: 34px; }
.step-hero-svg { width: 88px; height: 88px; display: block; position: relative; z-index: 2; }

/* Official info cards (step 4) */
.official-card {
  border: var(--hair) solid rgba(254,192,19,.32);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(254,192,19,.07), var(--card-2));
  padding: 14px 16px;
  margin: 10px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.official-card .official-icon {
  width: 46px; height: 46px; margin: 0 auto 8px;
  border-radius: 999px; display: grid; place-items: center;
  background: var(--gold); color: var(--ink); font-size: 22px;
}
.official-card .official-icon.shield { position: relative; }
.official-card .official-icon.shield::after {
  content: ""; position: absolute; inset: -5px; border-radius: 999px;
  border: 2px solid var(--gold); opacity: .55; animation: shieldPulse 2.4s ease-out infinite;
}
.official-label { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.official-value {
  font-size: 28px; font-weight: 900; color: var(--gold); letter-spacing: .02em;
  margin: 4px 0; direction: ltr; display: inline-block;
  background: linear-gradient(100deg, var(--gold) 30%, #fff6cf 50%, var(--gold) 70%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; text-decoration: none;
}
a.official-value { cursor: pointer; }
.official-hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
[data-theme="light"] .official-value { background: linear-gradient(100deg, #c99408 30%, #f1c453 50%, #c99408 70%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.shimmer { animation: shimmer 2.6s linear infinite; }
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes shieldPulse { 0% { transform: scale(.92); opacity: .6; } 70% { transform: scale(1.35); opacity: 0; } 100% { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); filter: blur(3px); } to { opacity: 1; transform: translateY(0); filter: blur(0); } }
.fade-up { animation: fadeUp .55s cubic-bezier(.22,.61,.36,1) both; }
@media (prefers-reduced-motion: reduce) {
  .fade-up { animation: none; }
  .shimmer { animation: none; }
  .official-card .official-icon.shield::after { animation: none; opacity: 0; }
  .check input:checked + .check-box { animation: none; }
}
.check { display: flex; align-items: flex-start; gap: 12px; margin: 16px 0 2px; cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-box {
  width: 24px; height: 24px; flex: none; margin-top: 1px;
  border: var(--hair) solid var(--border); border-radius: 7px;
  background: var(--card-2); position: relative;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.check input:focus-visible + .check-box { box-shadow: 0 0 0 3px rgba(254,192,19,.35); }
.check input:checked + .check-box {
  border-color: var(--gold);
  background: linear-gradient(120deg, #fec013 0%, #f1c453 35%, #fff6cf 50%, #f1c453 65%, #fec013 100%);
  background-size: 250% 100%;
  animation: gradSweep 2.4s linear infinite;
}
.check input:checked + .check-box::after {
  content: ""; position: absolute; left: 8px; top: 3px; width: 6px; height: 12px;
  border: solid #1a1407; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
  animation: checkPop .28s cubic-bezier(.22,.61,.36,1);
}
.check-text { font-size: 14px; line-height: 1.55; padding-top: 2px; }
@keyframes gradSweep { 0% { background-position: 130% 0; } 100% { background-position: -130% 0; } }
@keyframes checkPop { from { opacity: 0; transform: rotate(45deg) scale(.3); } to { opacity: 1; transform: rotate(45deg) scale(1); } }
.pulse { width: 100px; height: 100px; margin: 10px auto; border-radius: 999px; display: grid; place-items: center; background: rgba(254,192,19,.12); position: relative; }
.pulse:before, .pulse:after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(254,192,19,.4); border-radius: inherit; animation: pulse 1.8s infinite; }
.pulse:after { animation-delay: .7s; }
.pulse-core { width: 70px; height: 70px; border-radius: inherit; background: var(--gold); color: var(--ink); display: grid; place-items: center; font-size: 30px; z-index: 1; }
@keyframes pulse { to { transform: scale(1.5); opacity: 0; } }
.video-wrap { position: relative; margin: 12px 0; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 4 / 5; background: linear-gradient(180deg, rgba(254,192,19,.08), rgba(16,20,24,.88)); }
video { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); background: #000; display: block; }
.agent-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; background: linear-gradient(180deg, rgba(16,20,24,.92), rgba(7,9,13,.96)); color: #f9fafb; z-index: 1; }
.agent-avatar { width: 96px; height: 96px; border-radius: 999px; display: grid; place-items: center; background: linear-gradient(160deg, var(--gold), #f1c453); color: var(--ink); font-size: 42px; font-weight: 900; box-shadow: 0 14px 34px rgba(254,192,19,.22); }
.agent-title { font-size: 18px; font-weight: 800; }
.agent-sub { color: rgba(249,250,251,.68); font-size: 13px; line-height: 1.55; max-width: 260px; }
.local-video { position: absolute; bottom: 10px; inset-inline-end: 10px; width: 108px; height: 80px; object-fit: cover; border: 2px solid rgba(255,255,255,.5); border-radius: 12px; z-index: 2; max-height: none; }
.reconnect-banner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(7,9,13,.82); color: #f9fafb; font-size: 14px; font-weight: 700; text-align: center; padding: 16px; z-index: 3; }
.reconnect-banner .btn { width: auto; min-height: 0; padding: 10px 18px; font-size: 14px; }
.call-status { display: flex; align-items: center; gap: 8px; color: var(--gold); font-weight: 700; font-size: 14px; margin: 10px 0 4px; }
.call-status::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; animation: recblink 1.4s infinite; }
.call-timer { color: var(--muted); font-size: 13px; font-weight: 700; margin: 4px 0 6px; direction: ltr; }
.call-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 4px; }
.call-controls .btn { width: auto; min-height: 0; padding: 9px 14px; font-size: 13px; }
.access-code { font-size: 42px; letter-spacing: 6px; font-weight: 900; text-align: center; direction: ltr; padding: 18px; border-radius: var(--radius-sm); background: var(--card-2); color: var(--success); border: var(--hair) solid rgba(34,197,94,.3); }
.access-expiry { text-align: center; margin: 10px 0 0; }
.visit-spinner { width: 40px; height: 40px; border: 3px solid rgba(254,192,19,.2); border-top-color: var(--gold); border-radius: 50%; animation: spin .9s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes recblink { 50% { opacity: 0.25; } }
.visit-loading { text-align: center; margin: auto; }
@media (max-width: 520px) { .property-grid { grid-template-columns: 1fr; } .call-controls { flex-direction: column; align-items: stretch; } .call-controls .btn { width: 100%; } .local-video { width: 88px; height: 66px; } .app-content { padding: 14px 16px; } .app-actions { padding: 10px 16px; } h1 { font-size: 20px; } .official-value { font-size: 25px; } .agent-avatar { width: 84px; height: 84px; font-size: 36px; } .step-hero { min-height: 146px; margin: clamp(10px, 5vh, 46px) 0 14px; } .step-hero-aura { width: 150px; height: 150px; } .step-hero-frame { width: 140px; height: 140px; } .step-hero-svg { width: 74px; height: 74px; } }
