:root {
  --bg: #0b1110;
  --bg-soft: #111816;
  --panel: #151d1b;
  --panel-light: #1f2a26;
  --panel-border: rgba(226, 232, 240, 0.1);
  --text: #f7faf8;
  --muted: #9aa7a0;
  --cyan: #2dd4bf;
  --cyan-light: #5eead4;
  --blue: #38bdf8;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --amber: #f59e0b;
  --shadow: 0 18px 45px -30px rgba(0, 0, 0, 0.75);
  --radius: 8px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; direction: rtl; font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Cairo", sans-serif;
  background-color: var(--bg);
  background-image: linear-gradient(180deg, #0b1110 0%, #101715 44%, #0b1110 100%);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom, 2rem);
}

a { color: inherit; text-decoration: none; transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
button, input, select, textarea { font: inherit; }

.shell { 
  width: 100%; 
  max-width: 1320px; 
  margin: 0 auto; 
  padding: 0 1.25rem 4rem; 
}

/* Fluid Typography */
h1 { font-size: clamp(2rem, 8vw, 3.5rem); font-weight: 900; line-height: 1.1; margin-bottom: 1rem; }
h2 { font-size: clamp(1.5rem, 5vw, 2.25rem); font-weight: 800; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; font-weight: 700; }

/* Topbar Mobile Refinement */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 8, 17, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 2rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  max-width: 1320px;
  margin: 0 auto;
}

.brand { font-size: 1.5rem; font-weight: 900; letter-spacing: -1px; display: flex; align-items: center; gap: 8px; }
.brand i, .brand span { color: var(--cyan); }

.nav { display: none; } /* Mobile Hidden */
@media (min-width: 1024px) {
  .nav { display: flex; gap: 2.5rem; }
  .nav a { font-weight: 700; color: var(--muted); font-size: 0.875rem; }
  .nav a:hover, .nav a.active { color: var(--cyan); }
}

.actions { display: flex; gap: 0.75rem; align-items: center; }

/* Buttons Refinement */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--cyan); color: #000; }
.btn-primary:active { transform: scale(0.96); }
.btn-outline { background: transparent; border-color: var(--panel-border); color: var(--text); }
.btn-sm { padding: 0.5rem 1.25rem; font-size: 0.8rem; }

/* Responsive Grid Engine */
.grid { display: grid; gap: 1.25rem; width: 100%; }
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Panel & Card Fidelity */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Improved Forms for Mobile */
.field-group { margin-bottom: 1.25rem; }
.field-group label { display: block; margin-bottom: 0.5rem; font-size: 0.8125rem; font-weight: 700; color: var(--muted); }
input, select, textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  color: var(--text);
  outline: none;
  font-size: 1rem;
  transition: all 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.1); }

/* Typography Helpers */
.text-cyan { color: var(--cyan); }
.text-muted { color: var(--muted); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.font-bold { font-weight: 700; }

/* Global Mobile Spacing */
.page-head {
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}
@media (min-width: 768px) {
  .page-head { flex-direction: row; justify-content: space-between; align-items: flex-end; }
}

.stack { display: flex; flex-direction: column; gap: 1.25rem; }

/* Responsive Utility: Hide on mobile */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .p-6 { padding: 1.25rem; }
  .p-8 { padding: 1.5rem; }
}

/* Raqamiyat 2026 UI layer */
.container { width: min(100%, 1180px); margin-inline: auto; }
.flex { display: flex; }
.inline { display: inline; }
.hidden { display: none !important; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
.flex-grow { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-w-0 { min-width: 0; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.mx-auto { margin-inline: auto; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mt-24 { margin-top: 6rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }
.mb-16 { margin-bottom: 4rem; }
.ml-1 { margin-left: .25rem; }
.ml-2 { margin-left: .5rem; }
.ml-4 { margin-left: 1rem; }
.mr-1 { margin-right: .25rem; }
.p-2 { padding: .5rem; }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.px-3 { padding-inline: .75rem; }
.px-4 { padding-inline: 1rem; }
.px-5 { padding-inline: 1.25rem; }
.px-6 { padding-inline: 1.5rem; }
.px-8 { padding-inline: 2rem; }
.px-10 { padding-inline: 2.5rem; }
.px-12 { padding-inline: 3rem; }
.py-1 { padding-block: .25rem; }
.py-2 { padding-block: .5rem; }
.py-3 { padding-block: .75rem; }
.py-4 { padding-block: 1rem; }
.py-12 { padding-block: 3rem; }
.py-20 { padding-block: 5rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }
.pt-10 { padding-top: 2.5rem; }
.pt-20 { padding-top: 5rem; }
.pb-10 { padding-bottom: 2.5rem; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-white { color: #fff; }
.text-black { color: #020617; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-amber-400, .text-amber-500 { color: var(--amber); }
.text-rose-500, .text-red-500 { color: var(--danger); }
.text-emerald-500 { color: var(--success); }
.text-slate-300 { color: #cbd5c9; }
.text-slate-400 { color: #aeb9b3; }
.text-slate-500 { color: var(--muted); }
.text-slate-600, .text-slate-700 { color: #6f7d76; }
.text-slate-800 { color: #3f4b45; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.font-black { font-weight: 900; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: .04em; }
.tracking-widest { letter-spacing: .08em; }
.leading-relaxed { line-height: 1.75; }
.leading-loose { line-height: 2; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.whitespace-nowrap { white-space: nowrap; }
.rounded { border-radius: 6px; }
.rounded-lg, .rounded-xl, .rounded-2xl, .rounded-3xl { border-radius: var(--radius); }
.rounded-full { border-radius: 999px; }
.border { border: 1px solid var(--panel-border); }
.border-t { border-top: 1px solid var(--panel-border); }
.border-r-4 { border-right: 4px solid; }
.border-dashed { border-style: dashed; }
.object-cover { object-fit: cover; }
.object-contain { object-fit: contain; }
.cursor-pointer { cursor: pointer; }
.opacity-20 { opacity: .2; }
.opacity-30 { opacity: .3; }
.opacity-50 { opacity: .5; }
.transition, .transition-all, .transition-colors, .transition-transform { transition: all .2s ease; }
.block { display: block; }
.no-underline { text-decoration: none; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-span-full { grid-column: 1 / -1; }

.bg-slate-800, .bg-slate-900, .bg-slate-900\/50 { background: var(--bg-soft); }
.bg-cyan, .bg-cyan-600 { background: var(--cyan); }
.bg-emerald-500 { background: var(--success); }
.bg-amber-500 { background: var(--warning); }
.bg-rose-500 { background: var(--danger); }
.shadow-cyan { box-shadow: 0 18px 36px -24px rgba(45, 212, 191, .85); }

header.desktop-header,
.mobile-header,
.mobile-nav-bar {
  background: rgba(11, 17, 16, .9) !important;
  border-color: rgba(226, 232, 240, .1) !important;
}

.topbar {
  min-height: 72px;
  border: 1px solid rgba(226, 232, 240, .08);
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(17, 24, 22, .72);
}

.brand { letter-spacing: 0; }
.brand i, .brand span { color: var(--cyan); }
.nav { gap: 1.2rem; }
.nav a {
  padding: .55rem .8rem;
  border-radius: var(--radius-sm);
}
.nav a:hover,
.nav a.active {
  background: rgba(45, 212, 191, .1);
  color: var(--cyan);
}

.btn {
  min-height: 42px;
  border-radius: var(--radius-sm);
  box-shadow: none;
}
.btn-primary {
  background: var(--cyan);
  color: #05201c;
  border-color: rgba(45, 212, 191, .2);
}
.btn-primary:hover {
  background: var(--cyan-light);
  transform: translateY(-1px);
}
.btn-outline {
  background: rgba(255, 255, 255, .02);
  border-color: rgba(226, 232, 240, .12);
  color: var(--text);
}
.btn-outline:hover {
  border-color: rgba(245, 158, 11, .45);
  background: rgba(245, 158, 11, .08);
}

.panel,
.product-v2-card,
.p-card-v6,
.management-card,
.admin-stats-card,
.variant-card,
.main-img-box,
.filter-sidebar,
.social-v6,
.auth-panel {
  border-radius: var(--radius) !important;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.018)) !important;
  border-color: rgba(226, 232, 240, .1) !important;
  box-shadow: var(--shadow) !important;
}

.page-head {
  padding-block: 1.25rem;
  border-bottom: 1px solid rgba(226, 232, 240, .08);
}
.eyebrow {
  display: block;
  color: var(--cyan);
  font-size: .72rem;
  font-weight: 900;
  margin-bottom: .55rem;
  text-transform: uppercase;
}

.hero-v6 {
  min-height: 62vh;
  display: grid;
  place-items: center;
  padding: clamp(4rem, 10vh, 7rem) 0 !important;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(45, 212, 191, .08), transparent 58%),
    url("/static/site/img/app-icon.svg") center 18% / 210px no-repeat;
}
.hero-v6 h1 { max-width: 820px; margin-inline: auto; letter-spacing: 0; }
.hero-v6 p { color: var(--muted); }
.cta-v6 { flex-wrap: wrap; }

.grid-v6,
.steps-v6,
.p-grid-v6,
.p-grid-v2 {
  gap: 1rem !important;
}
.card-v6,
.step-v6 {
  padding: 1.25rem;
  border: 1px solid rgba(226, 232, 240, .08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .025);
}
.icon-box-small,
.asc-icon {
  border-radius: var(--radius-sm) !important;
  background: rgba(45, 212, 191, .1) !important;
  color: var(--cyan) !important;
}
.p-v2-img,
.p-img-v6,
.main-img-box {
  background: #111816 !important;
}
.p-v2-title,
.p-body-v6 .title {
  letter-spacing: 0;
}
.p-v2-price,
.p-footer-v6 .price,
.price-tag,
.balance-display {
  color: var(--cyan) !important;
  letter-spacing: 0 !important;
}
.catalog-wrapper {
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) !important;
  gap: 1.25rem !important;
}
.mobile-filter-scroll {
  display: none;
  gap: .5rem;
  overflow-x: auto;
  padding-bottom: .75rem;
  margin-bottom: 1rem;
}
.m-chip,
.cat-link {
  border: 1px solid rgba(226, 232, 240, .08);
  background: rgba(255, 255, 255, .025);
  border-radius: var(--radius-sm);
}
.m-chip {
  flex: 0 0 auto;
  padding: .65rem .9rem;
  color: var(--muted);
  font-weight: 800;
  font-size: .8rem;
}
.m-chip.active,
.cat-link.active {
  background: rgba(45, 212, 191, .12);
  color: var(--cyan);
}

.auth-shell {
  min-height: 68vh;
  display: grid;
  place-items: center;
  padding-block: 2rem;
}
.auth-panel {
  width: min(100%, 460px);
  padding: clamp(1.25rem, 5vw, 2.25rem);
}
input,
select,
textarea {
  min-height: 44px;
  background: rgba(6, 10, 9, .6);
  border-color: rgba(226, 232, 240, .12);
}
textarea { min-height: 120px; resize: vertical; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, .55fr);
  gap: 1rem;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}
.action-btn,
.order-card-v3,
.activity-item {
  border: 1px solid rgba(226, 232, 240, .08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .025);
}

.admin-layout {
  background: transparent !important;
}
.admin-sidebar {
  background: rgba(11, 17, 16, .96) !important;
  border-left-color: rgba(226, 232, 240, .1) !important;
}
.admin-main {
  padding: 1.25rem !important;
}
.admin-nav-link {
  border-radius: var(--radius-sm) !important;
}
.admin-nav-link.active {
  background: rgba(45, 212, 191, .12) !important;
  color: var(--cyan) !important;
  border-color: rgba(45, 212, 191, .2) !important;
}
.admin-table {
  min-width: 760px;
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:row { flex-direction: row; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .shell {
    padding-inline: .9rem;
    padding-bottom: 88px !important;
  }
  .mobile-drawer {
    border-left: 1px solid rgba(226, 232, 240, .1);
    background: #0b1110 !important;
  }
  .catalog-wrapper,
  .product-layout,
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .catalog-wrapper {
    display: block !important;
    width: 100% !important;
  }
  .catalog-wrapper > main,
  .catalog-header,
  .search-box-v2,
  .p-grid-v2 {
    width: 100% !important;
    min-width: 0 !important;
  }
  .filter-sidebar {
    display: none;
  }
  .mobile-filter-scroll {
    display: flex;
  }
  .p-grid-v2,
  .p-grid-v6 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .main-img-box {
    border-radius: var(--radius) !important;
  }
  .variant-card {
    padding: 1rem !important;
    align-items: flex-start !important;
    gap: .75rem;
  }
  .price-tag {
    font-size: 1rem !important;
    white-space: nowrap;
  }
  footer {
    margin-top: 3rem !important;
    padding-top: 2rem !important;
  }
}

@media (max-width: 520px) {
  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.25rem; }
  .topbar { min-height: auto; }
  .hero-v6 {
    min-height: 58vh;
    background-size: 145px;
    background-position: center 14%;
  }
  .p-grid-v2,
  .p-grid-v6 {
    grid-template-columns: 1fr !important;
    gap: .75rem !important;
  }
  .p-v2-body,
  .p-body-v6 {
    padding: .75rem !important;
  }
  .p-v2-footer {
    align-items: stretch !important;
  }
  .p-v2-footer .btn {
    width: 100%;
  }
  .buy-btn-v2 {
    min-height: 52px;
    padding: .9rem !important;
    font-size: .95rem !important;
    border-radius: var(--radius) !important;
  }
  .panel,
  .auth-panel {
    padding: 1rem;
  }
}
