/* ============ داشبورد کاربر (پس از ورود) ============ */
.login-main:has(.dash:not([hidden])) {
  display: block;
  max-width: 1180px;
  padding: 18px 14px 28px;
}

.dash {
  width: 100%;
  border-radius: 22px;
  padding: 16px 16px 12px;
  background: linear-gradient(180deg, rgba(15,23,42,.94), rgba(9,14,26,.97));
  border: 1px solid rgba(56,189,248,.16);
  box-shadow: 0 24px 60px rgba(2,6,23,.5);
  backdrop-filter: blur(14px);
}

/* ---------- سربرگ ---------- */
.dash-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 14px;
}
.dash-who small { display: block; font-size: 10.5px; color: #64748b; }
.dash-who h1 { margin: 2px 0 1px; font-size: 19px; color: #f1f5f9; line-height: 1.5; }
.dash-mail { font-size: 11px; color: #94a3b8; }
.dash-side { display: flex; align-items: center; gap: 10px; }
.dash-balance {
  padding: 9px 14px; border-radius: 14px; text-align: left; min-width: 150px;
  background: rgba(34,211,238,.07); border: 1px solid rgba(34,211,238,.2);
}
.dash-balance small { display: block; font-size: 10px; color: #94a3b8; }
.dash-balance b { display: block; font-size: 17px; color: #67e8f9; font-variant-numeric: tabular-nums; }
.dash-balance em { display: block; font-style: normal; font-size: 10px; color: #a7f3d0; }
.dash-logout {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 13px; border-radius: 12px; cursor: pointer; font: inherit; font-size: 12px;
  background: rgba(244,63,94,.09); color: #fda4af; border: 1px solid rgba(244,63,94,.26);
  transition: background .18s;
}
.dash-logout:hover { background: rgba(244,63,94,.16); }

/* ---------- نوار بخش‌ها ---------- */
.dash-tabs {
  display: flex; gap: 6px; padding: 5px; margin-bottom: 14px;
  background: rgba(7,10,18,.6); border: 1px solid rgba(148,163,184,.12); border-radius: 15px;
  overflow-x: auto; scrollbar-width: none;
}
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tabs button {
  flex: 1 1 0; min-width: 104px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 10px; border: 0; border-radius: 11px; cursor: pointer;
  font: inherit; font-size: 12.5px; color: #94a3b8; background: transparent;
  transition: color .18s, background .18s, box-shadow .18s;
  white-space: nowrap;
}
.dash-tabs button .dt-ico { font-size: 13px; opacity: .8; }
.dash-tabs button:hover { color: #cbd5e1; background: rgba(148,163,184,.07); }
.dash-tabs button.active {
  color: #e8f4ff;
  background: linear-gradient(135deg, rgba(34,211,238,.2), rgba(139,92,246,.2));
  box-shadow: inset 0 0 0 1px rgba(56,189,248,.32);
}
.dash-tabs button.active .dt-ico { opacity: 1; }

/* ---------- بدنهٔ بخش‌ها ---------- */
.dash-body { position: relative; min-height: 320px; }
.dash-pane {
  position: absolute; inset-inline: 0; top: 0;
  opacity: 0; transform: translateY(10px) scale(.994);
  pointer-events: none; visibility: hidden;
  transition: opacity .26s ease, transform .26s ease, visibility 0s linear .26s;
}
.dash-pane.active {
  position: relative;
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity .3s ease, transform .3s ease, visibility 0s;
}

/* ---------- خلاصه ---------- */
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 9px; margin-bottom: 12px; }
.dash-stats .ds {
  padding: 12px 13px; border-radius: 14px;
  background: rgba(148,163,184,.05); border: 1px solid rgba(148,163,184,.12);
}
.dash-stats small { display: block; font-size: 10.5px; color: #94a3b8; }
.dash-stats b { display: block; margin-top: 4px; font-size: 16px; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.dash-stats b.up { color: #6ee7b7; }
.dash-stats b.down { color: #fda4af; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-bottom: 12px; }
.dash-tile {
  display: flex; flex-direction: column; gap: 4px; padding: 15px 15px 13px;
  border-radius: 16px; text-decoration: none;
  background: rgba(148,163,184,.05); border: 1px solid rgba(148,163,184,.13);
  transition: transform .18s, background .18s, border-color .18s;
}
.dash-tile:hover { transform: translateY(-2px); background: rgba(148,163,184,.09); border-color: rgba(148,163,184,.22); }
.dash-tile .dt-icon { font-size: 18px; color: #67e8f9; }
.dash-tile strong { font-size: 14px; color: #f1f5f9; }
.dash-tile small { font-size: 11px; color: #94a3b8; line-height: 1.9; }
.dash-tile em { font-style: normal; margin-top: 5px; font-size: 11.5px; color: #67e8f9; }
.dash-tile.accent {
  background: linear-gradient(150deg, rgba(34,211,238,.12), rgba(139,92,246,.1));
  border-color: rgba(56,189,248,.28);
}

.dash-info { display: flex; flex-direction: column; gap: 7px; }

/* ---------- قاب صفحه‌های جاسازی‌شده ---------- */
.pane-frame {
  position: relative; border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(148,163,184,.12);
  background: rgba(7,10,18,.55);
  /* fallback برای مرورگرهایی که dvh نمی‌شناسند: ارتفاع صفر = قاب نامرئی */
  height: 620px;
  height: clamp(430px, calc(100dvh - 260px), 900px);
}
.pane-frame iframe {
  display: block; width: 100%; height: 100%; border: 0;
  opacity: 0; transition: opacity .3s ease;
}
.pane-frame.loaded iframe { opacity: 1; }
.pane-frame.loaded .pane-loading { opacity: 0; visibility: hidden; }
.pane-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 12px; color: #94a3b8; background: rgba(7,10,18,.6);
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(148,163,184,.25); border-top-color: #67e8f9;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- پابرگ داشبورد ---------- */
.dash-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid rgba(148,163,184,.1);
  font-size: 11px; color: #64748b;
}
.dash-foot a { color: #94a3b8; text-decoration: none; }
.dash-foot a:hover { color: #67e8f9; }

/* ---------- موبایل: نوار پایین ---------- */
@media (max-width: 720px) {
  .login-main:has(.dash:not([hidden])) { padding: 10px 8px 12px; }
  .dash { border-radius: 18px; padding: 12px 11px 10px; }
  .dash-head { margin-bottom: 10px; }
  .dash-who h1 { font-size: 16px; }
  .dash-balance { min-width: 0; padding: 7px 11px; }
  .dash-balance b { font-size: 15px; }
  .dash-tabs {
    position: sticky; top: 6px; z-index: 6;
    background: rgba(9,14,26,.94); backdrop-filter: blur(12px);
    box-shadow: 0 8px 20px rgba(2,6,23,.45);
  }
  .pane-frame {
    height: 480px;
    height: clamp(400px, calc(100dvh - 210px), 760px);
  }
}

/* مرورگرهای قدیمی که :has نمی‌شناسند */
/* بدون :has هم چیدمان درست بماند */
body.is-dashboard .login-main {
  display: block;
  max-width: 1180px;
  padding: 18px 14px 28px;
}
body.is-dashboard .login-card { margin-inline: auto; }
body.is-dashboard .dash { max-width: 1180px; margin-inline: auto; }

@supports not selector(:has(*)) {
  .login-main { display: block; }
  .login-card { margin-inline: auto; }
  .dash { max-width: 1180px; margin-inline: auto; }
}

/* نشست داخل قاب معتبر نبود */
.pane-frame.auth-lost .pane-loading { opacity: 1; visibility: visible; }
.pane-frame.auth-lost iframe { opacity: 0; }
.pane-frame.auth-lost .pane-loading .spin { display: none; }
