/* ── Admin Pages ── */
.wfx-page-admin .wfx-main-content,
.wfx-page-admin_orders .wfx-main-content,
.wfx-page-admin_products .wfx-main-content,
.wfx-page-admin_settings .wfx-main-content {
  padding-top: 32px;
}

/* ── Layout ── */
.wfx-wrap {
  width: 100%;
  max-width: 1180px;
  margin: auto;
}

.wfx-admin-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* ── Stat Card ── */
.wfx-admin-stat {
  min-height: 110px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--wfx-border);
  border-radius: 18px;
  background: var(--wfx-card);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12);
}

.wfx-admin-stat-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--wfx-p) 28%, transparent);
  border-radius: 14px;
  color: var(--wfx-p);
  background: color-mix(in srgb, var(--wfx-p) 10%, transparent);
  font-size: 19px;
}

.wfx-admin-stat-val {
  font-size: 18px;
  font-weight: 900;
  color: var(--wfx-txt, #f4f7ff);
}

.wfx-admin-stat-lbl {
  margin-top: 3px;
  font-size: 9px;
  font-weight: 700;
  color: var(--wfx-muted);
}

/* ── Admin Tabs ── */
.adm-tabs {
  display: flex;
  gap: 6px !important;
  border-color: var(--wfx-border) !important;
}

.adm-tab {
  min-height: 38px !important;
  color: var(--wfx-muted) !important;
  font-family: var(--wfx-font, "Cairo", sans-serif) !important;
}

.adm-tab.active {
  color: var(--wfx-txt, #fff) !important;
  background: color-mix(in srgb, var(--wfx-p) 12%, transparent) !important;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .wfx-admin-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  body[class*="wfx-page-admin"] .wfx-btn,
  body[class*="wfx-page-admin"] .btn {
    min-height: 46px;
    padding-inline: 14px;
    font-size: 12px;
  }

  .wfx-admin-row {
    align-items: flex-start;
  }

  .wfx-admin-brand p {
    max-width: 205px;
    line-height: 1.5;
  }

  .wfx-admin-actions {
    flex: 0 0 auto;
  }

  .wfx-admin-actions .wfx-btn {
    width: 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 0;
  }

  .wfx-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .wfx-menu-grid .menu-item {
    min-height: 56px;
    padding: 10px;
    gap: 8px;
  }

  .wfx-menu-grid .menu-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .wfx-menu-grid .menu-label {
    font-size: 12px;
  }

  .wfx-product-row-actions,
  .wfx-admin-form-actions,
  .tg-test-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px !important;
  }

  .wfx-product-row-actions form,
  .wfx-admin-form-actions form,
  .tg-test-actions form {
    display: block !important;
    min-width: 0;
    margin: 0 !important;
  }

  .wfx-product-row-actions .wfx-btn,
  .wfx-admin-form-actions .wfx-btn,
  .tg-test-actions .wfx-btn {
    width: 100% !important;
    min-width: 0;
  }

  .wfx-admin-form-actions {
    grid-template-columns: 1fr !important;
  }

  .wfx-product-row-actions .wfx-btn.danger,
  .wfx-product-row-actions form:last-child,
  .wfx-admin-form-actions .wfx-btn.danger {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .wfx-admin-grid {
    grid-template-columns: 1fr;
  }

  .wfx-admin-stat {
    min-height: 92px;
  }

  .wfx-menu-grid {
    grid-template-columns: 1fr;
  }

  .wfx-menu-grid .menu-item {
    min-height: 52px;
    padding: 9px 12px;
  }
}

/* ── Horizontal action rail for narrow touch screens ── */
@media (max-width: 700px) {
  .wfx-scroll-actions,
  .adm-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 8px;
    margin-inline: -2px;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--wfx-p) 55%, transparent) transparent;
    scroll-snap-type: inline proximity;
  }

  .wfx-scroll-actions::-webkit-scrollbar,
  .adm-tabs::-webkit-scrollbar {
    height: 5px;
  }

  .wfx-scroll-actions::-webkit-scrollbar-thumb,
  .adm-tabs::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: color-mix(in srgb, var(--wfx-p) 48%, transparent);
  }

  .wfx-scroll-actions > *,
  .adm-tabs > * {
    flex: 0 0 auto !important;
    min-width: max-content;
    scroll-snap-align: start;
  }

  .wfx-scroll-actions .wfx-btn,
  .wfx-scroll-actions .btn,
  .adm-tabs .adm-tab {
    width: auto !important;
    min-height: 46px !important;
    padding-inline: 15px !important;
    white-space: nowrap;
  }

  .wfx-scroll-actions .wfx-btn i,
  .wfx-scroll-actions .btn i {
    margin-inline-end: 4px;
  }
}

/* ── Fast mobile touch feedback ── */
@media (hover: none) and (pointer: coarse) {
  body[class*="wfx-page-admin"] .wfx-btn,
  body[class*="wfx-page-admin"] .btn,
  .wfx-menu-grid .menu-item,
  .wfx-menu-toggle,
  .adm-tab {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }

  body[class*="wfx-page-admin"] .wfx-btn,
  body[class*="wfx-page-admin"] .btn,
  .wfx-menu-grid .menu-item,
  .wfx-menu-toggle {
    transition-duration: 90ms !important;
  }

  body[class*="wfx-page-admin"] .wfx-btn:active,
  body[class*="wfx-page-admin"] .btn:active,
  .wfx-menu-grid .menu-item:active,
  .wfx-menu-toggle:active {
    transform: translateY(0) scale(0.98) !important;
    filter: brightness(0.96);
  }

  .wfx-scroll-actions {
    touch-action: pan-x;
    scroll-behavior: smooth;
  }
}

/* p3nd comprehensive admin UI patch */
.wfx-main-content,.wfx-wrap{min-width:0;}
.wfx-main-content{overflow-x:hidden;}
.wfx-card,.wfx-panel,.wfx-status{min-width:0;overflow-wrap:anywhere;}
.wfx-admin-stat,.wfx-menu-grid .menu-item{transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;}
.wfx-admin-stat:focus-within,.wfx-menu-grid .menu-item:focus-visible{transform:translateY(-1px);}
@media(max-width:700px){
  body[class*="wfx-page-admin"] input:not([type="checkbox"]):not([type="radio"]),
  body[class*="wfx-page-admin"] select,
  body[class*="wfx-page-admin"] textarea{min-height:44px;max-width:100%;}
  body[class*="wfx-page-admin"] table{min-width:680px;}
  body[class*="wfx-page-admin"] .wfx-card{padding:14px!important;}
}
@media(max-width:420px){
  .wfx-admin-stat{min-height:84px;padding:13px;gap:10px;}
  .wfx-admin-stat-icon{width:40px;height:40px;border-radius:12px;}
  .wfx-admin-stat-val{font-size:16px;}
  .wfx-admin-stat-lbl{font-size:8px;}
  .wfx-admin-actions .wfx-btn{width:42px;min-width:42px;min-height:42px;}
}

/* p3nd orders and banks UX shared patch */
#ordSearch,#ordStatus{min-height:42px;box-sizing:border-box;}
body[class*="wfx-page-admin_orders"] .wfx-table{min-width:760px;}
body[class*="wfx-page-admin_orders"] .wfx-card:has(.wfx-table){overflow-x:auto;}
body[class*="wfx-page-admin_banks"] .wfx-field{min-width:0;}
body[class*="wfx-page-admin_banks"] .wfx-field .wfx-input{min-height:42px;box-sizing:border-box;}
body[class*="wfx-page-admin_banks"] .wfx-bank-card{min-width:0;overflow-wrap:anywhere;}
@media(max-width:1000px){
  body[class*="wfx-page-admin_orders"] .wfx-admin-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:720px){
  body[class*="wfx-page-admin_banks"] form > div[style*="grid-template-columns:1fr 1fr"],
  body[class*="wfx-page-admin_banks"] form > div[style*="grid-template-columns:1fr 1fr 1fr"]{grid-template-columns:1fr!important;}
  body[class*="wfx-page-admin_banks"] .wfx-bank-card{max-width:none!important;}
  body[class*="wfx-page-admin_banks"] form .wfx-btn{min-height:46px;}
}
@media(max-width:620px){
  body[class*="wfx-page-admin_orders"] .wfx-admin-grid{grid-template-columns:1fr;}
  body[class*="wfx-page-admin_orders"] #ordSearch,
  body[class*="wfx-page-admin_orders"] #ordStatus{width:100%;min-height:46px;}
  body[class*="wfx-page-admin_orders"] .wfx-table{min-width:720px;font-size:11px;}
  body[class*="wfx-page-admin_orders"] .wfx-status{line-height:1.8;}
}
@media(max-width:420px){
  body[class*="wfx-page-admin_banks"] .wfx-card{padding:14px!important;}
  body[class*="wfx-page-admin_banks"] .wfx-bank-header{gap:8px;}
  body[class*="wfx-page-admin_banks"] .wfx-bank-name{font-size:13px;overflow-wrap:anywhere;}
}

/* p3nd visible dashboard design polish v2 */
body[class*="wfx-page-admin"] .wfx-card,body[class*="wfx-page-admin"] .wfx-panel{border-radius:20px;box-shadow:0 14px 32px rgba(2,6,23,.2),inset 0 1px 0 rgba(255,255,255,.035);}
body[class*="wfx-page-admin"] .wfx-admin-stat{border-radius:17px;background:linear-gradient(145deg,rgba(30,41,75,.78),rgba(15,23,42,.9));}
body[class*="wfx-page-admin"] .wfx-admin-stat:hover{border-color:rgba(167,139,250,.65);box-shadow:0 12px 25px rgba(76,29,149,.2);}
body[class*="wfx-page-admin"] .wfx-btn.primary{background:linear-gradient(135deg,#8b5cf6,#6d28d9);box-shadow:0 8px 18px rgba(109,40,217,.25);}
body[class*="wfx-page-admin"] .wfx-btn{border-radius:11px;}
body[class*="wfx-page-admin"] .wfx-table th{background:rgba(124,58,237,.12);}
body[class*="wfx-page-admin"] .wfx-status{border-radius:14px;}
@media(max-width:620px){body[class*="wfx-page-admin"] .wfx-card,body[class*="wfx-page-admin"] .wfx-panel{border-radius:16px}body[class*="wfx-page-admin"] .wfx-admin-stat{border-radius:14px}}