:root {
  --bg: #050507;
  --panel: #0c0c13;
  --panel-2: #14141f;
  --border: rgba(255, 255, 255, 0.075);
  --border-soft: rgba(255, 255, 255, 0.05);
  --text: #f4f3f9;
  --text-dim: #9998ac;
  --text-mute: #67667a;
  --purple: #5703c5;
  --purple-2: #7716e6;
  --purple-deep: #400291;
  --pink: #830358;
  --cyan: #0cbad4;
  --green: #02f58c;
  --orange: #fc6602;
  --red: #ef5b5b;
  --blue: #0a3eb6;
  --gray: #565669;
  --radius: 16px;
  --radius-sm: 10px;
}

:root {
  --bg: #060a16;
  --bg-alt: hsl(225, 56%, 7%);
  --surface: #0d1428;
  --surface-2: #111a33;
  --border: #1b2440;
  --border-soft: #161f38;
  --purple: #6f03ad;
  --purple-2: #9941fd;
  --purple-deep: #6f029b98;
  --cyan: #06c2db;
  --text: #f3f5fb;
  --text-dim: #a6adc4;
  --text-mute: #6b738f;
  --green: #02fa72;
  --font: "Cairo", "Tajawal", sans-serif;
  --neon-green: #00ff88;
  --neon-glow: rgba(0, 255, 136, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  direction: rtl;
}

img {
  max-width: 100%;
  display: block;
}
a {
  text-decoration: none;
  color: inherit;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}
ul {
  list-style: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
}

/* ============ TOPBAR ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 28px;
  background: var(--bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  direction: ltr !important;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  background: transparent;
  border: none;
  padding: 0;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.25s ease;
}
.hamburger.active span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 22px rgba(123, 63, 242, 0.55);
  font-size: 20px;
  border: 1px solid var(--purple);
  color: var(--purple);
  font-weight: 600;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.1px;
  white-space: nowrap;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between !important;
  align-items: center;
  gap: 32px;
  font-size: 14.5px;
  color: var(--text-dim);
  font-weight: 500;
}
.topnav a {
  position: relative;
  padding: 8px 0;
  transition: color 0.2s;
}
.topnav a:hover {
  color: var(--text);
}
.topnav a.active {
  color: var(--purple-2);
  font-weight: 600;
}
.topnav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -13px;
  height: 2px;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  box-shadow: 0 0 8px var(--purple-2);
  border-radius: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.chev {
  opacity: 0.7;
}

.nav {
  display: flex;
  align-items: center;
  gap: 40px;
  flex: 1;
  justify-content: center;
}
.nav__link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  transition: color 0.15s ease;
  position: relative;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
}
.nav__link:hover {
  color: var(--text);
}
.nav__link--active {
  color: var(--text);
}
.nav__link--active::after {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  bottom: -27px;
  height: 2px;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
}

.btn {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text);
}
.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.3);
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple-2), var(--purple-deep));
  color: #fff;
  box-shadow: 0 4px 22px rgba(123, 63, 242, 0.5);
}
.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 28px rgba(123, 63, 242, 0.7);
}
.btn-outline {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
}
.btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.22);
}
.btn-outline i,
.btn-primary i {
  width: 15px;
  height: 15px;
  opacity: 0.9;
}
.btn-upgrade {
  width: 100%;
  font-size: 11px;
  padding: 5px 10px;
  justify-content: center;
  background: linear-gradient(135deg, var(--purple-2), var(--pink));
  color: #fff;
  box-shadow: 0 4px 20px rgba(123, 63, 242, 0.4);
}

/* ============ SHELL / SIDEBAR ============ */
.app-shell {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  position: sticky;
  top: 65px;
  width: 232px;
  flex-shrink: 0;
  height: calc(100vh - 65px);
  background: rgba(7, 7, 12, 0.6);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 14px;
  z-index: 55;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.4;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 13.8px;
  font-weight: 500;
  transition: all 0.18s ease;
  position: relative;
}
.side-link i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  opacity: 0.85;
}
.side-link:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}
.side-link.active {
  background: linear-gradient(135deg, var(--purple), var(--purple-deep));
  color: #fff;
  box-shadow: 0 4px 18px rgba(123, 63, 242, 0.4);
}
.side-link.active i {
  opacity: 1;
}

.upgrade-card {
  margin-top: 10px;
  background: linear-gradient(
    160deg,
    rgba(123, 63, 242, 0.16),
    rgba(216, 75, 240, 0.05)
  );
  border: 1px solid rgba(123, 63, 242, 0.28);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.upgrade-icon {
  width: 24px;
  height: 24px;
  border-radius: 9px;
  background: rgba(123, 63, 242, 0.22);
  color: var(--purple-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.upgrade-title {
  font-weight: 700;
  font-size: 11px;
  margin-bottom: 2px;
}
.upgrade-desc {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 5px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 50;
  backdrop-filter: blur(2px);
}

/* ============ MAIN CONTENT ============ */
.content {
  flex: 1;
  min-width: 0;
  padding: 22px 28px 60px;
}

.breadcrumb {
  font-size: 12.5px;
  color: var(--text-mute);
  margin-bottom: 14px;
}
.breadcrumb .sep {
  margin: 0 6px;
}

.page-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.page-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  background: linear-gradient(
    135deg,
    rgba(123, 63, 242, 0.4),
    rgba(216, 75, 240, 0.22)
  );
  border: 1px solid rgba(123, 63, 242, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.page-icon i {
  width: 20px;
  height: 20px;
}
.page-head h1 {
  margin: 0 0 6px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.4px;
}
.page-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13.5px;
  max-width: 560px;
}

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 18px;
}
.kpi-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(123, 63, 242, 0.18);
  color: var(--purple-2);
  flex-shrink: 0;
}
.kpi-icon i {
  width: 15px;
  height: 15px;
}
.kpi-label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}
.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.kpi-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.kpi-delta {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--green);
}
.kpi-foot {
  font-size: 11.5px;
  color: var(--text-mute);
  margin-top: 6px;
}

/* Tabs */
.tabs-scroll {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 12px 14px;
  font-size: 13.8px;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active {
  color: #fff;
  border-bottom-color: var(--purple-2);
}
.tabs-actions {
  display: flex;
  gap: 10px;
  padding-bottom: 10px;
}

/* ============ DASH GRID (macro 2-col) ============ */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}
.col-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.col-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.row {
  display: grid;
  gap: 16px;
}
.row-1 {
  grid-template-columns: 1.7fr 1fr;
}
.row-2 {
  grid-template-columns: 1fr 1.05fr;
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.panel-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.panel-head .sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-mute);
}
.dropdown {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  flex-shrink: 0;
}

/* Trend chart */
.panel-trend canvas {
  width: 100%;
  height: 220px;
  display: block;
}

/* Donut legend */
.panel-sector .donut-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.donut-total {
  display: block;
  font-size: 19px;
  font-weight: 800;
}
.donut-label {
  display: block;
  font-size: 10.5px;
  color: var(--text-mute);
}
.legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend .lname {
  flex: 1;
}
.legend .lval {
  color: var(--text);
  font-weight: 600;
}

/* Geo */
.geo-wrap {
  display: flex;
  gap: 14px;
  align-items: center;
}
.geo-map {
  flex: 1;
  min-width: 0;
  aspect-ratio: 1/0.82;
  position: relative;
}
.geo-map svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.geo-legend {
  flex-shrink: 0;
  min-width: 118px;
}

/* big value */
.big-value {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
}
.big-value .up {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  margin-left: 8px;
  vertical-align: middle;
}
.panel-value canvas {
  width: 100%;
  height: 190px;
  display: block;
}

/* AI panel */
.ai-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ai-badge {
  background: linear-gradient(135deg, var(--purple-2), var(--pink));
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 7px;
  box-shadow: 0 0 14px rgba(123, 63, 242, 0.6);
  flex-shrink: 0;
}
.ai-text {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
  margin: 0 0 26px;
  position: relative;
  z-index: 2;
}
.ai-glow {
  position: relative;
  height: 60px;
  margin: -10px 0 6px;
  pointer-events: none;
}
.ai-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--purple-2);
  position: relative;
  z-index: 2;
}

/* Opportunities list */
.opp-list {
  display: flex;
  flex-direction: column;
}
.opp-list li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
}
.opp-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.opp-list li:first-child {
  padding-top: 0;
}
.opp-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim);
  flex-shrink: 0;
  margin-top: 2px;
}
.opp-info {
  flex: 1;
  min-width: 0;
}
.opp-name {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 3px;
}
.opp-meta {
  font-size: 11.5px;
  color: var(--text-mute);
  line-height: 1.5;
}
.opp-score {
  background: rgba(123, 63, 242, 0.16);
  color: var(--purple-2);
  font-weight: 800;
  font-size: 12.5px;
  padding: 6px 9px;
  border-radius: 8px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Data sources list */
.ds-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.ds-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
}
.ds-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--purple-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ds-icon i {
  width: 13px;
  height: 13px;
}
.ds-name {
  width: 118px;
  flex-shrink: 0;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ds-bar-track {
  flex: 1;
  height: 6px;
  background: var(--panel-2);
  border-radius: 6px;
  overflow: hidden;
}
.ds-bar-fill {
  height: 100%;
  border-radius: 6px;
}
.ds-pct {
  width: 34px;
  text-align: right;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.ds-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-dim);
}
.ds-total span {
  color: #fff;
  font-weight: 800;
  font-size: 15px;
}

.view-all {
  font-size: 12px;
  font-weight: 600;
  color: var(--purple-2);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Table */
.table-panel {
  margin-bottom: 0;
}
.table-scroll {
  overflow-x: auto;
}
.reports-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}
.reports-table th {
  text-align: left;
  color: var(--text-mute);
  font-weight: 600;
  font-size: 11.5px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.reports-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-dim);
}
.reports-table td.name {
  color: var(--text);
  font-weight: 600;
}
.status-pill {
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
}
.status-pill.completed {
  background: rgba(61, 220, 151, 0.13);
  color: var(--green);
}
.status-pill.processing {
  background: rgba(91, 140, 255, 0.13);
  color: var(--blue);
}
.row-actions {
  display: flex;
  gap: 6px;
}
.icon-btn {
  width: 27px;
  height: 27px;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.icon-btn i {
  width: 13px;
  height: 13px;
}

/* icons */
i[data-ic] {
  display: inline-flex;
  width: 18px;
  height: 18px;
}
i[data-ic] svg {
  width: 100%;
  height: 100%;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1240px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}

@media (max-width: 1080px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .col-side {
    order: 3;
  }
  .row-1 {
    grid-template-columns: 1fr;
  }
  .row-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .topnav {
    display: none;
  }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .hamburger {
    display: flex;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 84px;
    width: 258px;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .content {
    padding: 18px 16px 50px;
  }
  .topbar {
    padding: 12px 16px;
  }
  .brand-sub {
    display: none;
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .kpi-card {
    padding: 14px;
  }
  .kpi-value {
    font-size: 21px;
  }
  .page-head h1 {
    font-size: 20px;
  }
  .page-icon {
    width: 40px;
    height: 40px;
  }
  .btn span {
    display: none;
  }
  .btn {
    padding: 9px 11px;
  }
  .topbar-right .btn-ghost {
    display: none;
  }
  .geo-wrap {
    flex-direction: column;
    align-items: stretch;
  }
  .geo-legend {
    min-width: 0;
  }
  .panel {
    padding: 14px;
  }
  .ds-name {
    width: auto;
    flex: 1;
  }
}

@media (max-width: 420px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .brand-name {
    font-size: 15px;
  }
}

/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 768px) {
  .topbar {
    height: 64px;
  }

  .topbar-inner {
    padding: 0 16px;
  }

  /* Hide desktop elements */

  .desktop-nav,
  .top-actions {
    display: none;
  }

  /* Brand */

  .dlogo {
    width: 36px;
    height: 36px;

    font-size: 20px;
  }

  .brand-text strong {
    font-size: 15px;
  }

  .brand-text small {
    font-size: 8px;
  }

  /* Hamburger */

  .burger {
    display: flex;
  }

  /* Mobile dropdown */

  .mobile-nav {
    position: absolute;

    top: calc(100% + 8px);
    left: 12px;
    right: 12px;

    display: flex;
    flex-direction: column;

    padding: 10px;

    background: linear-gradient(
      145deg,
      rgba(8, 14, 28, 0.98),
      rgba(5, 10, 22, 0.98)
    );

    border: 1px solid rgba(92, 105, 139, 0.22);

    border-radius: 14px;

    box-shadow:
      0 20px 45px rgba(0, 0, 0, 0.45),
      0 0 25px rgba(91, 33, 182, 0.08);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    opacity: 0;
    visibility: hidden;

    transform: translateY(-8px);

    transition:
      opacity 0.25s ease,
      transform 0.25s ease,
      visibility 0.25s ease;
  }

  /* Open state */

  .mobile-nav.show {
    opacity: 1;
    visibility: visible;

    transform: translateY(0);
  }

  /* Links */

  .mobile-nav a {
    min-height: 47px;

    display: flex;
    align-items: center;

    gap: 13px;

    padding: 0 13px;

    border-radius: 9px;

    color: #8995ad;

    text-decoration: none;

    font-size: 13px;
    font-weight: 500;

    transition:
      background 0.2s ease,
      color 0.2s ease;
  }

  .mobile-nav a i {
    width: 20px;

    text-align: center;

    font-size: 16px;

    color: #74819a;
  }

  .mobile-nav a:hover {
    color: #fff;

    background: rgba(124, 58, 237, 0.08);
  }

  .mobile-nav a:hover i {
    color: #a78bfa;
  }

  /* Active */

  .mobile-nav a.active {
    color: #fff;

    background: linear-gradient(
      90deg,
      rgba(124, 58, 237, 0.16),
      rgba(34, 211, 238, 0.04)
    );

    border: 1px solid rgba(124, 58, 237, 0.14);
  }

  .mobile-nav a.active i {
    color: #a78bfa;
  }

  /* Divider */

  .mobile-divider {
    height: 1px;

    margin: 9px 4px;

    background: rgba(100, 115, 145, 0.14);
  }

  /* Account */

  .mobile-account {
    display: flex;
    align-items: center;

    gap: 11px;

    padding: 10px 8px 7px;
  }

  .mobile-account .avatar {
    width: 36px;
    height: 36px;
  }

  .mobile-account > div:last-child {
    display: flex;
    flex-direction: column;

    line-height: 1.1;
  }

  .mobile-account strong {
    color: #e8edf7;

    font-size: 11px;
  }

  .mobile-account small {
    margin-top: 4px;

    color: #65728b;

    font-size: 9px;
  }
}

/* =====================================================
   VERY SMALL PHONES
===================================================== */

@media (max-width: 380px) {
  .topbar-inner {
    padding: 0 12px;
  }

  .brand-text small {
    display: none;
  }

  .mobile-nav {
    left: 8px;
    right: 8px;
  }
}

/* ---- Mobile nav / burger breakpoint (desktop untouched above 860px) ---- */
@media (max-width: 860px) {
  .topbar-right {
    display: none;
  }
  .nav {
    display: flex;
    position: absolute;
    top: calc(100% + 10px);
    right: 16px;
    left: 16px;
    width: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: linear-gradient(
      160deg,
      rgba(9, 15, 30, 0.98),
      rgba(5, 9, 20, 0.98)
    );
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 14px 16px 18px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    box-shadow: 0 24px 50px -12px rgba(0, 0, 0, 0.55);

    /* Smooth reveal instead of an abrupt display:none/flex swap,
       and no inner scrollbar under normal use. */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px) scale(0.98);
    transform-origin: top center;
    transition:
      opacity 0.22s ease,
      transform 0.22s ease,
      visibility 0.22s ease;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 45;
  }
  .nav.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }
  .nav__link {
    width: 100%;
    padding: 13px 6px;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
  }
  .nav__link--active::after {
    display: none;
  }

  .nav__pages {
    width: 100%;
  }
  .nav__pages-trigger {
    width: 100%;
  }
  .mega {
    position: static;
    transform: none;
    min-width: 0;
    width: 100%;
    grid-template-columns: 1fr;
    gap: 4px;
    box-shadow: none;
    border-color: var(--border-soft);
    background: var(--surface-2);
    margin-top: 6px;
    display: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .nav__pages.is-open .mega {
    display: grid;
  }
  .mega__col a {
    padding: 9px 4px;
  }

  /* Login / Explore buttons, moved out of the header and shown
     full-width inside the hamburger menu on mobile only. */
  .nav__mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    padding-top: 14px;
  }
  .nav__mobile-actions .lang-switch {
    justify-content: center;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
  }
  .nav__mobile-actions .btn--block {
    margin-top: 0;
    width: 100%;
  }
}

/* Extra safety for very narrow phones so the dropdown never
   touches the viewport edges or overlaps the burger/logo. */
@media (max-width: 380px) {
  .header__inner {
    padding: 16px 16px;
  }
  .brand {
    width: auto;
  }
  .nav {
    right: 10px;
    left: 10px;
    padding: 12px 12px 16px;
  }
}
