/* ==========================================================================
   Nava — authentication surface (login / register / invite)
   Split screen: product proof panel + focused form panel.
   ========================================================================== */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

/* ---------- brand / proof panel ---------------------------------------- */

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--sp-6);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 55%),
    radial-gradient(90% 60% at 0% 100%, rgba(0,0,0,.22) 0%, rgba(0,0,0,0) 60%),
    linear-gradient(160deg, #6C6CE8 0%, var(--brand) 42%, #3B3BA6 100%);
  color: #FFFFFF;
  isolation: isolate;
}
.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(100% 70% at 30% 20%, #000 0%, transparent 75%);
}
.auth-brand::after {
  content: "";
  position: absolute;
  inset-block-end: -160px;
  inset-inline-end: -120px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.13) 0%, rgba(255,255,255,0) 68%);
  z-index: -1;
}

.auth-brand-inner {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  flex: 1 1 auto;
  max-width: 520px;
  width: 100%;
  margin-inline: auto;
  justify-content: center;
  padding-block: var(--sp-5);
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  color: #FFFFFF;
}
.auth-logo svg {
  width: 26px;
  height: 26px;
}
.auth-logo-word {
  font-size: 19px;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}
.auth-logo-word small {
  display: block;
  font-size: 10.5px;
  font-weight: var(--weight-regular);
  letter-spacing: .04em;
  opacity: .7;
  line-height: 1.4;
}

.auth-copy {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.auth-headline {
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.35;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.015em;
  margin: 0;
  color: #FFFFFF;
  max-width: 22ch;
}
html[lang="fa"] .auth-headline {
  line-height: 1.55;
  letter-spacing: 0;
  max-width: 26ch;
}
.auth-lead {
  font-size: var(--text-base);
  line-height: 1.75;
  color: rgba(255,255,255,.78);
  max-width: 46ch;
  margin: 0;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.auth-feature {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: rgba(255,255,255,.88);
}
.auth-feature-icon {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  margin-block-start: 1px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  color: #FFFFFF;
}
.auth-feature-icon svg {
  width: 11px;
  height: 11px;
}

/* product proof card */
.auth-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-block-start: var(--sp-1);
  max-width: 420px;
  width: 100%;
}
.auth-preview {
  position: relative;
  margin-block-start: 0;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: 0 24px 60px rgba(16,18,60,.35), 0 2px 6px rgba(16,18,60,.2);
  color: var(--text);
}
.auth-preview-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-block-end: 10px;
  border-block-end: 1px solid var(--border-soft);
}
.auth-preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}
.auth-preview-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-preview-badge {
  font-size: 9.5px;
  height: 17px;
  padding-inline: 6px;
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success);
  display: inline-flex;
  align-items: center;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.auth-preview-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-block: 10px;
}
.auth-preview-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-preview-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-2);
}
.auth-preview-progress-row b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.auth-preview-task {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-2);
}
.auth-preview-check {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
  display: grid;
  place-content: center;
}
.auth-preview-check[data-done="true"] {
  background: var(--success);
  border-color: var(--success);
  color: #FFFFFF;
}
.auth-preview-check[data-done="true"]::after {
  content: "";
  width: 7px;
  height: 7px;
  background: currentColor;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.auth-preview-task-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-preview-task[data-done="true"] .auth-preview-task-label {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}
.auth-preview-task .avatar {
  --avatar-size: 17px;
  font-size: 7.5px;
}
.auth-preview-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-block-start: 9px;
  border-block-start: 1px solid var(--border-soft);
}
.auth-preview-foot .avatar-stack .avatar {
  --avatar-size: 20px;
  font-size: 8px;
}
.auth-preview-foot .avatar-stack .avatar + .avatar {
  margin-inline-start: -4px;
}
.auth-preview-meta {
  margin-inline-start: auto;
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}
.auth-preview-bubble {
  position: static;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  font-size: 10.5px;
  color: rgba(255,255,255,.9);
  width: 100%;
}
.auth-preview-bubble .avatar {
  --avatar-size: 20px;
  font-size: 8px;
  flex-shrink: 0;
}
.auth-preview-bubble-text {
  min-width: 0;
  white-space: normal;
  line-height: 1.6;
  overflow: visible;
}
.auth-preview-bubble-text b {
  color: #FFFFFF;
  font-weight: var(--weight-semibold);
}

.auth-brand-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-xs);
  color: rgba(255,255,255,.6);
  flex-wrap: wrap;
}
.auth-brand-foot .dot {
  width: 3px;
  height: 3px;
  background: currentColor;
  opacity: .6;
}

/* ---------- form panel ------------------------------------------------- */

.auth-form-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.auth-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-5);
  flex-shrink: 0;
}
.auth-toolbar .btn-icon {
  color: var(--text-2);
}
.auth-toolbar-start {
  margin-inline-end: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.auth-mobile-logo {
  display: none;
}

.auth-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4) var(--sp-5) var(--sp-7);
  min-height: 0;
}

.auth-panel {
  width: 100%;
  max-width: 392px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.auth-panel--wide {
  max-width: 440px;
}

.auth-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0;
}
html[lang="fa"] .auth-title {
  letter-spacing: 0;
  line-height: 1.5;
}
.auth-sub {
  font-size: var(--text-sm);
  color: var(--text-2);
  line-height: 1.7;
  margin: 0;
}

.auth-tabs {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px;
  gap: 2px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
}
.auth-tab {
  height: 28px;
  padding-inline: 14px;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-2);
  transition: background-color var(--motion-fast) var(--ease),
              color var(--motion-fast) var(--ease);
}
.auth-tab:hover {
  color: var(--text);
}
.auth-tab[aria-current="page"],
.auth-tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
.auth-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.auth-form .field + .field {
  margin-block-start: 0;
}
.auth-form .input {
  height: 38px;
  font-size: var(--text-base);
}
.auth-form .input-affix .input {
  padding-inline-start: 34px;
}
.auth-form .input-affix > svg {
  inset-inline-start: 11px;
  width: 16px;
  height: 16px;
}

.auth-submit {
  height: 40px;
  font-size: var(--text-base);
  margin-block-start: var(--sp-1);
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.auth-link {
  font-size: var(--text-xs);
  color: var(--text-2);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.auth-link:hover {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 9px 11px;
  border-radius: var(--radius-input);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: var(--text-sm);
  line-height: 1.55;
  animation: nv-pop-in var(--motion-fast) var(--ease-out);
}
.auth-error svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-block-start: 2px;
}
.auth-error[hidden] {
  display: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-3);
  font-size: var(--text-xs);
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}

/* demo accounts */
.auth-demo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.auth-demo-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-2);
  font-weight: var(--weight-medium);
}
.auth-demo-head svg {
  width: 13px;
  height: 13px;
  color: var(--text-3);
}
.auth-demo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.auth-demo-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: start;
  min-width: 0;
  transition: border-color var(--motion-fast) var(--ease),
              background-color var(--motion-fast) var(--ease),
              box-shadow var(--motion-fast) var(--ease);
}
.auth-demo-btn:hover {
  border-color: var(--brand-ring);
  background: var(--brand-softer);
}
.auth-demo-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.auth-demo-btn[disabled] {
  opacity: .6;
  pointer-events: none;
}
.auth-demo-btn .avatar {
  flex-shrink: 0;
}
.auth-demo-btn .col {
  align-items: flex-start;
  text-align: start;
}
.auth-demo-role {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* مدیر سیستم یک نقشِ جدا از اعضای workspace است — تمام‌عرض و متمایز */
.auth-demo-btn--sys {
  grid-column: 1 / -1;
  justify-content: center;
  gap: 8px;
  border-style: dashed;
  background: var(--brand-softer);
}
.auth-demo-btn--sys:hover {
  border-style: solid;
}
.auth-demo-btn--sys .col {
  align-items: center;
  text-align: center;
}
.auth-demo-btn--sys .auth-demo-role {
  justify-content: center;
}

.auth-demo-mail {
  font-size: 10px;
  color: var(--text-3);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  unicode-bidi: plaintext;
}

.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-2);
  line-height: 1.6;
}
.auth-note svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-block-start: 2px;
  color: var(--text-3);
}

.auth-foot {
  font-size: var(--text-xs);
  color: var(--text-3);
  text-align: center;
  line-height: 1.7;
  padding-block-start: var(--sp-1);
}
.auth-foot .auth-link {
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

.auth-switch-line {
  font-size: var(--text-sm);
  color: var(--text-2);
  text-align: center;
}
.auth-switch-line .auth-link {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--brand);
}

/* invite acceptance */
.auth-invite-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.auth-invite-ws {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.auth-invite-name {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
}
.auth-invite-meta {
  font-size: var(--text-xs);
  color: var(--text-2);
}
.auth-invite-token {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  word-break: break-all;
  unicode-bidi: plaintext;
}

/* password strength */
.auth-strength {
  display: flex;
  align-items: center;
  gap: 6px;
}
.auth-strength-bar {
  flex: 1 1 auto;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-active);
  overflow: hidden;
}
.auth-strength-fill {
  height: 100%;
  width: 0;
  background: var(--danger);
  border-radius: inherit;
  transition: width var(--motion) var(--ease), background-color var(--motion) var(--ease);
}
.auth-strength-fill[data-score="2"] { background: var(--warning); }
.auth-strength-fill[data-score="3"] { background: var(--success); }
.auth-strength-fill[data-score="4"] { background: var(--success); }
.auth-strength-label {
  font-size: 10.5px;
  color: var(--text-3);
  min-width: 44px;
  text-align: end;
}

/* ---------- responsive ------------------------------------------------- */

@media (max-width: 1023px) {
  .auth {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-brand {
    display: none;
  }
  .auth-mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    margin-inline-end: auto;
    color: var(--text);
  }
  .auth-mobile-logo svg {
    width: 22px;
    height: 22px;
    color: var(--brand);
  }
  .auth-toolbar {
    justify-content: space-between;
  }
  .auth-main {
    align-items: flex-start;
    padding-block-start: var(--sp-4);
  }
}

@media (min-width: 1024px) and (max-height: 760px) {
  .auth-brand-inner {
    gap: var(--sp-4);
  }
  .auth-headline {
    font-size: 26px;
  }
  .auth-features {
    gap: 6px;
  }
  .auth-preview-bubble {
    display: none;
  }
}

@media (max-width: 639px) {
  .auth-main {
    padding-inline: var(--sp-4);
    padding-block-end: calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
  }
  .auth-toolbar {
    padding: var(--sp-3) var(--sp-4);
  }
  .auth-panel,
  .auth-panel--wide {
    max-width: none;
  }
  .auth-demo-grid {
    grid-template-columns: 1fr;
  }
  .auth-demo-btn--sys {
    grid-column: auto;
  }
  .auth-demo-btn .auth-demo-mail {
    font-size: 10.5px;
  }
}

/* ---------- print ------------------------------------------------------- */

@media print {
  .auth-brand,
  .auth-toolbar {
    display: none !important;
  }
  .auth {
    display: block;
  }
}
