/* Thara bronze theme: layout, doorway background and every visible component. */
:root {
  color-scheme: dark;
  --bg: #17110c;
  --field: #241b13;
  --field-soft: #271d148c;
  --border: #d8b67d40;
  --text: #f5ecdd;
  --muted: #bfae95;
  --accent: #dfbd88;
  --accent-strong: #edd2a8;
  --danger: #f3b2a2;
  --ok: #b8d0a4;
  --warn: #e6c591;
  --focus-ring: 0 0 0 3px #d9b47a10;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
html { min-height: 100%; height: auto; }
body {
  min-height: 100svh; display: flex; align-items: center; justify-content: flex-end;
  padding: 125px 6% 105px; background: var(--bg); position: relative; isolation: isolate;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
svg { height: 24px; width: 24px; display: block; flex-shrink: 0; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1:focus { outline: none; }

/* ---- Doorway background ---- */
.stage { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.stage picture, .stage img, .shade, .ambient { position: absolute; width: 100%; height: 100%; inset: 0; }
.stage img { object-fit: cover; object-position: center; }
.shade { background: linear-gradient(90deg, #0e0a0708 24%, #0e0a071a 46%, #0e0a07ed 70%, #0e0a07fa), linear-gradient(0deg, #0e0a07b3, transparent 20%, transparent 80%, #0e0a0766); }
.ambient { background: radial-gradient(ellipse at 30% 50%, #daa75214, transparent 55%); animation: breathe 8s ease-in-out infinite alternate; }
@keyframes breathe { to { opacity: .25; } }

/* ---- Header, footer, quiet links ---- */
.header { position: absolute; top: 0; left: 0; right: 0; padding: 34px 4%; display: flex; align-items: center; justify-content: space-between; z-index: 2; }
.wordmark { display: flex; gap: 16px; align-items: center; color: var(--text); text-decoration: none; }
.wordmark svg { width: 44px; height: 36px; fill: #deba83; }
.wordmark > span { font-size: 14px; letter-spacing: .22em; font-weight: 500; }
.wordmark small { display: block; font-size: 9px; letter-spacing: .34em; color: #d1ba98; margin-top: 3px; }
.quiet { width: auto; margin: 0; padding: 8px 0; background: none; border: 0; border-radius: 0; color: var(--muted); font-size: 12px; font-weight: 400; transition: color .2s; }
.quiet:hover:not(:disabled) { background: none; color: var(--text); }
.preview { display: flex; align-items: center; gap: 9px; }
.preview svg { width: 16px; height: 16px; }
.page-footer { position: absolute; bottom: 26px; left: 4%; right: 4%; display: flex; justify-content: space-between; align-items: center; font-size: 9px; letter-spacing: .15em; color: #bca688; }
.page-footer i { font-style: normal; margin: 0 9px; color: #dbc49e; }
.page-footer .quiet { letter-spacing: normal; font-size: 11px; }

/* ---- Login column ---- */
.login-shell { width: 370px; max-width: 100%; animation: appear .8s var(--ease) both; }
@keyframes appear { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--accent); font-size: 10px; letter-spacing: .26em; margin-bottom: 15px; }
.eyebrow span { height: 1px; width: 21px; background: var(--accent); }
h1 { font-size: clamp(30px, 3vw, 42px); font-weight: 400; line-height: 1.2; letter-spacing: -.055em; margin: 0 0 30px; }
h1 .dot { color: var(--accent); }
p.lead { font-size: 13px; line-height: 1.65; margin: 0 0 22px; }
label { font-size: 12px; }

/* Contact switch (email / mobile) */
.segmented.contact-switch { width: 138px; border-radius: 30px; padding: 4px; gap: 0; background: #09070566; border-color: var(--border); margin-bottom: 19px; }
.contact-switch button { height: 39px; padding: 0; border-radius: 24px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.contact-switch button[aria-pressed=true] { color: #2b2012; background: linear-gradient(140deg, #eed8b3, #c6a06c); box-shadow: inset 0 1px 0 #fff5; }
.contact-switch svg { width: 21px; height: 21px; }

/* Hover and focus tooltips on the icon buttons */
.segmented button { position: relative; }
.segmented button::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  background: var(--field); color: var(--text); font-family: inherit; font-size: 13px; font-weight: 500; line-height: 18px; letter-spacing: 0; white-space: nowrap; padding: 8px 12px; border-radius: 9px; border: 0;
  box-shadow: 0 8px 24px rgb(0 0 0 / .22), 0 2px 6px rgb(0 0 0 / .12);
  pointer-events: none; opacity: 0; transition: opacity 140ms ease-out; z-index: 5;
}
.segmented button[data-tip]:not([data-tip-dismissed]):hover::after, .segmented button[data-tip]:not([data-tip-dismissed]):focus-visible::after { opacity: 1; }
@media (forced-colors: active) { .segmented button::after { background: Canvas; color: CanvasText; border: 1px solid CanvasText; box-shadow: none; } }

/* Text fields */
input[type=email], input[type=tel], input[type=password], input[type=text].pwtext, input.plainnum {
  height: 56px; border-radius: 13px; font-family: inherit; font-size: 14px; background: var(--field-soft);
  border-color: var(--border); padding-left: 17px; color: var(--text);
}
input::placeholder { color: #b9a88f; }
input[type=email]:focus, input[type=tel]:focus, input[type=password]:focus, input[type=text].pwtext:focus, input.plainnum:focus { border-color: #d9b47aaa; box-shadow: var(--focus-ring); }
input.plainnum.text { font-variant-numeric: normal; }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 1000px #2a2017 inset; }
#email, #password, #totp, #new-password, #confirm-password { padding-left: 49px; background-repeat: no-repeat; background-position: 17px center; background-size: 20px; }
#email { background-image: url('/auth-assets/assets/email.svg'); }
#password, #new-password, #confirm-password { background-image: url('/auth-assets/assets/lock.svg'); }
#totp { background-image: url('/auth-assets/assets/shield.svg'); letter-spacing: .08em; }

/* Saudi mobile: fixed +966 prefix, national number typed after it */
.phone-field { display: flex; align-items: center; height: 56px; border: 1px solid var(--border); border-radius: 13px; background: var(--field-soft); transition: border-color .15s, box-shadow .15s; }
.phone-field:focus-within { border-color: #d9b47aaa; box-shadow: var(--focus-ring); }
.phone-field.invalid { border-color: var(--danger); }
.phone-field .dial { display: flex; align-items: center; gap: 11px; height: 26px; margin: 0; padding: 0 13px 0 17px; border-right: 1px solid var(--border); color: var(--text); font-size: 14px; letter-spacing: .03em; cursor: text; user-select: none; font-variant-numeric: tabular-nums; }
.phone-field .dial svg { width: 20px; height: 20px; color: #ccb693; }
.phone-field #phone { flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0 14px 0 13px; border: 0; background: transparent; box-shadow: none; letter-spacing: .06em; font-variant-numeric: tabular-nums; }

/* First-factor icons */
.factor-row { margin: 19px 0; }
#factor-switch { display: grid; width: 100%; grid-template-columns: repeat(4, 1fr); gap: 13px; padding: 0; border: 0; background: transparent; margin: 0; }
#factor-switch button { height: 62px; border-radius: 13px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; background: #1f181199; color: var(--muted); padding: 0; transition: background .25s, transform .25s, opacity .2s; }
#factor-switch button:hover:not(:disabled) { transform: translateY(-2px); background: #d9b47a13; }
#factor-switch button[aria-pressed=true] { color: #f0d5a5; border-color: #d9b47a9c; background: linear-gradient(135deg, #d9b47a26, #d9b47a08); box-shadow: inset 0 1px 0 #f5d9ac12; }
#factor-switch button:disabled { opacity: .35; }
#factor-switch svg { width: 25px; height: 25px; }

.eye { right: 7px; padding: 10px; background: transparent !important; color: var(--muted); }
.eye svg { width: 20px; height: 20px; }
.eye.revealed { color: var(--text); }

/* Face ID camera */
.camera { border-color: var(--border); border-radius: 13px; background: #0c0906; }
.camera-guide { border-color: #dfbd8899; }
.camera.captured .camera-guide { border-color: var(--accent); }
.camera-msg { left: 50%; right: auto; bottom: 12px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 6px 12px; border-radius: 20px; font-size: 11px; background: #17110cc4; color: var(--text); backdrop-filter: blur(6px); }
.camera-actions { display: flex; gap: 10px; }
.camera-actions button { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; height: 44px; border-radius: 12px; font-size: 12px; }
.camera-actions svg { width: 18px; height: 18px; }
#block-face .hint { margin: 10px 0 0; font-size: 11px; line-height: 1.5; }

/* Passkey panel */
.passkey-box { padding: 16px; border-color: var(--border); background: var(--field-soft); border-radius: 13px; }
.passkey-box strong { font-size: 13px; font-weight: 500; }
.passkey-box .hint { margin: 4px 0 0; font-size: 12px; }
.passkey-icon svg { width: 28px; height: 28px; }

/* Primary buttons */
#btn-send, #btn-verify, #btn-setup-confirm, #btn-face-confirm, #btn-passkey-register {
  height: 56px; margin-top: 22px; border-radius: 13px; background: linear-gradient(115deg, #f2ddbb, #d5af76 75%, #e4c38e);
  color: #2e2113; display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  box-shadow: inset 0 1px 0 #fff7; transition: transform .2s, box-shadow .2s, opacity .2s; font-size: 14px;
}
#btn-send::after, #btn-verify::after, #btn-setup-confirm::after, #btn-face-confirm::after, #btn-passkey-register::after { content: '⟶'; font-size: 23px; font-weight: 400; }
#btn-send:hover:not(:disabled), #btn-verify:hover:not(:disabled), #btn-setup-confirm:hover:not(:disabled), #btn-face-confirm:hover:not(:disabled), #btn-passkey-register:hover:not(:disabled) { transform: translateY(-1px); box-shadow: inset 0 1px 0 #fff7, 0 5px 30px #d9b47a26; }
.ghost:hover:not(:disabled) { background: #d9b47a15; }
.ghost.primary:hover:not(:disabled) { background: #d9b47a22; }

/* Forgot password */
.forgot-row { display: flex; justify-content: flex-end; margin-top: 9px; }
.forgot-row .link { font-size: 11px; font-weight: 400; color: var(--muted); }
.forgot-row .link:hover:not(:disabled) { color: var(--text); text-decoration: none; }
#forgot-lead { margin-top: -14px; }
#confirm-field { margin-top: 12px; }
.pw-rules { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; font-size: 11px; }
.pw-rules span { display: flex; align-items: center; gap: 6px; }
.pw-rules span::before { content: ''; width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--muted); }
.pw-rules span.met { color: var(--text); }
.pw-rules span.met::before { background: var(--accent); border-color: var(--accent); }
#btn-newpw { height: 56px; margin-top: 22px; border-radius: 13px; background: linear-gradient(115deg, #f2ddbb, #d5af76 75%, #e4c38e); color: #2e2113; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; box-shadow: inset 0 1px 0 #fff7; font-size: 14px; transition: transform .2s, box-shadow .2s, opacity .2s; }
#btn-newpw::after { content: '⟶'; font-size: 23px; font-weight: 400; }
#btn-newpw:hover:not(:disabled) { transform: translateY(-1px); box-shadow: inset 0 1px 0 #fff7, 0 5px 30px #d9b47a26; }
#step-newpw h1 { margin-bottom: 14px; }

/* Below the form */
.manage { display: block; margin: 18px auto 0; font-size: 11px; }
.confidential { display: flex; justify-content: center; align-items: center; gap: 7px; color: #b7a387; margin-top: 36px; font-size: 8px; letter-spacing: .2em; }
.confidential svg { height: 11px; width: 11px; }

/* Messages and banners */
.msg { margin-top: 13px; font-size: 12px; line-height: 1.5; }
.links { margin-top: 19px; }
.hint { font-size: 12px; }
.banner.info { margin: 16px 0 0; background: #d9b47a10; border-color: var(--border); color: var(--text); font-size: 12px; line-height: 1.55; }
.banner.info .link { margin-left: 4px; font-size: 12px; }
.banner.mock { font-size: 11px; background: #d9b47a10; border-color: #d9b47a50; color: var(--warn); padding: 9px 12px; }
.banner code { color: var(--text); }

/* Code step */
#step-code h1 { margin-bottom: 13px; }
.otp .cell { border-radius: 12px; background: var(--field-soft); font-weight: 400; }
.otp .cell.active { border-color: var(--accent); box-shadow: var(--focus-ring); }
.otp .cell.active::after { background: var(--accent); }
#btn-resend { font-size: 12px; border: 0; background: transparent; }
#btn-resend.primary { background: #d9b47a22; color: var(--text); }

/* Enrolment and signed-in steps */
#step-setup h1, #step-face h1, #step-passkey h1 { font-size: 30px; letter-spacing: -.04em; margin-bottom: 15px; }
.qr-missing { padding: 12px; margin: 0; color: #000; font-size: 12px; }
.row button { font-size: 12px; }
.success-icon { background: #d9b47a12; color: var(--accent); border: 1px solid var(--border); }
#step-done h1 { font-size: 32px; letter-spacing: -.04em; margin-bottom: 12px; text-align: center; }
#step-done .lead { text-align: center; }
.kv { font-size: 12px; gap: 12px 20px; border-top: 1px solid var(--border); padding-top: 20px; }
.kv dt { color: var(--muted); }
.kv dd { overflow-wrap: anywhere; }
#step-done .ghost { font-size: 12px; font-weight: 400; }
#step-done .row { flex-direction: column; gap: 0; }
#step-done #btn-logout { margin-top: 25px; }

/* ---- Dialogs: sign-in methods, help ---- */
dialog { max-width: 420px; width: calc(100% - 36px); border: 1px solid var(--border); border-radius: 22px; padding: 30px; color: var(--text); background: #211910; box-shadow: 0 30px 120px #0009; }
dialog::backdrop { background: #090704b0; backdrop-filter: blur(7px); }
dialog h2 { font-size: 23px; font-weight: 400; letter-spacing: -.025em; margin: 9px 40px 16px 0; }
dialog p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 12px; }
dialog a { color: var(--accent); }
dialog .dialog-intro { font-size: 13px; margin-bottom: 18px; }
dialog .close { position: absolute; right: 15px; top: 15px; width: 36px; height: 36px; margin: 0; padding: 0; display: grid; place-items: center; border-radius: 10px; background: none; color: var(--muted); }
dialog .close:hover:not(:disabled) { background: #d9b47a15; color: var(--text); }
dialog .close svg { width: 20px; height: 20px; }
.setup-row { width: 100%; margin: 0; padding: 15px 2px; display: flex; gap: 15px; align-items: center; background: transparent; border-radius: 0; border-bottom: 1px solid var(--border); color: var(--text); text-align: left; font-weight: 400; font-size: 14px; }
.setup-row:first-of-type { border-top: 1px solid var(--border); }
.setup-row:hover:not(:disabled) { background: transparent; }
.setup-row > svg:first-child { color: var(--accent); }
.setup-row span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.setup-row small { color: var(--muted); font-size: 12px; }
.setup-row > svg:last-child { width: 18px; height: 18px; color: var(--muted); transition: transform .3s var(--ease), color .2s; }
.setup-row:hover > svg:last-child, .setup-row:focus-visible > svg:last-child { transform: translateX(3px); color: var(--text); }

/* ---- Entrance film ---- */
.entrance { position: fixed; inset: 0; z-index: 50; background: #17110c url(/auth-assets/assets/intro-first-desktop-v1.jpg) center / cover no-repeat; opacity: 0; transition: opacity .22s ease-out; }
.entrance.visible { opacity: 1; }
.entrance video { width: 100%; height: 100%; object-fit: cover; }
.entrance button { position: absolute; bottom: 26px; right: 4%; width: auto; margin: 0; background: #17110cbb; color: #f5ecdd; border: 1px solid #d9b47a44; padding: 9px 16px; font-size: 12px; font-weight: 400; }
.entrance button:hover:not(:disabled) { background: #17110cee; }

/* ---- Responsive ---- */
@media (min-width: 1700px) { body { padding-right: 10%; } .login-shell { width: 400px; } }
@media (max-width: 1050px) and (min-width: 701px) {
  body { padding-right: 4vw; }
  .login-shell { width: 340px; }
  .shade { background: linear-gradient(90deg, #0e0a0710 10%, #0e0a0740 36%, #0e0a07ed 62%, #0e0a07f5); }
}
@media (max-height: 760px) and (min-width: 701px) {
  body { padding-top: 100px; padding-bottom: 75px; }
  h1 { margin-bottom: 23px; }
  .confidential { margin-top: 20px; }
  .header { padding-top: 23px; }
  .page-footer { bottom: 15px; }
}
@media (max-width: 700px) {
  body { justify-content: center; padding: 180px 27px 95px; }
  .header { padding: 23px 24px; }
  .wordmark { gap: 11px; }
  .wordmark svg { width: 34px; height: 29px; }
  .wordmark > span { font-size: 11px; }
  .wordmark small { font-size: 7px; }
  .preview span { display: none; }
  .preview { padding: 12px; }
  .shade { background: linear-gradient(0deg, #100c08 0%, #100c08f5 40%, #100c08c2 63%, #100c0830 95%); }
  .stage img { object-position: center; }
  .entrance { background-image: url(/auth-assets/assets/intro-first-mobile-v1.jpg); background-position: center; }
  .login-shell { width: 100%; max-width: 370px; }
  h1 { font-size: 34px; }
  #factor-switch { gap: 12px; }
  #factor-switch button { height: 58px; }
  .confidential { margin-top: 23px; }
  .page-footer { left: 27px; right: 27px; bottom: 17px; font-size: 8px; }
  .page-footer > span { letter-spacing: .09em; }
  .otp .cells { gap: 5px; }
  .otp .cell { height: 52px; }
  input[type=email], input[type=tel], input[type=password], input[type=text].pwtext, input.plainnum, .phone-field .dial { font-size: 16px; }
  dialog { padding: 26px 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.portal-return{position:fixed;bottom:24px;inset-inline-end:6%;z-index:20;display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:10px 18px;border:1px solid var(--accent);border-radius:8px;background:var(--bg);color:var(--text);font-weight:600;text-decoration:none}.portal-return[hidden]{display:none}.portal-return[aria-disabled=true]{opacity:.65;cursor:wait}@media(max-width:700px){.portal-return{bottom:18px;inset-inline:20px}.page-footer{bottom:76px}}

thara-music{display:inline-flex;width:44px;height:44px;flex-shrink:0}.entrance-music{position:absolute;top:20px;inset-inline-end:24px;z-index:5;background:var(--field);border-radius:8px}

/* Keep the matched door frame in place while sign-in controls leave. */
.portal-departing main,.portal-departing header,.portal-departing .page-footer,.portal-departing .portal-return,.portal-departing .shade,.portal-departing .ambient{opacity:0;transition:opacity 180ms ease-out;pointer-events:none}
@media(prefers-reduced-motion:reduce){.portal-departing main,.portal-departing header,.portal-departing .page-footer,.portal-departing .portal-return,.portal-departing .shade,.portal-departing .ambient{transition:none}}

.portal-departing .ambient{animation:none}
