:root {
  --edge-cyan: #00f6ff;
  --edge-dark: rgba(6, 14, 25, 0.92);
  --edge-glass: rgba(9, 18, 32, 0.78);
  --edge-border: rgba(0, 246, 255, 0.2);
  --edge-side-pad: clamp(14px, 6vw, 34px);
}

.mq-stage {
  position: relative;
  padding: clamp(16px, 4vh, 36px) 0 clamp(32px, 6vh, 64px);
  min-height: 100vh;
  box-sizing: border-box;
  background:
    linear-gradient(160deg, rgba(4, 15, 28, 0.62), rgba(3, 22, 38, 0.68)),
    url("../assets/background.png") center/cover no-repeat;
  background-attachment: scroll;
  overflow: visible;
  margin: 0;
  border-radius: 0;
}

@media (min-width: 1024px) {
  .mq-stage {
    background-attachment: fixed;
  }
}

.mq-stage::before,
.mq-stage::after {
  content: "";
  position: absolute;
  inset: -12%;
  pointer-events: none;
  z-index: 0;
}

.mq-stage::before,
.mq-stage::after,
.mq-stage .mq-bg-overlay {
  display: none;
}


.edge-hero-topbar {
  width: 100%;
  margin: 0;
  padding: clamp(18px, 4vh, 28px) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(14px, 3vw, 28px);
  box-sizing: border-box;
}

.edge-hero {
  width: 100%;
  max-width: 1180px;
  margin: clamp(28px, 8vh, 88px) auto clamp(32px, 8vh, 96px);
  padding: 0 var(--edge-side-pad);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 4vh, 36px);
  color: #e6f9ff;
  box-sizing: border-box;
}


.edge-home-main {
  width: min(600px, calc(100% - 2 * var(--edge-side-pad)));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 3vh, 26px);
  text-align: center;
  box-sizing: border-box;
}

.edge-home-title {
  margin: 0;
  font-size: clamp(1.7rem, 2.3vw, 2.4rem);
  font-family: 'Orbitron', 'Segoe UI', sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.edge-home-subtitle {
  margin: 0;
  max-width: 600px;
  color: rgba(214, 238, 255, 0.78);
  font-size: 1rem;
  line-height: 1.6;
}

.edge-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  flex: 0 0 auto;
}

.edge-brand img {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(0, 246, 255, 0.35);
}

.edge-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.edge-hero-topbar__left,
.edge-hero-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.edge-hero-topbar__left {
  padding-left: var(--edge-side-pad);
}

.edge-hero-topbar__right {
  margin-left: auto;
  padding-right: var(--edge-side-pad);
}

.edge-hero-topbar__right .user-icon-wrapper {
  width: 50px;
  height: 50px;
  margin-left: 12px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(0, 40, 60, 0.55);
  box-shadow: 0 0 18px rgba(0, 246, 255, 0.32);
}

.edge-hero-topbar__right #user-icon {
  width: 100% !important;
  height: 100% !important;
  border-radius: inherit !important;
  box-shadow: none;
  object-fit: cover;
}

.edge-hero-topbar__right .notif-dot {
  top: 4px;
  right: 4px;
}

.edge-actions-anchor {
  display: flex;
  align-items: center;
}

.edge-link-btn,
.edge-icon-btn {
  border: 1px solid rgba(0, 246, 255, 0.4);
  background: transparent;
  color: #dff9ff;
  font-size: 0.95rem;
  padding: 10px 18px;
  border-radius: 24px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.edge-link-btn:hover,
.edge-icon-btn:hover {
  background: rgba(0, 246, 255, 0.12);
  border-color: rgba(0, 246, 255, 0.6);
  transform: translateY(-1px);
}

.edge-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  width: 42px;
  height: 42px;
  font-size: 1.4rem;
  line-height: 1;
}



.edge-search {
  width: clamp(320px, 100%, 940px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(8, 24, 36, 0.65);
  border: 1px solid rgba(0, 210, 255, 0.24);
  border-radius: 24px;
  padding: 8px 12px 8px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.edge-search-icon img {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 0 6px rgba(0, 246, 255, 0.6));
}

.edge-search input {
  flex: 1;
  background: transparent;
  border: none;
  color: rgba(239, 249, 255, 0.9);
  font-size: 0.98rem;
  outline: none;
}

.edge-search input::placeholder {
  color: rgba(203, 226, 240, 0.55);
}

.edge-search button {
  border: none;
  border-radius: 18px;
  padding: 9px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  background: linear-gradient(135deg, rgba(0, 246, 255, 0.85), rgba(0, 176, 220, 0.85));
  color: #03202c;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.edge-search button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 246, 255, 0.35);
}

.edge-sheet {
  position: fixed;
  left: 50%;
  bottom: -100%;
  transform: translate(-50%, 0);
  width: min(1650px, 94vw);
  max-height: 82vh;
  z-index: 20010;
  transition: bottom 0.45s ease;
  pointer-events: none;
}

.edge-sheet--open {
  bottom: 4vh;
  pointer-events: auto;
}

.edge-sheet-inner {
  background: var(--edge-dark);
  border: 1px solid var(--edge-border);
  border-radius: 26px;
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  padding: 20px clamp(18px, 4vw, 32px) clamp(22px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  height: 100%;
  color: #f1fbff;
}

.edge-sheet-content .mq-shell__container {
  gap: clamp(22px, 4vw, 36px);
}

.edge-sheet-content .mq-page-hero {
  margin: 0;
}

.edge-sheet-handle {
  align-self: center;
  width: 56px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  margin-bottom: 12px;
}

.edge-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.edge-sheet-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.edge-sheet-actions .edge-icon-btn {
  width: 40px;
  height: 40px;
  padding: 8px;
  font-size: 1.2rem;
}

.edge-sheet-header h2 {
  font-size: 1.4rem;
  margin: 0;
}

.edge-sheet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0 12px;
}

.edge-sheet-tabs button {
  border: 1px solid rgba(0, 246, 255, 0.3);
  background: rgba(4, 19, 28, 0.6);
  color: inherit;
  padding: 8px 16px;
  border-radius: 18px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.edge-sheet-tabs button.active {
  background: rgba(0, 246, 255, 0.2);
  border-color: rgba(0, 246, 255, 0.55);
}

.edge-sheet-tabs button:hover {
  transform: translateY(-1px);
}

.edge-sheet-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  display: block;
}

.edge-sheet-panel {
  display: none;
  font-size: 0.98rem;
  line-height: 1.6;
}

.edge-sheet-panel.active {
  display: block;
}

.edge-sheet-panel h3 {
  margin-top: 0;
  font-size: 1.3rem;
}

.edge-sheet-panel h4 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.edge-sheet-panel iframe {
  width: 100%;
  height: clamp(320px, 60vh, 680px);
  border: 1px solid rgba(0, 246, 255, 0.2);
  border-radius: 20px;
  background: rgba(2, 14, 26, 0.92);
  box-shadow: inset 0 0 24px rgba(0, 246, 255, 0.08);
}

@media (max-width: 680px) {
  .edge-sheet-panel iframe {
    height: clamp(260px, 65vh, 560px);
    border-radius: 16px;
  }
}

.edge-list {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  display: grid;
  gap: 10px;
}

.edge-list li {
  background: rgba(4, 19, 28, 0.6);
  border-radius: 16px;
  padding: 10px 14px;
  border: 1px solid rgba(0, 246, 255, 0.12);
}

.edge-subsection {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(4, 19, 28, 0.65);
  border: 1px solid rgba(0, 246, 255, 0.18);
}

.edge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.edge-grid--docs {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.edge-card {
  background: rgba(4, 19, 28, 0.6);
  border: 1px solid rgba(0, 246, 255, 0.16);
  border-radius: 18px;
  padding: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.edge-card ul {
  margin: 0;
  padding-left: 18px;
}

.edge-card li {
  margin-bottom: 6px;
}

.edge-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.edge-metric-card {
  background: rgba(4, 19, 28, 0.6);
  border: 1px solid rgba(0, 246, 255, 0.18);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edge-metric-card .label {
  font-size: 0.85rem;
  color: rgba(202, 236, 255, 0.75);
}

.edge-metric-card .value {
  font-size: 1.2rem;
  font-weight: 600;
  color: #c8fcff;
}

@media (max-width: 900px) {
  :root {
    --edge-side-pad: clamp(12px, 6vw, 28px);
  }

  .edge-hero-topbar {
    padding: clamp(16px, 4vw, 24px) 0 clamp(12px, 4vw, 20px);
    gap: 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .edge-hero-topbar__left {
    width: 100%;
    padding-left: var(--edge-side-pad);
  }

  .edge-hero-topbar__right {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    padding-right: var(--edge-side-pad);
  }

  .edge-hero {
    width: 100%;
    padding: clamp(26px, 8vw, 48px) var(--edge-side-pad) clamp(32px, 10vw, 52px);
    border-radius: clamp(24px, 10vw, 36px);
    align-items: center;
    text-align: center;
  }

  .edge-home-main {
    gap: 18px;
    width: min(600px, calc(100% - 2 * var(--edge-side-pad)));
    margin: 0 auto;
  }

  .edge-home-subtitle {
    max-width: 100%;
  }

  .edge-search {
    width: clamp(280px, 100%, 640px);
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }

  .edge-search button {
    width: 100%;
  }

  .edge-sheet {
    width: min(94vw, 680px);
  }

  .edge-sheet-inner {
    border-radius: 24px;
    padding: 20px;
  }
}

@media (max-width: 768px) {
  :root {
    --edge-side-pad: clamp(10px, 7vw, 24px);
  }

  .edge-hero-topbar {
    padding: clamp(14px, 5vw, 22px) 0 clamp(12px, 4vw, 18px);
    gap: 14px;
  }

  .edge-hero-topbar__left {
    padding-left: var(--edge-side-pad);
  }

  .edge-hero-topbar__right {
    width: 100%;
    padding-right: var(--edge-side-pad);
  }

  .edge-hero {
    padding: clamp(22px, 9vw, 34px) var(--edge-side-pad) clamp(28px, 11vw, 40px);
    gap: 18px;
  }

  .edge-home-main {
    gap: 18px;
    width: min(560px, calc(100% - 2 * var(--edge-side-pad)));
  }

  .edge-home-title {
    font-size: clamp(1.55rem, 4vw, 1.9rem);
  }

  .edge-home-subtitle {
    font-size: 0.98rem;
  }

  .edge-search input {
    font-size: 1rem;
  }

  .edge-sheet {
    width: 100vw;
    left: 50%;
    transform: translate(-50%, 0);
    max-height: 90vh;
  }

  .edge-sheet--open {
    bottom: 0;
  }

  .edge-sheet-inner {
    border-radius: 24px 24px 0 0;
    padding: 20px 18px 26px;
  }

  .edge-sheet-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .edge-sheet-tabs button {
    flex: 0 0 auto;
  }
}

@media (max-width: 540px) {
  :root {
    --edge-side-pad: clamp(8px, 8vw, 20px);
  }

  .edge-hero-topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 0 var(--edge-side-pad) clamp(12px, 4vw, 18px);
  }

  .edge-hero-topbar__left {
    padding-left: var(--edge-side-pad);
  }

  .edge-hero {
    min-height: unset;
    padding: clamp(20px, 9vw, 28px) var(--edge-side-pad) clamp(24px, 10vw, 32px);
    gap: 20px;
  }

  .edge-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .edge-home-main {
    gap: 16px;
    width: min(500px, calc(100% - 2 * var(--edge-side-pad)));
  }

  .edge-home-title {
    font-size: 1.6rem;
  }

  .edge-home-subtitle {
    font-size: 0.95rem;
  }

  .edge-search {
    width: 100%;
    padding: 14px;
    gap: 12px;
  }

  .edge-search input {
    font-size: 0.96rem;
  }

  .edge-brand img {
    width: 34px;
    height: 34px;
  }

  .edge-sheet-inner {
    padding: 18px 14px 24px;
  }

  .edge-card {
    padding: 14px;
  }
}

@media (max-width: 420px) {
  .edge-hero {
    padding: 20px 14px 26px;
    border-radius: 22px;
  }

  .edge-home-title {
    font-size: 1.7rem;
  }

  .edge-home-subtitle {
    font-size: 0.92rem;
  }

  .edge-search button {
    font-size: 0.95rem;
    padding: 10px 16px;
  }

  .edge-sheet-tabs {
    gap: 10px;
  }
}

@keyframes quantumDrift {
  0% { transform: translate3d(-3%, -2%, 0) scale(1.05); }
  100% { transform: translate3d(3%, 4%, 0) scale(1.08); }
}

@keyframes gridPulse {
  0%, 100% { opacity: 0.18; transform: scale(1); }
  50% { opacity: 0.28; transform: scale(1.04); }
}

@keyframes pulseNode {
  0%, 100% { opacity: 0.45; transform: translate3d(-2%, -1%, 0) scale(1); }
  50% { opacity: 0.8; transform: translate3d(2%, 3%, 0) scale(1.08); }
}

@keyframes sheenSweep {
  0% { transform: translateX(-40%) skewX(-12deg); opacity: 0; }
  25% { opacity: 0.35; }
  50% { transform: translateX(0) skewX(-6deg); opacity: 0.5; }
  75% { opacity: 0.3; }
  100% { transform: translateX(40%) skewX(-12deg); opacity: 0; }
}
/* Hide unused secondary tab strip on landing view */
.mq-stage .mq-tabs {
  display: none;
}


/* ✅ شاشات الجوال: قرّب الشعار من الحافة العلوية والجانبية */
@media (max-width: 768px) {
  /* قلّل البادينج العام للستيج مع مراعاة الـ safe area في iOS */
  .mq-stage {
    padding-top: max(6px, env(safe-area-inset-top)) !important;
    padding-bottom: clamp(24px, 6vh, 48px); /* كما تحب */
  }

  /* قلّل الحشوة الجانبية كلها (يسار/يمين) للهيدر */
  :root {
    --edge-side-pad: 10px;  /* كانت أكبر من كذا على الجوال */
  }

  /* الهيدر نفسه نخليه نحيف جدًا من فوق */
  .edge-hero-topbar {
    padding-top: 6px !important;
    padding-bottom: 4px !important;
    gap: 10px;
  }

  /* تأكيد قرب البراند من الحافة اليسرى */
  .edge-hero-topbar__left {
    padding-left: var(--edge-side-pad) !important;
  }
  .edge-hero-topbar__right {
    padding-right: var(--edge-side-pad) !important;
  }

  /* حجم الشعار مثل أيقونة المستخدم */
  .edge-brand img {
    width: 60px !important;
    height: 60px !important;
  }
  .edge-brand span {
    font-size: 1rem !important;
  }
}




/* متغيّر افتراضي fallback */
:root { --edge-header-h: 64px; }

@media (max-width: 768px) {
  /* الهيدر ثابت */
  .edge-hero-topbar {
    position: fixed;
    top: env(safe-area-inset-top, 0);
    left: 0; right: 0;
    z-index: 10060;
    background: rgba(6,14,25,0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    /* ابقي أي paddings كما تحب */
  }

  /* نعوّض تلقائيًا بارتفاع الهيدر المحسوب */
  .edge-hero {
    margin-top: calc(var(--edge-header-h, 64px) + 8px) !important;
    margin-bottom: 24px !important; /* بدل قيم vh لتجنّب اهتزاز iOS */
  }

  /* أمان ضد التمرير الأفقي */
  html, body { overflow-x: hidden; }
}


/* ✅ بطاقة المستخدم تحت الهيدر مباشرة على الجوال */
@media (max-width: 768px) {
  .user-card {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0) + var(--edge-header-h, 64px) + 8px) !important;
    right: 12px !important;
    left: auto !important;
    width: min(92vw, 360px) !important;
    z-index: 10030 !important; /* أعلى من الهيدر المثبّت */
    --caret-left: calc(100% - 56px); /* سنجعل سهم الكارت يشير لأيقونة المستخدم يمينًا */
  }
}


/* اجعل المودال أعلى من البطاقة دائمًا (لو احتجت) */
@media (max-width: 768px) {
  .user-card { z-index: 10030 !important; } /* أقل من المودال */
}
