/* XPING login & signup */
  :root {
    color-scheme: dark;
    --bg: #050807;
    --bg-2: #080d0b;
    --field: rgba(255, 255, 255, .03);
    --b1: rgba(255, 255, 255, .08);
    --b2: rgba(255, 255, 255, .14);
    --text: #f1f5f3;
    --muted: #8d9893;
    --faint: #5c6762;
    --green: #16e39c;
    --ink: #03170a;
    --red: #ff6b61;
    --amber: #f2b84b;
    --blue: #56b4f5;
    --body: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
    --mono: "Vazirmatn", Tahoma, sans-serif;
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.8 var(--body); direction: rtl; -webkit-font-smoothing: antialiased; }
  a { color: inherit; }
  :focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 10px; }
  [hidden] { display: none !important; }
  .ltr { direction: ltr; unicode-bidi: isolate; }

  .auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); }

  /* ---------- form side ---------- */
  .side-form { display: flex; flex-direction: column; padding: 28px 24px; position: relative; }
  .side-form::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(500px 360px at 50% 0%, rgba(22,227,156,.07), transparent 70%); }
  .top { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 420px; width: 100%; margin-inline: auto; }
  .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; direction: ltr; }
  .logo { gap: 1px !important; }
  .logo .mark { height: 16.7px; display: block; }
  .logo .word { font: 800 23px/1 "Unbounded", "Vazirmatn", sans-serif; letter-spacing: .01em; color: var(--text); }
  .back { font-size: 14px; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
  .back:hover { color: var(--text); }

  .form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding-block: 40px; }
  .form-box { width: 100%; max-width: 420px; }
  .form-box h1 { margin: 0; font-size: 32px; font-weight: 900; letter-spacing: -.02em; line-height: 1.3; }
  .form-box .sub { margin: 6px 0 28px; color: var(--muted); }

  .seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.035); box-shadow: 0 0 0 1px var(--b1) inset; margin-bottom: 24px; position: relative; }
  .seg button { position: relative; z-index: 1; height: 40px; border: 0; background: none; color: var(--muted); font: 600 14px/1 var(--body); cursor: pointer; border-radius: 10px; transition: color .2s; }
  .seg button[aria-selected="true"] { color: var(--text); }
  .seg .thumb { position: absolute; top: 4px; bottom: 4px; right: 4px; width: calc(50% - 4px); border-radius: 10px; background: rgba(255,255,255,.08); box-shadow: 0 0 0 1px var(--b2) inset, 0 4px 14px -6px rgba(0,0,0,.6); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
  .seg[data-mode="otp"] .thumb { transform: translateX(-100%); }

  form { display: grid; gap: 18px; }
  .field { display: grid; gap: 8px; }
  .field label, .lbl { font-size: 13.5px; font-weight: 600; color: #c6d0cb; display: flex; justify-content: space-between; align-items: center; }
  .field label a { font-weight: 500; color: var(--green); text-decoration: none; font-size: 13px; }
  .field label a:hover { text-decoration: underline; }
  .field label .opt { color: var(--faint); font-weight: 400; font-size: 12.5px; }
  .input { position: relative; }
  .input input {
    width: 100%; height: 52px; padding-inline: 46px 16px; border-radius: 14px;
    background: var(--field); border: 1px solid var(--b1); color: var(--text);
    font: 500 15px/1 var(--body); outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
    unicode-bidi: plaintext; text-align: right;
  }
  .input input::placeholder { color: var(--faint); font-weight: 400; }
  .input input:hover { border-color: var(--b2); }
  .input input:focus { border-color: rgba(22,227,156,.7); box-shadow: 0 0 0 4px rgba(22,227,156,.12); background: rgba(255,255,255,.045); }
  .input .ic { position: absolute; top: 50%; right: 16px; transform: translateY(-50%); color: var(--faint); pointer-events: none; transition: color .2s; }
  .input input:focus ~ .ic { color: var(--green); }
  .input.has-toggle input { padding-inline-end: 48px; }
  .toggle { position: absolute; top: 50%; left: 8px; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
  .toggle:hover { background: rgba(255,255,255,.06); color: var(--text); }
  .input.invalid input { border-color: rgba(255,107,97,.6); }
  .err { font-size: 12.5px; color: var(--red); margin-top: -2px; }

  .strength { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 6px; align-items: center; margin-top: 2px; }
  .strength i { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); transition: background .25s; }
  .strength span { font-size: 12px; color: var(--faint); min-width: 44px; text-align: left; }

  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
    height: 52px; border-radius: 14px; border: 0; cursor: pointer; font: 700 15.5px/1 var(--body); text-decoration: none;
    transition: transform .15s, box-shadow .2s, background .2s, opacity .2s;
  }
  .btn:active { transform: scale(.99); }
  .btn-primary { background: linear-gradient(180deg, #5ce7b8, #33c996); color: var(--ink); box-shadow: 0 0 0 1px rgba(143,240,210,.6) inset, 0 1px 0 rgba(255,255,255,.4) inset, 0 12px 30px -12px rgba(22,227,156,.8); }
  .btn-primary:hover { box-shadow: 0 0 0 1px rgba(143,240,210,.8) inset, 0 1px 0 rgba(255,255,255,.4) inset, 0 16px 36px -10px rgba(22,227,156,.95); }
  .btn-primary[disabled] { opacity: .75; cursor: progress; }
  .btn-ghost { background: rgba(255,255,255,.035); color: var(--text); box-shadow: 0 0 0 1px var(--b1) inset; }
  .btn-ghost:hover { background: rgba(255,255,255,.07); }
  .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(3,23,10,.3); border-top-color: var(--ink); animation: spin .7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  .alt { text-align: center; margin: 26px 0 0; color: var(--muted); font-size: 14.5px; }
  .alt a { color: var(--green); font-weight: 700; text-decoration: none; margin-inline-start: 4px; }
  .alt a:hover { text-decoration: underline; }

  .alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.7; }
  .alert svg { flex: none; margin-top: 3px; }
  .alert.ok { background: rgba(22,227,156,.08); box-shadow: 0 0 0 1px rgba(22,227,156,.25) inset; color: #bff3e3; }
  .alert.ok svg { color: var(--green); }
  .alert.bad { background: rgba(255,107,97,.08); box-shadow: 0 0 0 1px rgba(255,107,97,.25) inset; color: #ffc9c4; }
  .alert.bad svg { color: var(--red); }

  /* otp */
  .otp { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; direction: ltr; }
  .otp input { height: 60px; width: 100%; min-width: 0; text-align: center; border-radius: 14px; background: var(--field); border: 1px solid var(--b1); color: var(--text); font: 600 24px/1 var(--mono); outline: none; transition: border-color .2s, box-shadow .2s; }
  .otp input:focus { border-color: rgba(22,227,156,.7); box-shadow: 0 0 0 4px rgba(22,227,156,.12); }
  .otp input.filled { border-color: rgba(22,227,156,.4); }
  .otp-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; color: var(--muted); }
  .link-btn { border: 0; background: none; padding: 0; color: var(--green); font: 600 13.5px/1 var(--body); cursor: pointer; }
  .link-btn[disabled] { color: var(--faint); cursor: default; }
  .link-btn:not([disabled]):hover { text-decoration: underline; }

  /* checkbox */
  .check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: #c6d0cb; cursor: pointer; line-height: 1.7; }
  .check input { appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 2px 0 0; border-radius: 6px; border: 1px solid var(--b2); background: var(--field); display: grid; place-items: center; cursor: pointer; transition: background .15s, border-color .15s; }
  .check input::after { content: ""; width: 10px; height: 6px; border: solid var(--ink); border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
  .check input:checked { background: var(--green); border-color: var(--green); }
  .check input:checked::after { opacity: 1; }
  .check button { border: 0; background: none; padding: 0; color: var(--green); font: inherit; font-weight: 700; cursor: pointer; }
  .check button:hover { text-decoration: underline; }

  .ref-toggle { justify-self: start; border: 0; background: none; padding: 0; color: var(--muted); font: 500 13.5px/1 var(--body); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
  .ref-toggle:hover { color: var(--text); }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

  .foot-note { max-width: 420px; width: 100%; margin-inline: auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--faint); }
  .foot-note a { text-decoration: none; color: var(--muted); }
  .foot-note a:hover { color: var(--green); }

  /* ---------- brand side ---------- */
  .side-brand { padding: 14px; position: relative; }
  .panel {
    position: sticky; top: 14px; height: calc(100vh - 28px); min-height: 600px; border-radius: 28px; overflow: hidden; isolation: isolate;
    background: radial-gradient(90% 70% at 50% 100%, rgba(22,227,156,.14), transparent 70%), linear-gradient(180deg, #0a1411, #060b09);
    box-shadow: 0 0 0 1px var(--b1) inset; display: flex; flex-direction: column; justify-content: space-between; padding: 44px;
  }
  .panel::before { content: ""; position: absolute; inset: 0; z-index: -2;
    background: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px) 0 0 / 100% 56px, linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px) 0 0 / 56px 100%;
    -webkit-mask: radial-gradient(80% 60% at 50% 40%, #000, transparent); mask: radial-gradient(80% 60% at 50% 40%, #000, transparent); }
  #earth { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
  .eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--green); direction: ltr; }
  .eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .6; }
  .panel h2 { margin: 16px 0 0; font-size: clamp(2rem, 3.4vw, 3rem); font-weight: 900; line-height: 1.2; letter-spacing: -.02em; background: linear-gradient(180deg, #fff 35%, #a4b0aa); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .panel h2 em { font-style: normal; background: linear-gradient(95deg, #16e39c, #b9f7e3); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .trust { display: flex; flex-wrap: wrap; gap: 10px; }
  .trust span { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding-inline: 14px; border-radius: 999px; font-size: 13.5px; color: #d3dcd8; background: rgba(8, 14, 12, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 0 0 1px var(--b1) inset; }
  .trust svg { color: var(--green); flex: none; }

  /* modal */
  .modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(2, 5, 4, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
  .modal-card { width: 100%; max-width: 520px; max-height: 80vh; display: flex; flex-direction: column; border-radius: 22px; background: #0b1210; box-shadow: 0 0 0 1px var(--b2) inset, 0 40px 80px -20px rgba(0,0,0,.8); }
  .modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--b1); }
  .modal-head h3 { margin: 0; font-size: 18px; }
  .modal-body { padding: 20px 24px; overflow-y: auto; color: #c6d0cb; font-size: 14.5px; }
  .modal-body p { margin: 0 0 12px; }
  .modal-foot { padding: 16px 24px; border-top: 1px solid var(--b1); }
  .x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(255,255,255,.05); color: var(--muted); cursor: pointer; display: grid; place-items: center; }
  .x:hover { color: var(--text); background: rgba(255,255,255,.1); }



  @media (max-width: 960px) {
    .auth { grid-template-columns: 1fr; }
    .side-brand { display: none; }
    .form-wrap { padding-bottom: 90px; }
  }
  @media (max-width: 420px) { .grid-2 { grid-template-columns: 1fr; } .otp { gap: 7px; } .otp input { height: 54px; } }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

  /* flash messages from display_msgs() */
  .msgs { display: grid; gap: 10px; margin-bottom: 20px; }
  .msgs:empty { display: none; }
  .msgs .alert { justify-content: space-between; align-items: center; }
  .alert-warning { background: rgba(242,184,75,.08); box-shadow: 0 0 0 1px rgba(242,184,75,.28) inset; color: #f6dca8; }
  .alert-danger, .alert-error { background: rgba(255,107,97,.08); box-shadow: 0 0 0 1px rgba(255,107,97,.25) inset; color: #ffc9c4; }
  .alert-success { background: rgba(22,227,156,.08); box-shadow: 0 0 0 1px rgba(22,227,156,.25) inset; color: #bff3e3; }
  .alert-info { background: rgba(86,180,245,.08); box-shadow: 0 0 0 1px rgba(86,180,245,.25) inset; color: #c6e5fb; }
  .alert .btn-close { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: inherit; opacity: .7; cursor: pointer; font-size: 18px; line-height: 1; }
  .alert .btn-close::before { content: \00d7; }
  .alert .btn-close:hover { opacity: 1; background: rgba(255,255,255,.06); }
  .otp-msg:empty { display: none; }

  /* smooth hand-off between landing, login and panel (View Transitions) */
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: xp-fade-out .15s ease both; }
  ::view-transition-new(root) { animation: xp-fade-in .25s ease both; }
  @keyframes xp-fade-out { to { opacity: 0; } }
  @keyframes xp-fade-in { from { opacity: 0; } }
  @media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; } }