:root{
  --bg:#f4f8fb;
  --panel:#ffffff;
  --panel-2:#eef5fb;
  --text:#17212b;
  --muted:#6f8193;
  --line:#dce7f1;
  --blue:#3390ec;
  --blue2:#12e6d4;
  --green:#31b545;
  --danger:#e53935;
  --soft:rgba(51,144,236,.12);
  --shadow:0 28px 80px rgba(21,45,72,.18);
}

@media (prefers-color-scheme: dark){
  :root{
    --bg:#0f1821;
    --panel:#17212b;
    --panel-2:#1d2b37;
    --text:#f4f8fb;
    --muted:#9aabba;
    --line:#263747;
    --soft:rgba(18,230,212,.13);
    --shadow:0 28px 80px rgba(0,0,0,.42);
  }
}

*{box-sizing:border-box}
html{min-height:100%;background:var(--bg)}
body{
  min-height:100%;
  margin:0;
  font-family:Vazirmatn,Vazir,Tahoma,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  overflow:auto;
}

.auth-page{
  min-height:100dvh;
  display:grid;
  grid-template-columns:minmax(460px,1fr) minmax(390px,500px);
  direction:ltr;
  position:relative;
}

.auth-visual{
  position:relative;
  display:grid;
  place-items:center;
  overflow:hidden;
  min-height:100dvh;
  background:
    radial-gradient(circle at 18% 26%,rgba(51,144,236,.28),transparent 18rem),
    radial-gradient(circle at 84% 82%,rgba(49,181,69,.22),transparent 16rem),
    linear-gradient(135deg,#0e2030 0%,#0d1b25 52%,#0b2018 100%);
}

.auth-visual:before{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(90deg,rgba(255,255,255,.04),transparent 42%,rgba(255,255,255,.02));
}

.orb{position:absolute;border-radius:999px;filter:blur(3px);opacity:.95}
.orb-one{width:260px;height:260px;background:rgba(51,144,236,.22);left:10%;top:14%}
.orb-two{width:210px;height:210px;background:rgba(49,181,69,.22);right:12%;bottom:8%}

.phone-preview{
  width:min(350px,74%);
  height:min(610px,78vh);
  min-height:500px;
  border-radius:38px;
  background:rgba(23,33,43,.78);
  border:1px solid rgba(255,255,255,.58);
  box-shadow:0 38px 90px rgba(0,0,0,.32);
  padding:22px;
  backdrop-filter:blur(18px);
  position:relative;
  z-index:2;
  direction:rtl;
}
.preview-top{height:46px;border-radius:20px;display:flex;align-items:center;gap:12px;padding:0 14px}
.preview-top span{width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,var(--blue),#5ab3ff)}
.preview-top b{height:12px;width:130px;border-radius:20px;background:#36526a}
.preview-story-row{display:flex;gap:10px;margin:20px 2px}
.preview-story-row i{width:48px;height:48px;border-radius:50%;border:3px solid var(--green);background:#142434}
.preview-chat{display:flex;align-items:center;gap:12px;border-radius:20px;padding:12px;margin:10px 0;border:1px solid rgba(255,255,255,.12)}
.preview-chat.active{border-color:rgba(51,144,236,.45);box-shadow:0 8px 24px rgba(51,144,236,.12)}
.preview-chat em{width:46px;height:46px;border-radius:50%;background:#2d5675;flex:none}
.preview-chat div{display:grid;gap:8px;flex:1}
.preview-chat strong,.preview-chat span{height:11px;border-radius:20px;background:#36526a}
.preview-chat strong{width:66%}.preview-chat span{width:92%}
.preview-message{width:74%;height:46px;border-radius:18px 18px 18px 4px;background:rgba(255,255,255,.1);margin:22px auto 0 0}
.preview-message.mine{margin:26px 0 0 auto;background:rgba(49,181,69,.38);border-radius:18px 18px 4px 18px}
.preview-input{position:absolute;bottom:22px;left:22px;right:22px;height:52px;border-radius:24px;display:flex;align-items:center;gap:12px;padding:0 14px}
.preview-input span{height:12px;flex:1;border-radius:20px;background:#36526a}
.preview-input b{width:34px;height:34px;border-radius:50%;background:var(--blue)}

.auth-panel{
  direction:rtl;
  min-height:100dvh;
  max-height:100dvh;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  padding:clamp(18px,4vh,40px);
  background:var(--bg);
  scrollbar-width:thin;
}

.auth-card{
  width:100%;
  max-width:430px;
  margin:0 auto;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:30px;
  padding:clamp(20px,3vh,28px);
  box-shadow:var(--shadow);
}

.welcome-hero{
  display:grid;
  justify-items:center;
  text-align:center;
  margin-bottom:18px;
}
.welcome-hero img{
  width:clamp(116px,18vh,166px);
  max-width:48%;
  height:auto;
  display:block;
  object-fit:contain;
  filter:drop-shadow(0 22px 34px rgba(18,230,212,.16));
}
.welcome-hero h1{
  margin:10px 0 0;
  font-size:clamp(22px,2.7vw,28px);
  line-height:1.45;
  letter-spacing:-.45px;
}

.brand-row{display:none;align-items:center;gap:14px;margin-bottom:20px}
.brand-mark{
  width:58px;
  height:58px;
  border-radius:21px;
  background-color:var(--panel-2);
  background-image:url("../icons/icon-192.png");
  background-size:72%;
  background-repeat:no-repeat;
  background-position:center;
  color:transparent;
  box-shadow:0 14px 30px rgba(18,230,212,.14);
  flex:none;
}
.brand-row h1{margin:0;font-size:24px;line-height:1.2;letter-spacing:-.3px}
.brand-row p{margin:5px 0 0;color:var(--muted);font-size:13px;line-height:1.7}
.auth-copy{display:none}
.auth-copy h2{margin:0 0 6px;font-size:26px;letter-spacing:-.5px;line-height:1.45}
.auth-copy p{margin:0 0 16px;color:var(--muted);line-height:1.9;font-size:14px}

.auth-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:0 0 18px}
.auth-tabs.single{grid-template-columns:1fr}
.auth-tabs button{
  height:44px;
  border:1px solid var(--line);
  border-radius:15px;
  background:rgba(127,151,174,.08);
  color:var(--muted);
  font:inherit;
  font-weight:900;
  cursor:pointer;
  transition:.18s ease;
}
.auth-tabs button:hover{border-color:rgba(51,144,236,.35);color:var(--text)}
.auth-tabs button.active{background:linear-gradient(135deg,rgba(18,230,212,.18),rgba(51,144,236,.15));color:var(--blue);border-color:rgba(18,230,212,.36)}

.auth-form{display:grid;gap:11px}
.auth-form[hidden]{display:none}
.auth-form.register-grid{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:10px;row-gap:10px}
.form-field{display:grid;gap:6px;min-width:0}
.form-field.full,.auth-submit.full{grid-column:1/-1}
.auth-form label{font-size:12.5px;font-weight:900;color:var(--muted)}
.field-shell{
  height:48px;
  border:1px solid var(--line);
  background:rgba(127,151,174,.08);
  border-radius:16px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 13px;
  transition:.18s ease;
}
.field-shell:focus-within{border-color:var(--blue);box-shadow:0 0 0 4px rgba(51,144,236,.11);background:var(--panel)}
.field-shell span{direction:ltr;color:var(--muted);font-weight:900;border-left:1px solid var(--line);padding-left:11px}
.field-shell input{border:0;outline:0;background:transparent;color:var(--text);font:inherit;flex:1;min-width:0;width:100%}
.field-shell.plain{padding:0 15px}

.auth-submit{
  margin-top:6px;
  border:0;
  border-radius:17px;
  background:linear-gradient(135deg,var(--blue),#2185e5);
  height:50px;
  color:#fff;
  font:inherit;
  font-weight:950;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  cursor:pointer;
  box-shadow:0 16px 28px rgba(51,144,236,.28);
  transition:.18s ease;
}
.auth-submit:hover{transform:translateY(-1px)}
.auth-submit:disabled{opacity:.65;cursor:wait;transform:none}
.auth-submit b{font-size:21px;transform:rotate(180deg)}
.auth-tools{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}
.auth-tools button,.auth-tools a{border:1px solid var(--line);background:var(--soft);color:var(--blue);border-radius:14px;padding:9px 12px;font:inherit;font-size:13px;font-weight:900;text-decoration:none;cursor:pointer}
.auth-message,.auth-error{margin-top:12px;border-radius:14px;padding:10px 12px;font-size:13px;line-height:1.8;display:none}
.auth-message.show{display:block;background:rgba(49,181,69,.11);color:var(--green)}
.auth-message.show.error{background:rgba(229,57,53,.11);color:var(--danger)}
.auth-message:empty{display:none}
.auth-error{display:block;background:rgba(229,57,53,.11);color:var(--danger)}
.auth-footer{max-width:440px;margin:14px auto 0;display:none;justify-content:center;gap:8px;flex-wrap:wrap;color:var(--muted);font-size:12px;padding-bottom:10px}
.auth-footer span{background:var(--panel);border:1px solid var(--line);border-radius:999px;padding:6px 10px}
.auth-footer a{color:inherit;text-decoration:none}

@media (min-height:860px){
  .auth-panel{justify-content:center}
}

@media (max-height:760px) and (min-width:921px){
  .auth-panel{padding:18px 28px;justify-content:flex-start}
  .auth-card{padding:21px;border-radius:26px;max-width:430px}
  .welcome-hero{margin-bottom:12px}
  .welcome-hero img{width:112px;max-width:42%}
  .welcome-hero h1{font-size:22px;margin-top:6px}
  .brand-row{margin-bottom:14px}
  .brand-mark{width:50px;height:50px;border-radius:18px}
  .brand-row h1{font-size:22px}
  .auth-copy h2{font-size:23px}
  .auth-copy p{margin-bottom:12px;font-size:13px;line-height:1.75}
  .auth-tabs{margin-bottom:12px}
  .field-shell{height:44px;border-radius:14px}
  .auth-submit{height:46px;border-radius:15px}
  .auth-form.register-grid{row-gap:8px}
}

@media (max-width:920px){
  .auth-page{grid-template-columns:1fr;min-height:100dvh}
  .auth-visual{display:none}
  .auth-panel{min-height:100dvh;max-height:none;padding:20px;justify-content:flex-start}
  .auth-card{max-width:520px;border-radius:26px;padding:24px;margin:0 auto}
  .auth-form.register-grid{grid-template-columns:1fr}
  .welcome-hero img{max-width:46%;width:132px}
  .auth-copy h2{font-size:24px}
}

@media (max-width:460px){
  .auth-panel{padding:14px}
  .auth-card{padding:20px;border-radius:24px}
  .welcome-hero img{width:118px;max-width:54%}
  .welcome-hero h1{font-size:22px}
  .brand-row{align-items:flex-start}
  .brand-mark{width:50px;height:50px;border-radius:18px}
  .brand-row h1{font-size:22px}
  .auth-copy h2{font-size:22px}
  .auth-tabs button{height:42px}
  .field-shell{height:46px}
}


/* E-chat final welcome splash */
.startup-welcome{
  position:fixed;
  inset:0;
  z-index:9999;
  display:grid;
  place-items:center;
  background:radial-gradient(circle at 50% 22%,rgba(18,230,212,.18),transparent 18rem),var(--bg);
  opacity:1;
  visibility:visible;
  transition:opacity .35s ease,visibility .35s ease;
}
.startup-welcome.is-hidden{opacity:0;visibility:hidden;pointer-events:none}
.startup-welcome-card{
  display:grid;
  justify-items:center;
  gap:14px;
  padding:28px 32px;
  border-radius:30px;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(51,144,236,.16);
  box-shadow:0 28px 80px rgba(21,45,72,.18);
  backdrop-filter:blur(18px);
  text-align:center;
}
.startup-welcome-card img{width:clamp(128px,22vh,190px);height:auto;display:block;object-fit:contain;filter:drop-shadow(0 20px 32px rgba(18,230,212,.16))}
.startup-welcome-card strong{font-size:clamp(22px,3vw,30px);line-height:1.45;letter-spacing:-.45px}
@media (prefers-color-scheme:dark){.startup-welcome-card{background:rgba(23,33,43,.78);border-color:rgba(255,255,255,.08)}}
@media (max-width:520px){.startup-welcome-card{width:calc(100% - 36px);padding:24px 20px}.startup-welcome-card img{width:142px}}
