/* ============================================================
   Stage 3.5 — Ma'muriyat (UI_V3_ADMIN, html.v3admin). Classes: sa-.
   The superadmin panel overlay becomes a full page (like Profil); the
   sub-screens keep their markup and get the new card look.
   ============================================================ */
html.v3admin #shopPanelOverlay { z-index: 90; background: var(--bg); backdrop-filter: none; align-items: stretch; justify-content: center; padding: 0; }
html.v3admin #shopPanelOverlay > .modal { max-width: 760px; width: 100%; height: 100%; max-height: none; border-radius: 0; animation: none; background: var(--bg); box-shadow: none; }
html.v3admin #shopPanelStack { padding: 16px 16px calc(32px + env(safe-area-inset-bottom, 0px)); }
html.v3admin.tg-mobile #shopPanelStack { padding-top: calc(14px + max(env(safe-area-inset-top, 0px), var(--s3-safe-top, 0px)) + var(--s3-content-top, 46px)); }
/* Telegram's own Back / Close do this on a phone */
html.v3admin.tg-mobile #shopPanelCloseBtn, html.v3admin.tg-mobile #shopPanelStack .panel-back-row { display: none; }
html.v3admin #shopPanelCloseBtn { position: fixed; top: 16px; right: 16px; z-index: 5; }
@media (min-width: 900px) {
  html.v3admin #shopPanelOverlay { top: var(--s3-head-h, 69px); }
  html.v3admin #shopPanelOverlay > .modal { max-width: 1240px; }
  html.v3admin #shopPanelStack { padding: 24px; }
  html.v3admin #shopPanelCloseBtn { top: calc(var(--s3-head-h, 69px) + 16px); right: 24px; }
  /* sub-screens (edit, sellers, audit...) stay a comfortable reading width */
  html.v3admin #shopPanelStack .forum-screen:not(:has(.sa-page)) { padding-left: max(0px, calc((100% - 720px) / 2)); padding-right: max(0px, calc((100% - 720px) / 2)); }
}

/* shared cards for the old sub-screens */
html.v3admin #shopPanelStack .panel-nav-list { gap: 0; background: var(--card); border: 1px solid var(--card-border); border-radius: 18px; overflow: hidden; }
html.v3admin #shopPanelStack .panel-nav-item { background: none; border-radius: 0; border-top: 1px solid var(--card-border); padding: 14px; font-size: 15px; }
html.v3admin #shopPanelStack .panel-nav-item:first-child { border-top: 0; }
html.v3admin #shopPanelStack .panel-warn-banner { border-radius: 14px; font-weight: 700; }
html.v3admin #shopPanelStack .shop-stat { background: var(--card); border: 1px solid var(--card-border); border-radius: 14px; }
html.v3admin #shopPanelStack .panel-screen-title { font-family: 'Manrope', sans-serif; font-weight: 800; }

/* layout */
.sa-page { display: flex; flex-direction: column; gap: 12px; }
.sa-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sa-side, .sa-pane { display: none; }
.sa-narrow { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 900px) {
  .sa-page { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
  .sa-shops { grid-template-columns: 240px minmax(0, 400px) minmax(0, 1fr); }
  .sa-side { display: block; position: sticky; top: 0; }
  .sa-pane { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .sa-shops ~ * { display: none; }
  #shopPanelStack .forum-screen:has(.sa-shops) > .panel-back-row { display: none; }
}
.sa-card { background: var(--card); border: 1px solid var(--card-border); border-radius: 18px; }
.sa-nav { padding: 6px; display: flex; flex-direction: column; }
.sa-nav button { height: 42px; border: 0; border-radius: 10px; background: none; color: var(--text); text-align: left; padding: 0 12px; font: 700 15px 'Manrope', sans-serif; cursor: pointer; }
.sa-nav button.is-on { background: rgba(var(--accent-rgb), .12); color: var(--accent); font-weight: 800; }

.sa-hero { display: flex; align-items: center; gap: 12px; }
.sa-crown { width: 46px; height: 46px; border-radius: 14px; background: #0F172A; display: grid; place-items: center; font-size: 22px; flex: none; }
.sa-hero small { font-size: 13px; color: var(--text-dim); }
html.v3admin #shopPanelStack .sa-title { margin: 0; font-size: 22px; }
.sa-warn { background: #FEF3C7; border: 1px solid #FDE68A; color: #92400E; border-radius: 14px; padding: 10px 14px; font-size: 13px; font-weight: 700; line-height: 1.45; }
:root[data-theme="dark"] .sa-warn, html.v3admin:not([data-theme="light"]) .sa-warn { background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.35); color: #FBBF24; }
.sa-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sa-stats4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .sa-stats4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sa-stat { background: var(--card); border: 1px solid var(--card-border); border-radius: 16px; padding: 11px 12px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sa-stat small { font-size: 12px; color: var(--text-dim); }
.sa-stat b { font: 800 19px 'Manrope', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-stat b.is-red { color: #DC2626; }

.sa-menu { overflow: hidden; }
.sa-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: none; border: 0; border-top: 1px solid var(--card-border); color: var(--text); text-align: left; cursor: pointer; font-family: inherit; }
.sa-row:first-child { border-top: 0; }
@media (hover: hover) { .sa-row:hover, .sa-shop:hover { background: var(--chip); } }
.sa-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--chip); display: grid; place-items: center; font-size: 18px; flex: none; }
.sa-row.is-orange .sa-ic { background: rgba(234,88,12,.12); }
.sa-row.is-red .sa-ic { background: rgba(220,38,38,.12); }
.sa-row.is-red b { color: #DC2626; }
.sa-row-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sa-row-t b { font-size: 15px; }
.sa-row-t small { font-size: 12px; color: var(--text-dim); }
.sa-row-r { font-size: 13px; color: var(--text-dim); }
.sa-chev { color: var(--text-dim); opacity: .7; flex: none; }

/* shop list */
.sa-search { display: flex; gap: 8px; }
.sa-search input { flex: 1; min-width: 0; height: 46px; box-sizing: border-box; border-radius: 14px; border: 1px solid var(--card-border); background: var(--card); color: var(--text); padding: 0 14px; font: 500 16px 'Manrope', sans-serif; outline: none; }
.sa-search input:focus { border-color: var(--accent); }
.sa-add { height: 46px; padding: 0 16px; border: 0; border-radius: 14px; background: var(--accent); color: var(--btn-text); font: 800 14px 'Manrope', sans-serif; cursor: pointer; white-space: nowrap; }
.sa-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.sa-filters button { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--card-border); background: var(--card); color: var(--text-dim); font: 700 12.5px 'Manrope', sans-serif; cursor: pointer; }
.sa-filters button.is-on { background: rgba(var(--accent-rgb), .12); border-color: transparent; color: var(--accent); }
.sa-list { overflow: hidden; }
.sa-shop { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: none; border: 0; border-top: 1px solid var(--card-border); color: var(--text); text-align: left; cursor: pointer; font-family: inherit; }
.sa-shop:first-child { border-top: 0; }
.sa-shop.is-sel { background: rgba(var(--accent-rgb), .08); }
.sa-shop-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sa-shop-t b { font-size: 15px; }
.sa-logo { border-radius: 12px; flex: none; object-fit: cover; color: #fff; font-weight: 800; display: inline-grid; place-items: center; }
.sa-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.sa-chip { height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; white-space: nowrap; }
.sa-chip.is-ok { background: rgba(22,163,74,.12); color: #15803D; }
.sa-chip.is-warn { background: rgba(245,158,11,.16); color: #B45309; }
.sa-chip.is-bad { background: rgba(220,38,38,.12); color: #B91C1C; }
.sa-shop-head { display: flex; align-items: center; gap: 12px; }
.sa-shop-head b { font: 800 20px 'Manrope', sans-serif; display: block; margin-bottom: 4px; }
.sa-pane-empty { color: var(--text-dim); font-size: 14px; padding: 40px 10px; text-align: center; }

/* Xabar tarqatish (lives in the Profil stack) */
html.v3admin .bc-hist { background: var(--card); border: 1px solid var(--card-border); border-radius: 18px; overflow: hidden; }
html.v3admin .bc-hrow { padding: 12px 14px; border-top: 1px solid var(--card-border); }
html.v3admin .bc-hrow:first-child { border-top: 0; }
html.v3admin .bc-st { border-radius: 11px; padding: 2px 9px; font-style: normal; font-weight: 800; }
html.v3admin .bc-prog { background: var(--card); border: 1px solid var(--card-border); border-radius: 18px; padding: 14px; }
html.v3admin .bc-pbar { height: 8px; border-radius: 4px; }
html.v3admin #bcNew { height: 48px; border-radius: 14px; font-weight: 800; }
.bc-mini { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; margin-top: 6px; }
.bc-mini i { display: block; height: 100%; background: var(--accent); }
/* a lone nav button outside a list (e.g. "Sotuvchi qo'shish") gets its own card */
html.v3admin #shopPanelStack .forum-screen > .panel-nav-item,
html.v3admin #shopPanelStack .forum-screen > div > .panel-nav-item:only-child { background: var(--card); border: 1px solid var(--card-border); border-radius: 18px; }
.sa-chip.is-hid { background: rgba(100,116,139,.16); color: var(--text-dim); }

/* ---- Stage 6: Tavsiyalar (pinned listings) ---- */
.sa-pins { overflow: hidden; padding: 0; }
.sa-pins-h { display: flex; align-items: center; gap: 10px; padding: 13px 14px; }
.sa-pins-h > span { width: 38px; height: 38px; border-radius: 12px; background: rgba(var(--accent-rgb), .12); display: grid; place-items: center; font-size: 18px; flex: none; }
.sa-pins-h b { display: block; font-size: 16px; } .sa-pins-h small { font-size: 12px; color: var(--text-dim); }
.sa-pin { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--card-border); }
.sa-pin-ph { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--chip); flex: none; display: grid; place-items: center; font-size: 22px; }
.sa-pin-ph img { width: 100%; height: 100%; object-fit: cover; }
.sa-pin-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sa-pin-t b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-pin-t small { font-size: 12px; color: var(--text-dim); }
.sa-pin-t em { font-style: normal; font-size: 11.5px; color: var(--text-dim); }
.sa-pin-t em i { font-style: normal; font-weight: 800; } .sa-pin-t em i.is-ok { color: #16A34A; } .sa-pin-t em i.is-warn { color: #D97706; }
.sa-pin-x { width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(220,38,38,.35); background: rgba(220,38,38,.08); color: #DC2626; font-weight: 800; cursor: pointer; flex: none; }
.sa-note { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin: 10px 4px; }
