/* ═══════════════════════════════════════════════════════════
   بحثي — Modern Academic Dashboard (compact one-screen)
   ═══════════════════════════════════════════════════════════ */

:root {
  --bahthy-bg-0: #0A1628;
  --bahthy-bg-1: #0C1E3A;
  --bahthy-card-0: #122A4A;
  --bahthy-card-1: #0E2240;
  --bahthy-text: #F8FAFC;
  --bahthy-muted: #94A3B8;
  --bahthy-primary: #3B82F6;
  --bahthy-primary-soft: rgba(59, 130, 246, 0.18);
  --bahthy-border: rgba(255, 255, 255, 0.08);
  --bahthy-ask: #39FF14;
  --bahthy-contact: #22D3EE;
  --bahthy-home: #60A5FA;
  --bahthy-nav-h: 58px;
  --font-heading: "IBM Plex Sans Arabic", "Cairo", "Tajawal", sans-serif;
  --font-ar: "Cairo", "IBM Plex Sans Arabic", "Tajawal", sans-serif;

  --bg-primary: var(--bahthy-bg-0);
  --bg-secondary: var(--bahthy-bg-1);
  --bg-card: rgba(18, 42, 74, 0.75);
  --bg-card-hover: rgba(18, 42, 74, 0.92);
  --accent: var(--bahthy-primary);
  --accent-soft: var(--bahthy-primary-soft);
  --accent-glow: rgba(59, 130, 246, 0.4);
  --accent-hover: #60A5FA;
  --text: var(--bahthy-text);
  --text-muted: var(--bahthy-muted);
  --border: var(--bahthy-border);
  --glass-bg: rgba(10, 22, 40, 0.72);
  --glass-blur: 20px;
  --radius-lg: 18px;
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.32);
  --gradient-btn: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
}

body {
  font-family: var(--font-ar);
  background: var(--bahthy-bg-0);
  color: var(--bahthy-text);
}

body::before {
  background:
    radial-gradient(ellipse 75% 50% at 80% 5%, rgba(59, 130, 246, 0.32), transparent 55%),
    radial-gradient(ellipse 60% 45% at 15% 80%, rgba(37, 99, 235, 0.22), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(96, 165, 250, 0.1), transparent 60%),
    linear-gradient(165deg, #071525 0%, #0A1F3D 35%, #0C2A52 70%, #0A1C38 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  background-image:
    radial-gradient(1.2px 1.2px at 8% 12%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.6px 1.6px at 14% 48%, rgba(96, 165, 250, 0.7), transparent),
    radial-gradient(1.1px 1.1px at 22% 28%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1.8px 1.8px at 31% 72%, rgba(59, 130, 246, 0.65), transparent),
    radial-gradient(1.3px 1.3px at 38% 18%, rgba(167, 139, 250, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 46% 55%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1.2px 1.2px at 54% 34%, rgba(34, 211, 238, 0.55), transparent),
    radial-gradient(2px 2px at 62% 78%, rgba(59, 130, 246, 0.5), transparent),
    radial-gradient(1.1px 1.1px at 70% 22%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1.7px 1.7px at 78% 58%, rgba(168, 85, 247, 0.55), transparent),
    radial-gradient(1.3px 1.3px at 86% 40%, rgba(96, 165, 250, 0.6), transparent),
    radial-gradient(1.4px 1.4px at 92% 82%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1.6px 1.6px at 18% 88%, rgba(74, 222, 128, 0.4), transparent),
    radial-gradient(1.2px 1.2px at 58% 8%, rgba(251, 191, 36, 0.35), transparent),
    radial-gradient(1.5px 1.5px at 42% 92%, rgba(96, 165, 250, 0.45), transparent);
  animation: bahthyBubblesDrift 18s ease-in-out infinite alternate;
}

@keyframes bahthyBubblesDrift {
  from { transform: translate3d(0, 0, 0); opacity: 0.45; }
  to { transform: translate3d(0, -6px, 0); opacity: 0.65; }
}

/* ── One-screen app shell ───────────────────────────────── */
#appScreen.screen.active {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

#appScreen > header,
#appScreen > main,
#appScreen > footer {
  position: relative;
  z-index: 1;
}

#appScreen.screen.active > main.bahthy-main,
#appScreen > main.bahthy-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 8px clamp(14px, 2.5vw, 28px) 6px;
}

#viewDashboard.view-section.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.bahthy-dash-frame {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  padding: 8px 4px 6px;
  border: none;
  background: transparent;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.bahthy-dash-frame::before,
.bahthy-dash-frame::after {
  display: none;
}

.bahthy-dash-frame > #viewDashboard {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
}

/* ── Navbar ─────────────────────────────────────────────── */
#appScreen .main-header.bahthy-nav {
  flex: 0 0 auto;
  height: var(--bahthy-nav-h);
  min-height: var(--bahthy-nav-h);
  padding: 0;
  padding-top: env(safe-area-inset-top, 0);
  background: rgba(8, 24, 48, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(96, 165, 250, 0.15);
  box-shadow: none;
}

#appScreen .bahthy-nav-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  height: var(--bahthy-nav-h);
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(14px, 2.5vw, 28px);
}

#appScreen .bahthy-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 1.28rem;
  font-weight: 800;
  color: #F8FAFC;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

#appScreen .bahthy-nav-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  color: #93C5FD;
  overflow: hidden;
  padding: 0;
}

#appScreen .bahthy-nav-brand-logo {
  width: 34px;
  height: 34px;
  display: block;
  border-radius: 10px;
  object-fit: cover;
}

#appScreen .bahthy-nav-links {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
}

#appScreen .bahthy-nav-link {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 40, 72, 0.42);
  font-family: var(--font-ar);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#appScreen .bahthy-nav-link--home {
  color: var(--bahthy-home);
}
#appScreen .bahthy-nav-link--home.is-active {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.42);
  box-shadow: inset 0 -2px 0 #3B82F6, inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#appScreen .bahthy-nav-link--ask {
  color: var(--bahthy-ask);
  text-shadow: 0 0 12px rgba(57, 255, 20, 0.45);
}
#appScreen .bahthy-nav-link--ask:hover,
#appScreen .bahthy-nav-link--ask.is-active {
  background: rgba(57, 255, 20, 0.1);
  border-color: rgba(57, 255, 20, 0.35);
}

#appScreen .bahthy-nav-link--contact {
  color: var(--bahthy-contact);
}
#appScreen .bahthy-nav-link--contact:hover,
#appScreen .bahthy-nav-link--contact.is-active {
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.35);
}

#appScreen .bahthy-nav-headset,
#appScreen .bahthy-nav-phone {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
}

#appScreen .bahthy-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#appScreen .bahthy-nav .btn-upgrade-header,
#appScreen .bahthy-nav .btn-upgrade {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%) !important;
  color: #FFFFFF !important;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.45) !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  border-radius: 999px !important;
  padding: 8px 16px !important;
  font-size: 0.9rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.01em;
}

#appScreen .bahthy-nav .points-balance {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #F8FAFC;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

#appScreen .bahthy-nav .btn-qr,
#appScreen .bahthy-nav .theme-toggle,
#appScreen .bahthy-nav .btn-admin-panel {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #94A3B8;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
}

#appScreen .bahthy-nav .btn-logout {
  width: auto;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444 !important;
  font-weight: 700;
  font-size: 0.82rem;
}

#appScreen .bahthy-nav .btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.55);
  color: #F87171 !important;
}

#appScreen .bahthy-nav .header-slot--ask,
#appScreen .bahthy-nav .header-middle,
#appScreen .bahthy-nav .btn-header-ask,
#appScreen .bahthy-nav .btn-saved-works,
#appScreen .subscription-plan-dropdown {
  display: none !important;
}

#appScreen .bahthy-nav .action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Hero (compact) ─────────────────────────────────────── */
#viewDashboard .dashboard-hero {
  text-align: center;
  margin: 4px auto 10px;
  padding: 2px 8px 0;
  max-width: 720px;
  flex: 0 0 auto;
}

#viewDashboard .dashboard-hero-brand { display: none; }

#viewDashboard .dashboard-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 2.2vw, 1.65rem);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  background: none;
  -webkit-text-fill-color: #FFFFFF;
  margin: 0 0 6px;
}

#viewDashboard .dashboard-hero-desc {
  font-size: clamp(0.78rem, 1.2vw, 0.92rem);
  color: #94A3B8;
  margin: 0 auto;
  max-width: 560px;
  line-height: 1.55;
}

#viewDashboard .dashboard-hero::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: #3B82F6;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.45);
}

/* ── Cards ──────────────────────────────────────────────── */
#viewDashboard #cardsGrid.grid,
#cardsGrid.bahthy-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 1100px;
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  align-content: stretch;
}

#cardsGrid.bahthy-cards .card {
  min-height: 0;
  height: 100%;
  padding: 16px 16px 14px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(160deg, rgba(18, 48, 88, 0.88) 0%, rgba(12, 32, 62, 0.95) 100%);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(0, 20, 50, 0.35);
  transform: none;
  justify-content: flex-start;
}

#cardsGrid.bahthy-cards .card::before {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), transparent 55%);
}

#cardsGrid.bahthy-cards .card:hover {
  transform: scale(1.025);
  border: none;
  background: linear-gradient(160deg, #163A6B 0%, #0F2A52 100%);
  box-shadow: 0 14px 36px rgba(0, 30, 70, 0.45);
}

#cardsGrid.bahthy-cards .card .card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

#cardsGrid.bahthy-cards .card:hover .card-icon-wrap {
  transform: none;
  filter: none;
}

#cardsGrid.bahthy-cards .card .card-icon-svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.1;
  color: #FFFFFF;
  filter: drop-shadow(0 0 0.5px rgba(255, 255, 255, 0.9)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
  paint-order: stroke fill;
}

#cardsGrid.bahthy-cards .card .title {
  font-family: var(--font-heading);
  font-size: clamp(0.95rem, 1.35vw, 1.15rem);
  font-weight: 700;
  color: #F8FAFC;
  margin: 0 0 6px;
  line-height: 1.3;
}

#cardsGrid.bahthy-cards .card .sub {
  font-size: clamp(0.72rem, 1vw, 0.84rem);
  color: #94A3B8;
  line-height: 1.45;
  margin: 0;
}

#cardsGrid .card[data-id="sourcesLibraries"] .card-icon-wrap {
  color: #fff;
  background: linear-gradient(145deg, #22D3EE 0%, #06B6D4 48%, #0891B2 100%);
  border-color: rgba(103, 232, 249, 0.45);
  box-shadow:
    0 0 10px rgba(34, 211, 238, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
#cardsGrid .card[data-id="reportTemplate"] .card-icon-wrap {
  color: #fff;
  background: linear-gradient(145deg, #C084FC 0%, #A855F7 48%, #7E22CE 100%);
  border-color: rgba(216, 180, 254, 0.45);
  box-shadow:
    0 0 10px rgba(168, 85, 247, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
#cardsGrid .card[data-id="plagiarism"] .card-icon-wrap {
  color: #fff;
  background: linear-gradient(145deg, #60A5FA 0%, #3B82F6 48%, #2563EB 100%);
  border-color: rgba(147, 197, 253, 0.45);
  box-shadow:
    0 0 10px rgba(59, 130, 246, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
#cardsGrid .card[data-id="academicPro"] .card-icon-wrap {
  color: #fff;
  background: linear-gradient(145deg, #A78BFA 0%, #8B5CF6 48%, #6D28D9 100%);
  border-color: rgba(196, 181, 253, 0.45);
  box-shadow:
    0 0 10px rgba(139, 92, 246, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
#cardsGrid .card[data-id="statsLab"] .card-icon-wrap {
  color: #fff;
  background: linear-gradient(145deg, #FBBF24 0%, #F59E0B 48%, #D97706 100%);
  border-color: rgba(253, 230, 138, 0.45);
  box-shadow:
    0 0 10px rgba(245, 158, 11, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
#cardsGrid .card[data-id="research"] .card-icon-wrap {
  color: #fff;
  background: linear-gradient(145deg, #4ADE80 0%, #22C55E 48%, #16A34A 100%);
  border-color: rgba(134, 239, 172, 0.45);
  box-shadow:
    0 0 10px rgba(34, 197, 94, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
#cardsGrid .card[data-id="editor"] .card-icon-wrap {
  color: #fff;
  background: linear-gradient(145deg, #94A3B8 0%, #64748B 48%, #475569 100%);
  border-color: rgba(203, 213, 225, 0.4);
  box-shadow:
    0 0 8px rgba(100, 116, 139, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* غلاف النص + سهم البطاقة (موبايل) */
#cardsGrid.bahthy-cards .card .card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
#cardsGrid.bahthy-cards .card .card-chevron {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  color: #64748B;
  opacity: 0.85;
}
#cardsGrid.bahthy-cards .card .card-chevron svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

/* ── Footer compact ──────────────────────────────────────── */
.bahthy-footer {
  flex: 0 0 auto;
  background: #071830;
  border-top: 1px solid rgba(59, 130, 246, 0.18);
  margin-top: 0;
  padding: 10px 0 8px;
  z-index: 1;
}

.bahthy-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(14px, 2.5vw, 28px);
}

.bahthy-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.bahthy-footer-item {
  text-align: center;
  padding: 2px 6px;
}

.bahthy-footer-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 6px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #3B82F6;
}

.bahthy-footer-icon svg {
  width: 18px;
  height: 18px;
}

.bahthy-footer-item h3 {
  margin: 0 0 2px;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  color: #F8FAFC;
}

.bahthy-footer-item p {
  margin: 0;
  font-size: 0.7rem;
  color: #94A3B8;
  line-height: 1.35;
}

.bahthy-footer-copy {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  color: #64748B;
  font-size: 0.72rem;
}

.bahthy-footer-copy span {
  color: #60A5FA;
  font-weight: 700;
}

/* Hide float star on dashboard one-screen to reduce clutter */
#appScreen.active #chatFloatStar {
  display: none !important;
}

/* ── Subscribe modal ────────────────────────────────────── */
.bahthy-sub-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.bahthy-sub-modal.is-open {
  display: flex !important;
}

.bahthy-sub-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
}

.bahthy-sub-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(165deg, #1A2337 0%, #0F172A 100%);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  padding: 28px 24px 22px;
  animation: bahthySubIn 0.28s ease;
}

@keyframes bahthySubIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.bahthy-sub-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #94A3B8;
  font-size: 1.3rem;
  cursor: pointer;
}

.bahthy-sub-head {
  text-align: center;
  margin-bottom: 18px;
}

.bahthy-sub-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);
  color: #93C5FD;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.bahthy-sub-head h2 {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: #F8FAFC;
}

.bahthy-sub-head p {
  margin: 0;
  color: #94A3B8;
  font-size: 0.88rem;
  line-height: 1.5;
}

.bahthy-sub-plans {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bahthy-sub-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #F8FAFC;
  font-family: var(--font-ar);
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  text-align: right;
}

.bahthy-sub-plan:hover {
  border-color: #3B82F6;
  background: rgba(59, 130, 246, 0.12);
}

.bahthy-sub-plan-pts { font-size: 1rem; }
.bahthy-sub-plan-price {
  color: #60A5FA;
  font-size: 0.95rem;
}

.bahthy-sub-note {
  margin: 14px 0 0;
  text-align: center;
  color: #64748B;
  font-size: 0.78rem;
}

/* ── Responsive — mobile professional ───────────────────── */
@media (max-width: 980px) {
  #viewDashboard #cardsGrid.grid,
  #cardsGrid.bahthy-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  #appScreen .bahthy-nav-links { gap: 4px; }
  #appScreen .bahthy-nav-link { font-size: 0.82rem; padding: 5px 7px; }
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    overflow-y: hidden;
    height: 100%;
    overscroll-behavior: none;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  #appScreen.screen.active {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    height: calc(var(--bahthy-vh, 1vh) * 100);
    max-height: calc(var(--bahthy-vh, 1vh) * 100);
    min-height: calc(var(--bahthy-vh, 1vh) * 100);
    overflow: hidden;
  }

  .bahthy-desktop-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .bahthy-desktop-column {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  #appScreen.screen.active > main.bahthy-main,
  #appScreen > main.bahthy-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    /* الفوتر داخل التدفق — لا حاجة لهامش كبير */
    padding: 5px 12px 6px;
  }

  .bahthy-dash-frame {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .bahthy-dash-frame > #viewDashboard {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  #viewDashboard.view-section.active {
    overflow: hidden;
    gap: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  /* Header: صفّان ثابتان (مثل iOS) — بدون flex-wrap العشوائي */
  #appScreen .main-header.bahthy-nav {
    position: relative;
    top: auto;
    z-index: 200;
    height: auto;
    min-height: unset;
    flex: 0 0 auto;
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(7, 22, 42, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(96, 165, 250, 0.2);
  }

  #appScreen .bahthy-nav-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand start end"
      "links links links";
    align-items: center;
    column-gap: 8px;
    row-gap: 8px;
    height: auto;
    min-height: 48px;
    padding: 8px 12px 10px;
  }

  #appScreen .bahthy-nav-brand {
    grid-area: brand;
    font-size: 1.12rem;
    gap: 6px;
    order: unset;
    flex: 0 0 auto;
    min-width: 0;
  }

  #appScreen .bahthy-nav-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  #appScreen .bahthy-nav-brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  #appScreen .bahthy-nav-brand-mark svg {
    width: 16px;
    height: 16px;
  }

  #appScreen .bahthy-nav-actions,
  #appScreen .bahthy-nav-actions--end,
  #appScreen .bahthy-nav-actions--start {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 0;
    height: auto;
    margin: 0;
  }

  /* يسار الصف الأول: ثيم + خروج */
  #appScreen .bahthy-nav-actions--start {
    grid-area: start;
    order: unset;
    justify-content: flex-start;
    margin-inline-start: 0;
  }

  /* يمين الصف الأول: نقاط + اشتراك */
  #appScreen .bahthy-nav-actions--end {
    grid-area: end;
    order: unset;
    justify-content: flex-end;
    direction: ltr;
  }

  #appScreen .bahthy-nav .user-info {
    min-width: 0;
  }

  #appScreen .bahthy-nav .points-balance {
    font-size: 0.72rem;
    padding: 5px 8px;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #appScreen .bahthy-nav .btn-upgrade-header,
  #appScreen .bahthy-nav .btn-upgrade {
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    padding: 6px 12px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 55%, #1D4ED8 100%) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    box-shadow:
      0 0 0 2px rgba(59, 130, 246, 0.35),
      0 6px 14px rgba(37, 99, 235, 0.45) !important;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  }

  #appScreen .bahthy-nav .btn-upgrade-header svg {
    display: inline-block !important;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
  }

  #appScreen .bahthy-nav .btn-qr,
  #appScreen .bahthy-nav .btn-admin-panel,
  #appScreen .bahthy-nav .bahthy-notif-btn,
  #appScreen .bahthy-nav .bahthy-user-chip {
    display: none !important;
  }

  /* للمدير فقط: إبقاء مدخل لوحة الأدمن والعداد ظاهراً على الموبايل */
  body.is-admin #appScreen .bahthy-nav .btn-admin-panel.bahthy-admin-btn {
    display: inline-flex !important;
    position: relative;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0 !important;
    border-radius: 10px;
    font-size: 1rem !important;
  }

  body.is-admin #appScreen .admin-esc-badge {
    position: absolute;
    top: -6px;
    inset-inline-start: -7px;
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 2px solid #071830;
    border-radius: 999px;
    background: #EF4444;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(239, 68, 68, .5);
    z-index: 3;
  }

  #appScreen .bahthy-nav .btn-logout {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    padding: 6px 10px !important;
    min-height: 34px;
    border-radius: 10px !important;
    color: #FCA5A5 !important;
    background: rgba(239, 68, 68, 0.14) !important;
    border: 1px solid rgba(248, 113, 113, 0.35) !important;
    white-space: nowrap;
  }

  #appScreen .bahthy-nav .theme-toggle {
    display: inline-flex !important;
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    align-items: center;
    justify-content: center;
  }

  #appScreen .bahthy-nav .action-buttons {
    gap: 4px;
  }

  /* الصف الثاني فقط: التبويبات */
  #appScreen .bahthy-nav-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-area: links;
    order: unset;
    flex: unset;
    width: 100%;
    gap: 6px;
    padding: 5px;
    border-radius: 16px;
    background: rgba(6, 18, 36, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.14);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 8px 20px rgba(0, 12, 28, 0.28);
  }

  #appScreen .bahthy-nav-link {
    flex: none;
    justify-content: center;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 10px 6px;
    border-radius: 12px;
    min-height: 42px;
    background: rgba(15, 40, 72, 0.55);
    border: 1px solid rgba(96, 165, 250, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  }

  #appScreen .bahthy-nav-link.is-active,
  #appScreen .bahthy-nav-link--home.is-active {
    background: rgba(59, 130, 246, 0.24);
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: inset 0 -2px 0 #3B82F6, 0 0 12px rgba(59, 130, 246, 0.15);
  }

  #appScreen .bahthy-nav-headset,
  #appScreen .bahthy-nav-phone {
    width: 16px;
    height: 16px;
  }

  /* إطار اللوحة — ملغى على الموبايل */
  .bahthy-dash-frame {
    border: none !important;
    border-radius: 0;
    padding: 4px 0 8px;
    background: transparent;
    box-shadow: none !important;
  }

  .bahthy-dash-frame::before,
  .bahthy-dash-frame::after {
    display: none !important;
  }

  /* Hero — عنوان ووصف أوضح */
  #viewDashboard .dashboard-hero {
    margin: 0 auto 6px;
    padding: 4px 10px 2px;
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
  }

  #viewDashboard .dashboard-hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 14px 6px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(14, 36, 68, 0.45) 0%, rgba(10, 28, 55, 0.25) 100%);
    border: 1px solid rgba(96, 165, 250, 0.14);
    box-shadow: 0 4px 16px rgba(0, 12, 32, 0.2);
  }

  #viewDashboard .dashboard-hero-title {
    font-size: 1.08rem !important;
    line-height: 1.4;
    margin: 0;
    letter-spacing: -0.02em;
    font-weight: 800;
    text-align: center;
  }

  #viewDashboard .dashboard-hero-desc {
    font-size: 0.78rem !important;
    line-height: 1.5;
    max-width: 22em;
    margin: 0 auto;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #94A3B8;
  }

  #viewDashboard .dashboard-hero::after {
    width: 44px;
    height: 2.5px;
    margin: 6px auto 0;
  }

  /* بطاقات — ارتفاع كافٍ للنص (بدون قصّ على أندرويد) */
  #viewDashboard #cardsGrid.grid,
  #cardsGrid.bahthy-cards {
    display: flex !important;
    flex-direction: column;
    grid-template-columns: none !important;
    grid-template-rows: none;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 0;
    align-content: stretch;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #cardsGrid.bahthy-cards .card {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto;
    column-gap: 12px;
    row-gap: 0;
    align-items: center;
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 58px !important;
    max-height: none !important;
    padding: 12px 14px !important;
    border-radius: 15px;
    border: 1px solid rgba(96, 165, 250, 0.1) !important;
    background: linear-gradient(160deg, rgba(14, 36, 68, 0.92) 0%, rgba(10, 28, 55, 0.98) 100%) !important;
    box-shadow: 0 8px 22px rgba(0, 16, 40, 0.32);
    transform: none !important;
    text-align: right;
    overflow: visible !important;
  }

  #cardsGrid.bahthy-cards .card:hover,
  #cardsGrid.bahthy-cards .card:active {
    transform: none !important;
    background: linear-gradient(160deg, rgba(18, 48, 88, 0.96) 0%, rgba(12, 36, 68, 1) 100%) !important;
    border-color: rgba(96, 165, 250, 0.22) !important;
  }

  #cardsGrid.bahthy-cards .card .card-icon-wrap {
    grid-column: 1;
    grid-row: 1;
    width: 44px;
    height: 44px;
    margin: 0;
    border-radius: 14px;
    align-self: center;
    border-width: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  #cardsGrid.bahthy-cards .card .card-icon-svg {
    width: 26px;
    height: 26px;
    stroke-width: 2.15;
    color: #FFFFFF;
    filter: drop-shadow(0 0 0.5px rgba(255, 255, 255, 0.95)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
  }

  #cardsGrid.bahthy-cards .card .card-text {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 0;
    overflow: visible !important;
  }

  #cardsGrid.bahthy-cards .card .title {
    display: block !important;
    font-size: 0.95rem !important;
    font-weight: 800;
    margin: 0 !important;
    padding: 0 !important;
    color: #F8FAFC !important;
    -webkit-text-fill-color: #F8FAFC;
    line-height: 1.45 !important;
    max-height: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #cardsGrid.bahthy-cards .card .sub {
    display: block !important;
    font-size: 0.72rem !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #94A3B8 !important;
    max-height: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #cardsGrid.bahthy-cards .card .card-chevron {
    display: flex;
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    color: #94A3B8;
    opacity: 0.75;
    margin-inline-start: 2px;
    flex-shrink: 0;
  }

  #cardsGrid.bahthy-cards .card .card-chevron svg {
    width: 17px;
    height: 17px;
    stroke-width: 1.5;
  }

  /* شريط المزايا — داخل التدفق (مو ثابت) حتى لا يغطي البطاقات على أندرويد */
  .bahthy-footer {
    display: block !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100%;
    z-index: 5;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    margin-top: auto !important;
    padding: 6px 8px max(10px, env(safe-area-inset-bottom, 0px));
    background: #071830;
    border-top: 1px solid rgba(59, 130, 246, 0.18);
    box-sizing: border-box;
    transform: none !important;
  }

  #viewDashboard #cardsGrid.grid,
  #cardsGrid.bahthy-cards {
    margin-bottom: 0;
    padding-bottom: 4px;
  }

  .bahthy-footer-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
  }

  .bahthy-footer-item {
    padding: 1px 1px 0;
    border-radius: 8px;
    background: transparent;
    border: none;
  }

  .bahthy-footer-icon {
    width: 18px;
    height: 18px;
    margin: 0 auto 1px;
    border-radius: 6px;
  }

  .bahthy-footer-icon svg {
    width: 10px;
    height: 10px;
  }

  .bahthy-footer-item h3 {
    font-size: 0.56rem;
    margin: 0;
    line-height: 1.1;
  }

  .bahthy-footer-item p {
    display: none;
  }

  .bahthy-footer-copy {
    margin: 6px 0 0;
    padding: 5px 0 0;
    font-size: 0.52rem;
    line-height: 1.2;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
  }

  #appScreen.active #chatFloatStar {
    display: none !important;
  }

  #appScreen.active #chatFloatStar.chat-float-star {
    background: rgba(20, 32, 52, 0.88);
    border: 1px solid rgba(191, 219, 254, 0.28);
    box-shadow:
      0 0 16px rgba(148, 183, 220, 0.22),
      0 6px 18px rgba(0, 12, 28, 0.35);
  }

  #appScreen.active #chatFloatStar .chat-float-sparkles {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 0 6px rgba(191, 219, 254, 0.55));
  }
}

@media (max-width: 480px) {
  #viewDashboard #cardsGrid.grid,
  #cardsGrid.bahthy-cards {
    grid-template-columns: 1fr;
  }

  #viewDashboard .dashboard-hero-title {
    font-size: 1.02rem !important;
  }

  #viewDashboard .dashboard-hero-desc {
    font-size: 0.76rem !important;
  }

  #appScreen .bahthy-nav .btn-upgrade-header,
  #appScreen .bahthy-nav .btn-upgrade {
    font-size: 0.7rem !important;
    padding: 5px 8px !important;
  }
}

/* ── Desktop dashboard (sidebar + hero + stats) ─────────── */
.bahthy-dash-sidebar,
.bahthy-stats-bar,
.bahthy-desktop-search,
.dashboard-hero-visual,
.dashboard-hero-title-desktop,
.card-cta,
.bahthy-user-chip,
.bahthy-notif-btn,
.bahthy-sidebar-help,
.bahthy-user-chevron,
.bahthy-points-star {
  display: none;
}

.dashboard-hero-title-mobile {
  display: inline;
}

@media (min-width: 769px) {
  :root {
    --bahthy-sidebar-w: 228px;
    --bahthy-nav-h: 64px;
  }

  #appScreen.screen.active > .bahthy-desktop-shell {
    flex: 1 1 auto;
    min-height: 0;
  }

  #appScreen.screen.active {
    overflow: hidden;
  }

  .bahthy-desktop-shell {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    width: 100%;
  }

  .bahthy-desktop-column {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .bahthy-dash-sidebar {
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--bahthy-sidebar-w);
    width: var(--bahthy-sidebar-w);
    min-height: 0;
    padding: 14px 10px 12px;
    background: linear-gradient(180deg, rgba(6, 16, 32, 0.98) 0%, rgba(8, 22, 44, 0.96) 100%);
    border-inline-start: 1px solid rgba(96, 165, 250, 0.12);
    overflow: hidden !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
  }

  .bahthy-dash-sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  .bahthy-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 6px 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(96, 165, 250, 0.1);
    flex: 0 0 auto;
  }

  .bahthy-sidebar-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 20, 50, 0.35);
  }

  .bahthy-sidebar-brand-mark img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 12px;
  }

  .bahthy-sidebar-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .bahthy-sidebar-brand-text strong {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    color: #F8FAFC;
  }

  .bahthy-sidebar-brand-text span {
    font-size: 0.68rem;
    color: #64748B;
    line-height: 1.3;
  }

  .bahthy-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 0 0 auto;
    min-height: 0;
  }

  .bahthy-sidebar-link,
  .bahthy-sidebar-tool,
  .bahthy-sidebar-contact {
    appearance: none;
    border: none;
    background: transparent;
    font-family: var(--font-ar);
    cursor: pointer;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: right;
    border-radius: 12px;
    transition: background 0.2s ease, color 0.2s ease;
  }

  .bahthy-sidebar-link,
  .bahthy-sidebar-tool {
    padding: 8px 10px;
    font-size: 0.84rem;
    font-weight: 600;
    color: #94A3B8;
  }

  .bahthy-sidebar-icon {
    width: 22px;
    height: 22px;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .bahthy-sidebar-icon svg {
    width: 20px;
    height: 20px;
    opacity: 1;
    stroke-width: 1.9;
  }

  /* القائمة الرئيسية — لون الرمز فقط */
  .bahthy-sidebar-icon--home { color: #60A5FA; }
  .bahthy-sidebar-icon--research { color: #4ADE80; }
  .bahthy-sidebar-icon--report { color: #C084FC; }
  .bahthy-sidebar-icon--sources { color: #22D3EE; }
  .bahthy-sidebar-icon--plagiarism { color: #60A5FA; }
  .bahthy-sidebar-icon--stats { color: #FBBF24; }
  .bahthy-sidebar-icon--discuss { color: #A78BFA; }

  /* أدوات سريعة — بدون ألوان */
  .bahthy-sidebar-tool .bahthy-sidebar-icon,
  .bahthy-sidebar-icon--fav,
  .bahthy-sidebar-icon--history,
  .bahthy-sidebar-icon--files,
  .bahthy-sidebar-icon--settings {
    color: #94A3B8 !important;
  }

  .bahthy-sidebar-tool:hover .bahthy-sidebar-icon {
    color: #CBD5E1 !important;
  }

  /* تواصل معنا — أيقونة بسيطة */
  .bahthy-sidebar-icon--contact {
    color: #60A5FA;
  }

  .bahthy-sidebar-link svg,
  .bahthy-sidebar-tool svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 1;
  }

  .bahthy-sidebar-link:hover,
  .bahthy-sidebar-tool:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #E2E8F0;
  }

  .bahthy-sidebar-link.is-active {
    background: rgba(59, 130, 246, 0.22);
    color: #F8FAFC;
    box-shadow: inset 3px 0 0 #3B82F6;
  }

  .bahthy-sidebar-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(96, 165, 250, 0.1);
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .bahthy-sidebar-section-title {
    margin: 0 0 8px;
    padding: 0 12px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #64748B;
    letter-spacing: 0.02em;
  }

  .bahthy-sidebar-contact {
    margin-top: auto;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.22);
    color: #22D3EE;
    font-size: 0.88rem;
    font-weight: 700;
  }

  .bahthy-sidebar-help {
    margin-top: auto;
    flex: 0 0 auto;
    padding: 14px 12px;
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(15, 40, 72, 0.9), rgba(8, 24, 48, 0.95));
    border: 1px solid rgba(96, 165, 250, 0.16);
  }

  .bahthy-sidebar-help-top {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
  }

  .bahthy-sidebar-help-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .bahthy-sidebar-help-text strong {
    font-size: 0.86rem;
    color: #F8FAFC;
    font-weight: 700;
  }

  .bahthy-sidebar-help-text span {
    font-size: 0.7rem;
    color: #64748B;
    line-height: 1.35;
  }

  .bahthy-sidebar-contact {
    margin-top: 0;
    width: 100%;
    justify-content: center;
    flex-direction: row;
    padding: 11px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border: none;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
  }

  .bahthy-sidebar-contact svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #fff;
  }

  .bahthy-sidebar-contact .bahthy-sidebar-icon {
    margin-inline-end: 2px;
  }

  .bahthy-sidebar-contact:hover {
    background: linear-gradient(135deg, #60A5FA 0%, #3B82F6 100%);
    filter: brightness(1.05);
  }

  #appScreen .main-header.bahthy-nav {
    height: var(--bahthy-nav-h);
    min-height: var(--bahthy-nav-h);
    max-height: var(--bahthy-nav-h);
    background: rgba(6, 18, 36, 0.88);
    display: flex;
    align-items: center;
    flex: 0 0 auto;
  }

  #appScreen .bahthy-nav-inner {
    grid-template-columns: max-content minmax(240px, 1fr) max-content;
    max-width: none;
    width: 100%;
    height: var(--bahthy-nav-h);
    min-height: var(--bahthy-nav-h);
    padding: 0 16px;
    gap: 10px;
    align-items: center;
    display: grid;
  }

  #appScreen .bahthy-nav-brand,
  #appScreen .bahthy-nav-links {
    display: none !important;
  }

  .bahthy-desktop-search {
    display: flex;
    align-items: center;
    gap: 10px;
    grid-column: 2;
    justify-self: stretch;
    align-self: center;
    padding: 0 14px;
    height: 40px;
    border-radius: 12px;
    background: rgba(15, 40, 72, 0.75);
    border: 1px solid rgba(96, 165, 250, 0.18);
  }

  .bahthy-desktop-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: #F8FAFC;
    font-family: var(--font-ar);
    font-size: 0.9rem;
    outline: none;
    line-height: 1;
  }

  .bahthy-desktop-search-input::placeholder {
    color: #64748B;
  }

  .bahthy-desktop-search-icon {
    color: #64748B;
    flex-shrink: 0;
  }

  /* ترتيب مطابق للصورة: النقاط → اشتراك → الجرس → الصورة/الاسم */
  #appScreen .bahthy-nav-actions--end {
    grid-column: 1;
    direction: ltr;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: nowrap !important;
    align-self: center;
    height: 42px;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none;
  }

  /* يسار: إعدادات المدير → ثيم → QR → خروج */
  #appScreen .bahthy-nav-actions--start {
    grid-column: 3;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: nowrap !important;
    align-self: center;
    height: 42px;
    margin: 0 !important;
    padding: 0 !important;
  }

  #appScreen .bahthy-nav-actions,
  #appScreen .bahthy-nav-actions--end,
  #appScreen .bahthy-nav-actions--start {
    display: inline-flex !important;
    align-items: center !important;
  }

  #appScreen .bahthy-nav-actions > *,
  #appScreen .bahthy-nav-actions .subscription-dropdown-wrap,
  #appScreen .bahthy-nav-actions .bahthy-points-wrap,
  #appScreen .bahthy-nav-actions .user-info {
    display: inline-flex !important;
    align-items: center !important;
    align-self: center !important;
    margin: 0 !important;
    flex-shrink: 0;
    height: 40px;
  }

  .bahthy-user-chip {
    display: inline-flex !important;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 4px 0 10px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #F8FAFC;
    cursor: pointer;
    font-family: var(--font-ar);
    line-height: 1;
  }

  .bahthy-user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    text-align: right;
  }

  .bahthy-user-meta strong {
    max-width: 110px;
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bahthy-user-meta small {
    font-size: 0.68rem;
    color: #64748B;
    line-height: 1.1;
  }

  .bahthy-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(96, 165, 250, 0.35);
  }

  .bahthy-notif-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #E2E8F0;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    margin: 0;
  }

  #appScreen .bahthy-nav-actions--start .btn-logout,
  #appScreen .bahthy-nav-actions--start .btn-qr,
  #appScreen .bahthy-nav-actions--start .theme-toggle,
  #appScreen .bahthy-nav-actions--start .bahthy-admin-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-width: 40px;
    padding: 0 12px;
    margin: 0;
    border-radius: 12px;
    border: 1px solid rgba(96, 165, 250, 0.16);
    background: rgba(15, 40, 72, 0.65);
    color: #E2E8F0;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
  }

  #appScreen .bahthy-nav-actions--start .btn-logout {
    color: #FCA5A5;
    border-color: rgba(248, 113, 113, 0.3);
  }

  #appScreen .bahthy-nav-actions--start .bahthy-admin-btn {
    color: #93C5FD;
    border-color: rgba(96, 165, 250, 0.28);
  }

  /* دوائر متوهجة خلف البطاقات — أقوى وأكثر */
  .bahthy-dash-frame::before {
    content: "";
    display: block !important;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
    background-image:
      radial-gradient(circle 180px at 5% 16%, rgba(59, 130, 246, 0.42), transparent 70%),
      radial-gradient(circle 150px at 95% 12%, rgba(96, 165, 250, 0.36), transparent 70%),
      radial-gradient(circle 200px at 50% 50%, rgba(37, 99, 235, 0.28), transparent 68%),
      radial-gradient(circle 140px at 12% 80%, rgba(34, 211, 238, 0.28), transparent 70%),
      radial-gradient(circle 160px at 85% 76%, rgba(167, 139, 250, 0.3), transparent 70%),
      radial-gradient(circle 120px at 66% 24%, rgba(59, 130, 246, 0.34), transparent 70%),
      radial-gradient(circle 100px at 30% 36%, rgba(251, 191, 36, 0.16), transparent 70%),
      radial-gradient(circle 130px at 74% 50%, rgba(56, 189, 248, 0.24), transparent 70%),
      radial-gradient(circle 110px at 26% 64%, rgba(129, 140, 248, 0.26), transparent 70%),
      radial-gradient(circle 95px at 90% 40%, rgba(59, 130, 246, 0.26), transparent 70%),
      radial-gradient(circle 115px at 40% 90%, rgba(34, 211, 238, 0.22), transparent 70%),
      radial-gradient(circle 100px at 56% 10%, rgba(147, 197, 253, 0.24), transparent 70%),
      radial-gradient(circle 90px at 48% 70%, rgba(96, 165, 250, 0.22), transparent 70%),
      radial-gradient(circle 80px at 16% 44%, rgba(192, 132, 252, 0.2), transparent 70%),
      radial-gradient(circle 4px at 10% 28%, rgba(147, 197, 253, 1), transparent 70%),
      radial-gradient(circle 3px at 18% 48%, rgba(255, 255, 255, 0.9), transparent 70%),
      radial-gradient(circle 3.5px at 24% 72%, rgba(96, 165, 250, 1), transparent 70%),
      radial-gradient(circle 2.8px at 32% 22%, rgba(255, 255, 255, 0.75), transparent 70%),
      radial-gradient(circle 4px at 40% 56%, rgba(34, 211, 238, 1), transparent 70%),
      radial-gradient(circle 3px at 48% 18%, rgba(192, 132, 252, 0.95), transparent 70%),
      radial-gradient(circle 3.2px at 52% 74%, rgba(147, 197, 253, 0.95), transparent 70%),
      radial-gradient(circle 2.6px at 58% 40%, rgba(255, 255, 255, 0.8), transparent 70%),
      radial-gradient(circle 3.8px at 66% 64%, rgba(59, 130, 246, 1), transparent 70%),
      radial-gradient(circle 3px at 72% 20%, rgba(251, 191, 36, 0.8), transparent 70%),
      radial-gradient(circle 3.4px at 78% 52%, rgba(167, 139, 250, 0.95), transparent 70%),
      radial-gradient(circle 2.5px at 84% 34%, rgba(255, 255, 255, 0.7), transparent 70%),
      radial-gradient(circle 4px at 90% 68%, rgba(96, 165, 250, 1), transparent 70%),
      radial-gradient(circle 2.8px at 8% 60%, rgba(74, 222, 128, 0.75), transparent 70%),
      radial-gradient(circle 3.2px at 36% 86%, rgba(34, 211, 238, 0.85), transparent 70%),
      radial-gradient(circle 2.4px at 62% 88%, rgba(255, 255, 255, 0.6), transparent 70%),
      radial-gradient(circle 3.5px at 96% 26%, rgba(147, 197, 253, 0.9), transparent 70%),
      radial-gradient(circle 3px at 44% 34%, rgba(96, 165, 250, 0.85), transparent 70%),
      radial-gradient(circle 2.7px at 20% 12%, rgba(255, 255, 255, 0.7), transparent 70%),
      radial-gradient(circle 3px at 80% 88%, rgba(129, 140, 248, 0.85), transparent 70%);
    filter: none;
    animation: bahthyGlowOrbs 14s ease-in-out infinite alternate;
  }

  @keyframes bahthyGlowOrbs {
    0% { opacity: 0.9; transform: translate3d(0, 0, 0) scale(1); }
    50% { opacity: 1; transform: translate3d(0, -8px, 0) scale(1.03); }
    100% { opacity: 0.95; transform: translate3d(6px, 5px, 0) scale(1.015); }
  }

  .bahthy-dash-frame::after {
    display: none !important;
  }

  .bahthy-dash-frame > * {
    position: relative;
    z-index: 1;
  }

  .bahthy-points-star {
    display: inline-block;
    color: #F59E0B;
    flex-shrink: 0;
  }

  .bahthy-user-chevron {
    display: inline-block;
    color: #64748B;
    flex-shrink: 0;
  }

  .bahthy-sidebar-help {
    display: block;
    margin-top: auto;
    flex: 0 0 auto;
    padding: 10px 10px;
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(15, 40, 72, 0.9), rgba(8, 24, 48, 0.95));
    border: 1px solid rgba(96, 165, 250, 0.16);
  }

  .bahthy-sidebar-help-top {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 12px;
  }

  .bahthy-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    color: #fff;
    flex-shrink: 0;
  }

  .bahthy-user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-width: 0;
    text-align: right;
  }

  .bahthy-user-meta strong {
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bahthy-user-meta small {
    font-size: 0.68rem;
    color: #64748B;
    line-height: 1.2;
  }

  .bahthy-notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    left: auto;
    inset-inline-start: auto;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #3B82F6;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  #appScreen .bahthy-nav .btn-upgrade-header,
  #appScreen .bahthy-nav .btn-upgrade {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center;
    gap: 6px;
    height: 40px !important;
    padding: 0 16px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #3B82F6, #2563EB) !important;
    border: none !important;
    color: #fff !important;
    font-weight: 800 !important;
    font-size: 0.88rem !important;
    line-height: 1 !important;
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.4);
    white-space: nowrap;
  }

  .bahthy-points-wrap,
  #appScreen .bahthy-nav .user-info.bahthy-points-wrap,
  #appScreen .bahthy-nav .user-info {
    display: inline-flex !important;
    align-items: center !important;
    align-self: center !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
    min-width: 0;
    height: 40px;
  }

  #appScreen .bahthy-nav .points-balance {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center;
    gap: 6px;
    height: 40px !important;
    padding: 0 14px !important;
    margin: 0 !important;
    border-radius: 999px !important;
    background: rgba(245, 158, 11, 0.12) !important;
    border: 1px solid rgba(251, 191, 36, 0.35) !important;
    color: #FBBF24 !important;
    font-weight: 800 !important;
    font-size: 0.82rem !important;
    line-height: 1 !important;
    white-space: nowrap;
  }

  .bahthy-nav-actions-extra {
    display: none !important;
  }

  /* تأكيد ظهور مجموعة اليسار على الديسكتوب */
  #appScreen .bahthy-nav-actions--start {
    display: inline-flex !important;
  }

  #appScreen .bahthy-nav-actions--end {
    display: inline-flex !important;
  }

  #appScreen.screen.active > main.bahthy-main,
  #appScreen > main.bahthy-main {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 8px 14px 4px;
    padding-inline-end: 8px;
    padding-inline-start: 16px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
  }

  #viewDashboard.view-section.active {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .bahthy-dash-frame {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  .bahthy-dash-frame > #viewDashboard {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  /* ترحيب في الوسط تماماً بين حدود المحتوى — الحاسوب أقصى اليمين */
  #viewDashboard .dashboard-hero {
    position: relative;
    display: grid;
    place-items: center;
    text-align: center;
    max-width: none;
    width: 100%;
    margin: 0 0 8px;
    padding: 10px 16px;
    min-height: 210px;
    flex: 0 0 auto;
    overflow: visible;
  }

  /* دوائر مضيئة في منطقة الترحيب (بين الخطوط) */
  #viewDashboard .dashboard-hero::before {
    content: "";
    display: block !important;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
      radial-gradient(circle 130px at 18% 40%, rgba(59, 130, 246, 0.32), transparent 70%),
      radial-gradient(circle 110px at 50% 30%, rgba(96, 165, 250, 0.28), transparent 70%),
      radial-gradient(circle 150px at 78% 55%, rgba(37, 99, 235, 0.22), transparent 68%),
      radial-gradient(circle 90px at 32% 70%, rgba(34, 211, 238, 0.2), transparent 70%),
      radial-gradient(circle 100px at 68% 25%, rgba(167, 139, 250, 0.22), transparent 70%),
      radial-gradient(circle 80px at 88% 40%, rgba(59, 130, 246, 0.25), transparent 70%),
      radial-gradient(circle 70px at 12% 65%, rgba(147, 197, 253, 0.18), transparent 70%),
      radial-gradient(circle 3.5px at 22% 28%, rgba(147, 197, 253, 1), transparent 70%),
      radial-gradient(circle 2.8px at 40% 55%, rgba(255, 255, 255, 0.85), transparent 70%),
      radial-gradient(circle 3.2px at 55% 22%, rgba(96, 165, 250, 1), transparent 70%),
      radial-gradient(circle 2.6px at 70% 48%, rgba(34, 211, 238, 0.9), transparent 70%),
      radial-gradient(circle 3px at 85% 32%, rgba(192, 132, 252, 0.9), transparent 70%),
      radial-gradient(circle 2.4px at 15% 48%, rgba(255, 255, 255, 0.7), transparent 70%),
      radial-gradient(circle 3px at 48% 72%, rgba(59, 130, 246, 0.95), transparent 70%),
      radial-gradient(circle 2.5px at 62% 60%, rgba(251, 191, 36, 0.7), transparent 70%),
      radial-gradient(circle 2.8px at 92% 62%, rgba(96, 165, 250, 0.85), transparent 70%);
    animation: bahthyGlowOrbs 12s ease-in-out infinite alternate;
  }

  #viewDashboard .dashboard-hero::after {
    display: none !important;
  }

  .dashboard-hero-title-mobile {
    display: none;
  }

  .dashboard-hero-title-desktop {
    display: inline;
  }

  #viewDashboard .dashboard-hero-content {
    position: relative;
    z-index: 2;
    grid-area: 1 / 1;
    justify-self: center;
    align-self: center;
    width: min(580px, 72%);
    max-width: 580px;
    margin: 0;
    padding: 0 !important;
    text-align: center;
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none !important;
  }

  #viewDashboard .dashboard-hero-title {
    font-size: clamp(1.75rem, 2.7vw, 2.35rem);
    margin-bottom: 10px;
    letter-spacing: -0.02em;
    text-align: center !important;
    width: 100%;
  }

  .bahthy-brand-accent {
    color: #3B82F6;
    -webkit-text-fill-color: #3B82F6;
    text-shadow: 0 0 18px rgba(59, 130, 246, 0.45);
  }

  #viewDashboard .dashboard-hero-desc {
    font-size: 0.95rem;
    max-width: 520px;
    margin: 0 auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.55;
    text-align: center !important;
  }

  .dashboard-hero-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    /* ملتصق بأقصى يمين حدود المحتوى */
    right: 0;
    left: auto;
    inset-inline-start: auto;
    inset-inline-end: auto;
    top: 50%;
    transform: translateY(-50%);
    width: min(340px, 28%);
    min-height: 190px;
    z-index: 1;
    pointer-events: none;
  }

  .dashboard-hero-glow {
    position: absolute;
    inset: 6% 4%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, transparent 70%);
    filter: blur(14px);
    pointer-events: none;
  }

  .dashboard-hero-svg {
    width: 100%;
    max-width: 340px;
    max-height: 230px;
    height: auto;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 16px 32px rgba(0, 30, 70, 0.5));
  }

  #viewDashboard #cardsGrid.grid,
  #cardsGrid.bahthy-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 16px;
    max-width: none !important;
    width: 100%;
    margin: 0 !important;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    align-content: stretch;
  }

  #cardsGrid.bahthy-cards .card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: right;
    padding: 22px 20px 16px;
    min-height: 0 !important;
    height: 100%;
    border: 1px solid rgba(96, 165, 250, 0.14) !important;
    border-radius: 20px;
  }

  #cardsGrid.bahthy-cards .card .card-icon-wrap {
    align-self: flex-end;
    margin-bottom: 12px;
    width: 60px;
    height: 60px;
    border-radius: 16px;
  }

  #cardsGrid.bahthy-cards .card .card-icon-svg {
    width: 32px;
    height: 32px;
    stroke-width: 2.1;
  }

  #cardsGrid.bahthy-cards .card .title {
    font-size: 1.2rem !important;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 800;
  }

  #cardsGrid.bahthy-cards .card .sub {
    font-size: 0.92rem !important;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  #cardsGrid.bahthy-cards .card .card-text {
    flex: 1 1 auto;
  }

  #cardsGrid.bahthy-cards .card .card-chevron {
    display: none !important;
  }

  #cardsGrid.bahthy-cards .card .card-cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: auto;
    padding: 10px 16px;
    border-radius: 11px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(96, 165, 250, 0.25);
    color: #60A5FA;
    font-size: 0.9rem;
    font-weight: 700;
    align-self: flex-start;
  }

  #cardsGrid.bahthy-cards .card .card-cta svg {
    width: 16px;
    height: 16px;
  }

  #cardsGrid.bahthy-cards .card:hover .card-cta {
    background: rgba(59, 130, 246, 0.25);
    color: #93C5FD;
  }

  .bahthy-stats-bar {
    display: block;
    flex: 0 0 auto;
    padding: 8px 24px 10px;
    background: rgba(4, 12, 28, 0.6);
    border-top: 1px solid rgba(96, 165, 250, 0.1);
  }

  .bahthy-stats-inner {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    max-width: 1100px;
    margin: 0 auto;
  }

  .bahthy-stat-item {
    text-align: center;
    padding: 8px 6px;
    border-radius: 12px;
    background: rgba(15, 40, 72, 0.5);
    border: 1px solid rgba(96, 165, 250, 0.08);
  }

  .bahthy-stat-icon {
    width: 30px;
    height: 30px;
    margin: 0 auto 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .bahthy-stat-item--green .bahthy-stat-icon { background: rgba(34, 197, 94, 0.15); color: #4ADE80; }
  .bahthy-stat-item--purple .bahthy-stat-icon { background: rgba(168, 85, 247, 0.15); color: #C084FC; }
  .bahthy-stat-item--cyan .bahthy-stat-icon { background: rgba(6, 182, 212, 0.15); color: #22D3EE; }
  .bahthy-stat-item--amber .bahthy-stat-icon { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
  .bahthy-stat-item--blue .bahthy-stat-icon { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }

  .bahthy-stat-num {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    color: #F8FAFC;
    line-height: 1.2;
  }

  .bahthy-stat-label {
    margin-top: 2px;
    font-size: 0.62rem;
    color: #64748B;
    line-height: 1.3;
  }

  .bahthy-stat-icon svg {
    width: 16px;
    height: 16px;
  }

  .bahthy-footer {
    display: none !important;
  }

  #appScreen.active #chatFloatStar {
    display: none !important;
  }

  /* ── إصلاح نهائي للشريط العلوي (يطابق الصورة) ── */
  #appScreen .bahthy-nav-inner {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    grid-template-columns: none !important;
    height: 64px !important;
    gap: 14px !important;
    padding: 0 18px !important;
  }

  #appScreen .bahthy-nav-brand,
  #appScreen .bahthy-nav-links,
  #appScreen .bahthy-nav .header-middle,
  #appScreen .bahthy-nav .btn-header-ask {
    display: none !important;
  }

  /* RTL: أول عنصر يظهر يمين الشاشة = الحساب */
  #appScreen .bahthy-nav-actions--end {
    order: 1 !important;
    grid-column: auto !important;
    direction: ltr !important;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    height: 42px !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
    flex-wrap: nowrap !important;
  }

  .bahthy-desktop-search {
    order: 2 !important;
    grid-column: auto !important;
    flex: 1 1 auto !important;
    max-width: 480px !important;
    height: 42px !important;
    margin: 0 auto !important;
    align-self: center !important;
  }

  /* يسار الشاشة: أدوات المدير/ثيم/QR/خروج */
  #appScreen .bahthy-nav-actions--start {
    order: 3 !important;
    grid-column: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    height: 42px !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
  }

  #appScreen .bahthy-nav-actions--end > *,
  #appScreen .bahthy-nav-actions--end .subscription-dropdown-wrap,
  #appScreen .bahthy-nav-actions--end .bahthy-points-wrap,
  #appScreen .bahthy-nav-actions--end .user-info {
    display: inline-flex !important;
    align-items: center !important;
    height: 40px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }
}

@media (max-width: 768px) {
  .bahthy-desktop-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .bahthy-desktop-column {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
}

/* منع تكبير النقر المزدوج على عناصر الواجهة */
#appScreen button,
#appScreen a,
#appScreen .card,
#appScreen .bahthy-nav-link {
  touch-action: manipulation;
}

[data-theme="light"] {
  --bahthy-bg-0: #E6F5F9;
  --bahthy-bg-1: #D4EEF5;
  --bahthy-text: #0C4A6E;
  --bahthy-muted: #475569;
  --bahthy-primary: #0E7490;
  --bahthy-primary-soft: rgba(14, 116, 144, 0.16);
  --bahthy-border: rgba(14, 116, 144, 0.14);
  --bg-primary: #E8F6FA;
  --text: #0C4A6E;
  --text-muted: #475569;
  --accent: #0E7490;
  --accent-soft: rgba(14, 116, 144, 0.14);
  --accent-glow: rgba(6, 182, 212, 0.28);
}

[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 70% 45% at 85% 8%, rgba(6, 182, 212, 0.2), transparent 55%),
    radial-gradient(ellipse 55% 40% at 12% 70%, rgba(13, 148, 136, 0.16), transparent 55%),
    linear-gradient(165deg, #D9F3F8 0%, #EAF8FB 45%, #F2FBFD 100%);
}

[data-theme="light"] #appScreen .main-header.bahthy-nav {
  background: rgba(232, 246, 250, 0.86);
  border-bottom-color: rgba(14, 116, 144, 0.16);
}

[data-theme="light"] #cardsGrid.bahthy-cards .card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95) 0%, rgba(224, 242, 254, 0.9) 100%);
  border: 1px solid rgba(14, 116, 144, 0.12) !important;
  box-shadow: 0 8px 22px rgba(8, 100, 130, 0.08);
}

[data-theme="light"] #viewDashboard .dashboard-hero-title {
  color: #0C4A6E;
  -webkit-text-fill-color: #0C4A6E;
}

[data-theme="light"] .bahthy-brand-accent {
  color: #DC2626;
  -webkit-text-fill-color: #DC2626;
  text-shadow: 0 0 16px rgba(220, 38, 38, 0.3);
}

@media (max-width: 768px) {
  [data-theme="light"] #appScreen .main-header.bahthy-nav {
    background: rgba(232, 246, 250, 0.96);
    border-bottom-color: rgba(14, 116, 144, 0.18);
  }
  [data-theme="light"] #appScreen .bahthy-nav-brand {
    color: #0C4A6E;
  }
  [data-theme="light"] #appScreen .bahthy-nav-links {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(14, 116, 144, 0.16);
    box-shadow: 0 4px 14px rgba(8, 100, 130, 0.08);
  }
  [data-theme="light"] #appScreen .bahthy-nav-link {
    background: rgba(224, 242, 254, 0.75);
    border-color: rgba(14, 116, 144, 0.12);
    color: #0C4A6E;
  }
  [data-theme="light"] #appScreen .bahthy-nav-link.is-active,
  [data-theme="light"] #appScreen .bahthy-nav-link--home.is-active {
    background: rgba(14, 116, 144, 0.16);
    border-color: rgba(14, 116, 144, 0.35);
    color: #0E7490;
    box-shadow: inset 0 -2px 0 #0E7490;
  }
  [data-theme="light"] #appScreen .bahthy-nav .points-balance {
    color: #0C4A6E;
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(14, 116, 144, 0.2);
  }
  [data-theme="light"] #appScreen .bahthy-nav .btn-logout {
    color: #B91C1C !important;
    background: rgba(254, 226, 226, 0.95) !important;
    border-color: rgba(248, 113, 113, 0.45) !important;
  }
  [data-theme="light"] #appScreen .bahthy-nav .theme-toggle {
    color: #0E7490;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(14, 116, 144, 0.2);
  }
  [data-theme="light"] #cardsGrid.bahthy-cards .card {
    background: linear-gradient(160deg, #FFFFFF 0%, #E0F2FE 100%) !important;
    border-color: rgba(28, 25, 23, 0.1) !important;
    box-shadow: 0 4px 14px rgba(8, 100, 130, 0.08);
  }
  [data-theme="light"] #cardsGrid.bahthy-cards .card .title {
    color: #1C1917 !important;
    -webkit-text-fill-color: #1C1917 !important;
  }
  [data-theme="light"] #cardsGrid.bahthy-cards .card .sub {
    color: #44403C !important;
    -webkit-text-fill-color: #44403C !important;
  }
  [data-theme="light"] #viewDashboard .dashboard-hero-content {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(224, 242, 254, 0.88) 100%);
    border-color: rgba(14, 116, 144, 0.14);
    box-shadow: 0 4px 14px rgba(8, 100, 130, 0.08);
  }
  [data-theme="light"] #viewDashboard .dashboard-hero-title {
    color: #1C1917 !important;
    -webkit-text-fill-color: #1C1917 !important;
  }
  [data-theme="light"] #viewDashboard .dashboard-hero-desc {
    color: #44403C !important;
  }
  [data-theme="light"] .bahthy-footer {
    background: #0C4A6E;
    border-top-color: rgba(255, 255, 255, 0.12);
  }
  [data-theme="light"] .bahthy-footer-item h3,
  [data-theme="light"] .bahthy-footer-copy {
    color: #E0F2FE;
  }
  [data-theme="light"] .bahthy-footer-icon {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    color: #7DD3FC;
  }
}

[data-theme="light"] .bahthy-footer { background: #0C4A6E; }
[data-theme="light"] .bahthy-sub-card {
  background: linear-gradient(165deg, #FFFFFF 0%, #E0F2FE 100%);
  color: #0C4A6E;
}
[data-theme="light"] .bahthy-sub-head h2,
[data-theme="light"] .bahthy-sub-plan { color: #0C4A6E; }

/* عناوين الكروت — سواد خفيف واضح */
[data-theme="light"] #cardsGrid.bahthy-cards .card .title,
[data-theme="light"] #cardsGrid .card .title,
[data-theme="light"] .card .title {
  color: #1C1917 !important;
  -webkit-text-fill-color: #1C1917 !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  text-shadow: none !important;
  opacity: 1 !important;
}

[data-theme="light"] #cardsGrid.bahthy-cards .card .sub,
[data-theme="light"] #cardsGrid .card .sub,
[data-theme="light"] .card .sub {
  color: #44403C !important;
  -webkit-text-fill-color: #44403C !important;
  opacity: 1 !important;
}

/* ابدأ الآن — أخضر */
[data-theme="light"] #cardsGrid.bahthy-cards .card .card-cta {
  color: #15803D !important;
  background: rgba(22, 163, 74, 0.14) !important;
  border-color: rgba(22, 163, 74, 0.35) !important;
}

[data-theme="light"] #cardsGrid.bahthy-cards .card:hover .card-cta {
  color: #166534 !important;
  background: rgba(22, 163, 74, 0.22) !important;
  border-color: rgba(22, 163, 74, 0.45) !important;
}

[data-theme="light"] #cardsGrid.bahthy-cards .card .card-cta svg {
  color: #16A34A !important;
  stroke: #16A34A !important;
}

[data-theme="light"] #cardsGrid.bahthy-cards .card .card-chevron {
  color: #B91C1C !important;
  opacity: 0.85 !important;
}

[data-theme="light"] #viewDashboard .dashboard-hero-title,
[data-theme="light"] .dashboard-hero-title {
  color: #1C1917 !important;
  -webkit-text-fill-color: #1C1917 !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
}

[data-theme="light"] #viewDashboard .dashboard-hero-desc,
[data-theme="light"] .dashboard-hero-desc {
  color: #44403C !important;
}

/* كلمة بحثي — أحمر خفيف */
[data-theme="light"] .bahthy-brand-accent {
  color: #DC2626 !important;
  -webkit-text-fill-color: #DC2626 !important;
  text-shadow: 0 0 14px rgba(220, 38, 38, 0.25) !important;
}

/* لمسات أحمر خفيف + سواد خفيف على الكروت */
[data-theme="light"] #cardsGrid.bahthy-cards .card {
  border-color: rgba(28, 25, 23, 0.12) !important;
  box-shadow: 0 8px 22px rgba(28, 25, 23, 0.08);
}

[data-theme="light"] #cardsGrid.bahthy-cards .card:hover {
  border-color: rgba(185, 28, 28, 0.25) !important;
  box-shadow: 0 10px 26px rgba(185, 28, 28, 0.1);
}

/* ثيم البحر — ديسكتوب */
@media (min-width: 769px) {
  [data-theme="light"] .bahthy-dash-sidebar {
    background: linear-gradient(180deg, rgba(224, 242, 254, 0.98) 0%, rgba(207, 250, 254, 0.95) 100%);
    border-inline-start-color: rgba(14, 116, 144, 0.16);
  }
  [data-theme="light"] .bahthy-sidebar-link {
    color: #0C4A6E;
  }
  [data-theme="light"] .bahthy-sidebar-link.is-active {
    background: rgba(14, 116, 144, 0.12);
    color: #0E7490;
  }
  [data-theme="light"] .bahthy-desktop-search {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(14, 116, 144, 0.18);
  }
  [data-theme="light"] .bahthy-desktop-search-input {
    color: #0C4A6E;
  }
  [data-theme="light"] .bahthy-desktop-search-input::placeholder {
    color: #64748B;
  }
  [data-theme="light"] .bahthy-stats-bar {
    background: rgba(224, 242, 254, 0.85);
    border-top-color: rgba(14, 116, 144, 0.12);
  }
  [data-theme="light"] .bahthy-dash-frame::before {
    opacity: 0.85;
    background-image:
      radial-gradient(circle 160px at 8% 20%, rgba(6, 182, 212, 0.28), transparent 70%),
      radial-gradient(circle 140px at 90% 18%, rgba(14, 116, 144, 0.22), transparent 70%),
      radial-gradient(circle 180px at 50% 55%, rgba(13, 148, 136, 0.18), transparent 68%),
      radial-gradient(circle 3px at 20% 30%, rgba(6, 182, 212, 0.9), transparent 70%),
      radial-gradient(circle 2.5px at 70% 40%, rgba(255, 255, 255, 0.85), transparent 70%),
      radial-gradient(circle 3px at 40% 70%, rgba(14, 116, 144, 0.8), transparent 70%),
      radial-gradient(circle 2.8px at 85% 65%, rgba(13, 148, 136, 0.75), transparent 70%);
  }
}

/* ── One-screen lock (يغلب style.css) ───────────────────── */
#appScreen.screen.active {
  display: flex !important;
  flex-direction: column !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  min-height: 100dvh !important;
  overflow: hidden !important;
}

#appScreen.screen.active > .bahthy-desktop-shell {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

@media (min-width: 769px) {
  #appScreen.screen.active main,
  #appScreen.screen.active main.bahthy-main {
    overflow: hidden !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: auto;
  }

  #viewDashboard #cardsGrid.grid,
  #cardsGrid.bahthy-cards {
    overflow: hidden !important;
    overflow-y: hidden !important;
  }
}

@media (max-width: 768px) {
  html:has(#appScreen.screen.active),
  body:has(#appScreen.screen.active) {
    overflow: hidden !important;
    height: 100%;
    overscroll-behavior: none;
  }
}

@media (max-width: 768px) and (max-height: 720px) {
  #appScreen .main-header.bahthy-nav {
    padding-top: max(0px, env(safe-area-inset-top, 0px));
  }

  #appScreen .bahthy-nav-inner {
    min-height: 42px;
    padding: 6px 10px 8px;
  }

  #viewDashboard .dashboard-hero {
    margin-bottom: 4px;
  }

  #viewDashboard .dashboard-hero-content {
    padding: 6px 12px 4px;
  }

  #viewDashboard #cardsGrid.grid,
  #cardsGrid.bahthy-cards {
    gap: 6px;
  }

  #cardsGrid.bahthy-cards .card {
    min-height: 52px !important;
    padding: 10px 12px !important;
    overflow: visible !important;
  }

  #cardsGrid.bahthy-cards .card .card-icon-wrap {
    width: 38px;
    height: 38px;
  }

  #cardsGrid.bahthy-cards .card .card-icon-svg {
    width: 22px;
    height: 22px;
  }

  #cardsGrid.bahthy-cards .card .title {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    display: block !important;
  }

  #cardsGrid.bahthy-cards .card .sub {
    font-size: 0.68rem !important;
    line-height: 1.35 !important;
    display: block !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: unset;
  }

  #viewDashboard .dashboard-hero-title {
    font-size: 0.98rem !important;
  }

  #viewDashboard .dashboard-hero-desc {
    font-size: 0.72rem !important;
    -webkit-line-clamp: 2;
  }
}

@media (min-width: 769px) and (max-height: 820px) {
  #viewDashboard .dashboard-hero {
    margin-bottom: 4px;
    min-height: 160px;
    padding: 4px 10px;
  }

  #viewDashboard .dashboard-hero-title {
    font-size: 1.55rem !important;
  }

  .dashboard-hero-visual {
    right: 0;
    left: auto;
    width: min(300px, 26%);
    min-height: 150px;
  }

  .dashboard-hero-svg {
    max-height: 175px;
    max-width: 300px;
  }

  #viewDashboard #cardsGrid.grid,
  #cardsGrid.bahthy-cards {
    gap: 14px;
  }

  #cardsGrid.bahthy-cards .card {
    padding: 18px 18px 14px;
  }

  #cardsGrid.bahthy-cards .card .card-icon-wrap {
    width: 54px;
    height: 54px;
  }

  #cardsGrid.bahthy-cards .card .card-icon-svg {
    width: 30px;
    height: 30px;
  }

  #cardsGrid.bahthy-cards .card .title {
    font-size: 1.12rem !important;
  }

  #cardsGrid.bahthy-cards .card .sub {
    font-size: 0.86rem !important;
  }

  .bahthy-stats-bar {
    padding: 6px 24px 8px;
  }

  .bahthy-stat-num {
    font-size: 1rem;
  }
}

