/* هم‌صحبت — لایهٔ حساب کاربری: دروازهٔ ورود/ثبت‌نام، پنل حساب و اشتراک‌ها.
   از همان متغیرهای رنگ app.css استفاده می‌کند تا در هر دو پوسته هماهنگ باشد. */

.hs-auth-layer {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(120% 120% at 80% 0%, #efedfb 0%, var(--page, #f8f9fc) 55%);
  overflow-y: auto;
}

.hs-auth-layer[hidden] { display: none; }

.hs-auth-card {
  width: min(430px, 100%);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e9e9f1);
  border-radius: 22px;
  box-shadow: 0 18px 60px rgba(47, 42, 87, .12);
  padding: 22px 20px 18px;
  margin: auto;
}

.hs-auth-card.hs-wide { width: min(760px, 100%); }

.hs-auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.hs-auth-brand .hs-mark {
  width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(140deg, #7160dc, #9d8cf0); color: #fff; font-size: 19px;
}
.hs-auth-brand h1 { font-size: 17px; margin: 0; color: var(--text, #29283c); }
.hs-auth-brand p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted, #727488); }

.hs-auth-tabs { display: flex; gap: 6px; background: var(--surface-soft, #f4f4f9); padding: 4px; border-radius: 14px; margin: 16px 0 14px; }
.hs-auth-tabs button {
  flex: 1; border: 0; background: transparent; padding: 9px 8px; border-radius: 11px; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--muted, #727488); transition: .18s;
}
.hs-auth-tabs button[aria-selected="true"] { background: var(--surface, #fff); color: var(--text, #29283c); box-shadow: 0 2px 10px rgba(47, 42, 87, .08); font-weight: 700; }

.hs-field { margin-bottom: 11px; }
.hs-field label { display: block; font-size: 12px; color: var(--muted, #727488); margin-bottom: 5px; }
.hs-field input {
  width: 100%; box-sizing: border-box; padding: 11px 12px; border-radius: 12px; font: inherit; font-size: 13.5px;
  border: 1px solid var(--border, #e9e9f1); background: var(--surface, #fff); color: var(--text, #29283c);
}
.hs-field input:focus { outline: 2px solid var(--accent-soft, #efedfb); border-color: var(--accent, #7160dc); }
.hs-field input:disabled { opacity: .6; }
.hs-hint { font-size: 11px; color: var(--subtle, #8b8da0); margin: -4px 0 12px; line-height: 1.7; }

.hs-submit {
  width: 100%; border: 0; border-radius: 13px; padding: 12px; font: inherit; font-size: 14px; font-weight: 700;
  background: var(--accent, #7160dc); color: #fff; cursor: pointer; transition: .18s;
}
.hs-submit:hover:not(:disabled) { background: var(--accent-hover, #6050ca); }
.hs-submit:disabled { opacity: .55; cursor: progress; }
.hs-submit.hs-ghost { background: var(--surface-soft, #f4f4f9); color: var(--text, #29283c); border: 1px solid var(--border, #e9e9f1); }
.hs-submit.hs-danger { background: var(--danger-soft, #fff0f2); color: var(--danger, #cf5a65); border: 1px solid #f6d7dc; }

.hs-alert { border-radius: 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.9; margin-bottom: 12px; }
.hs-alert[hidden] { display: none; }
.hs-alert.hs-error { background: var(--danger-soft, #fff0f2); color: #a63c47; border: 1px solid #f4d6da; }
.hs-alert.hs-info { background: var(--accent-soft, #efedfb); color: #4e42a8; border: 1px solid #ded8f7; }
.hs-alert.hs-ok { background: #eaf7f2; color: #2c7a5f; border: 1px solid #cfeae0; }

.hs-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--accent-soft, #efedfb); border-top-color: var(--accent, #7160dc); animation: hs-spin .9s linear infinite; margin: 6px auto 10px; }
@keyframes hs-spin { to { transform: rotate(360deg); } }
.hs-checking { text-align: center; padding: 26px 8px; color: var(--muted, #727488); font-size: 13px; }

/* ---- حساب کاربری: دکمهٔ سربرگ و پنل ---- */
.hs-account-button {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border, #e9e9f1);
  background: var(--surface, #fff); color: var(--text, #29283c); border-radius: 999px; padding: 5px 11px 5px 7px;
  font: inherit; font-size: 12px; cursor: pointer; max-width: 190px;
}
.hs-account-button:hover { border-color: var(--accent, #7160dc); }
.hs-account-avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft, #efedfb); color: var(--accent, #7160dc); font-size: 11.5px; font-weight: 700; flex: none; }
.hs-account-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-account-badge { font-size: 10px; padding: 1px 7px; border-radius: 999px; color: #fff; background: var(--accent, #7160dc); }

.hs-dialog {
  position: fixed; inset: 0; z-index: 9200; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(24, 22, 44, .38); overflow-y: auto;
}
.hs-dialog[hidden] { display: none; }
.hs-panel {
  width: min(620px, 100%); max-height: min(86vh, 780px); overflow-y: auto; background: var(--surface, #fff);
  border-radius: 20px; border: 1px solid var(--border, #e9e9f1); box-shadow: 0 24px 70px rgba(20, 18, 40, .28);
  padding: 18px; margin: auto;
}
.hs-panel-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.hs-panel-head h2 { margin: 0; font-size: 15.5px; color: var(--text, #29283c); }
.hs-panel-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted, #727488); line-height: 1.8; }
.hs-close { margin-inline-start: auto; border: 0; background: var(--surface-soft, #f4f4f9); color: var(--muted, #727488); width: 30px; height: 30px; border-radius: 10px; cursor: pointer; font-size: 15px; flex: none; }

.hs-section-title { font-size: 12px; color: var(--muted, #727488); margin: 16px 0 8px; display: flex; align-items: center; gap: 6px; }
.hs-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border, #e9e9f1); }

.hs-intro { background: var(--surface-soft, #f4f4f9); border: 1px solid var(--border, #e9e9f1); border-radius: 14px; padding: 12px 13px; font-size: 12.5px; line-height: 2.05; color: var(--text, #29283c); white-space: pre-line; margin-bottom: 14px; }

.hs-plan-grid { display: grid; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.hs-plan { border: 1px solid var(--border, #e9e9f1); border-radius: 16px; padding: 13px; background: var(--surface, #fff); display: flex; flex-direction: column; gap: 8px; }
.hs-plan.hs-current { border-color: var(--accent, #7160dc); box-shadow: 0 0 0 3px var(--accent-soft, #efedfb); }
.hs-plan-head { display: flex; align-items: center; gap: 8px; }
.hs-plan-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.hs-plan-head strong { font-size: 14px; color: var(--text, #29283c); }
.hs-plan-price { margin-inline-start: auto; font-size: 12px; font-weight: 700; color: var(--accent, #7160dc); }
.hs-plan-desc { font-size: 11.5px; color: var(--muted, #727488); line-height: 1.9; }
.hs-plan-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.hs-plan-list li { font-size: 11.5px; color: var(--text, #29283c); padding-inline-start: 15px; position: relative; line-height: 1.85; }
.hs-plan-list li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: var(--green, #48a88d); font-size: 11px; }
.hs-plan-meta { font-size: 11px; color: var(--subtle, #8b8da0); display: flex; gap: 8px; flex-wrap: wrap; }
.hs-plan-actions { margin-top: auto; display: grid; gap: 6px; }
.hs-note { font-size: 11px; color: var(--subtle, #8b8da0); line-height: 1.9; }

.hs-usage { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.hs-usage th { text-align: start; color: var(--muted, #727488); font-weight: 500; padding: 6px 6px; border-bottom: 1px solid var(--border, #e9e9f1); }
.hs-usage td { padding: 7px 6px; border-bottom: 1px solid var(--border, #e9e9f1); color: var(--text, #29283c); vertical-align: middle; }
.hs-bar { height: 6px; border-radius: 999px; background: var(--surface-soft, #f4f4f9); overflow: hidden; min-width: 70px; }
.hs-bar i { display: block; height: 100%; background: var(--accent, #7160dc); }
.hs-bar.hs-full i { background: var(--danger, #cf5a65); }

.hs-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12px; }
.hs-kv dt { color: var(--muted, #727488); }
.hs-kv dd { margin: 0; color: var(--text, #29283c); }

.hs-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.hs-chip { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--surface-soft, #f4f4f9); color: var(--muted, #727488); border: 1px solid var(--border, #e9e9f1); }
.hs-chip.hs-off { background: var(--danger-soft, #fff0f2); color: #a63c47; border-color: #f4d6da; }

.hs-toast {
  position: fixed; inset-inline: 0; bottom: 18px; z-index: 9400; display: flex; justify-content: center; padding: 0 14px; pointer-events: none;
}
.hs-toast > div {
  background: #2a2740; color: #fff; font-size: 12.5px; line-height: 1.9; padding: 10px 15px; border-radius: 14px;
  max-width: min(560px, 100%); box-shadow: 0 14px 40px rgba(20, 18, 40, .3);
}
.hs-toast[hidden] { display: none; }

/* وقتی دروازه فعال است، برنامهٔ اصلی قفل و تار می‌شود. */
body.hs-locked .app-shell { filter: blur(2px); pointer-events: none; user-select: none; }
body.hs-locked .composer-area { pointer-events: none; }

:root[data-hs-popup="true"] .hs-auth-card { padding: 16px 14px; }
:root[data-hs-popup="true"] .hs-plan-grid { grid-template-columns: 1fr; }

@media (max-width: 520px) {
  .hs-panel { padding: 14px; border-radius: 16px; }
  .hs-account-button { max-width: 120px; padding: 5px 8px 5px 5px; }
  .hs-account-button span { display: none; }
}
