/* ==========================================================================
   IDCF — پنل‌ها: پنل کاربری، پنل فروشگاه، پنل مدیریت
   ========================================================================== */

/* ══ پوسته‌ی پنل کاربری ══════════════════════════════════════════════ */
.panel-wrap { padding-top: 28px; padding-bottom: 40px; }
.panel-grid { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: start; }
.panel-sidebar {
  position: sticky; top: calc(var(--header-h) + 16px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-xs);
  max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; display: flex; flex-direction: column;
}
.psb-profile { padding: 22px 18px 16px; text-align: center; border-bottom: 1px solid var(--border); position: relative; }
.psb-profile::before { content: ''; position: absolute; inset: 0 0 auto; height: 70px; background: linear-gradient(135deg, var(--primary-bg), var(--gold-bg)); border-radius: 20px 20px 0 0; }
.psb-profile > * { position: relative; }
.psb-profile .avatar { margin: 0 auto 10px; box-shadow: 0 0 0 4px var(--surface); }
.psb-name { font-weight: 900; font-size: 1rem; }
.psb-username { font-size: .76rem; color: var(--text-muted); font-family: var(--font-ltr); display: inline-flex; align-items: center; gap: 4px; }
.psb-level { margin-top: 14px; text-align: right; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.pnav { padding: 8px 10px 14px; }
.pnav-title { font-size: .7rem; font-weight: 800; color: var(--text-muted); padding: 14px 10px 6px; letter-spacing: .02em; }
.pnav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px; color: var(--text-2);
  font-size: .87rem; font-weight: 600; transition: background .15s, color .15s; margin-bottom: 1px;
}
.pnav-link .ico { color: var(--text-muted); transition: color .15s; }
.pnav-link span { flex: 1; min-width: 0; }
.pnav-link:hover { background: var(--surface3); color: var(--text); }
.pnav-link.active { background: var(--primary-bg); color: var(--primary-d); font-weight: 800; }
[data-theme="dark"] .pnav-link.active { color: var(--primary); }
.pnav-link.active .ico { color: var(--primary); }
.pnav-link.danger, .pnav-link.danger .ico { color: var(--danger); }
.pnav-badge { font-size: .66rem; font-weight: 800; padding: 1px 8px; border-radius: 99px; background: var(--danger); color: #fff; flex: 0 0 auto !important; }
.pnav-badge.warn { background: var(--warning-bg); color: var(--warning); }
.pnav-badge.green { background: var(--success); }
.pnav-sep { height: 1px; background: var(--border); margin: 10px 6px; }
.pnav-store { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 11px; color: var(--text-2); font-size: .84rem; font-weight: 600; }
.pnav-store:hover { background: var(--surface3); color: var(--text); }
.pnav-store.active { background: var(--primary-bg); color: var(--text); font-weight: 800; }
.pnav-store .truncate { flex: 1; }
.pnav-store .store-logo-box.sm { width: 28px; height: 28px; border-radius: 8px; font-size: .75rem; }
.st-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.st-approved { background: var(--success); } .st-pending { background: var(--warning); } .st-rejected { background: var(--danger); }

.panel-content { min-width: 0; }
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.phead h1 { font-size: 1.45rem; font-weight: 900; }
.phead p { color: var(--text-muted); font-size: .88rem; margin-top: 2px; }
.phead-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel-mobilebar { display: none; }
.psb-backdrop { display: none; }

/* ══ ویجت‌های داشبورد ════════════════════════════════════════════════ */
.welcome {
  position: relative; overflow: hidden; border-radius: 22px; padding: 26px 28px; margin-bottom: 20px;
  background: var(--ink); color: var(--ink-text); display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; isolation: isolate;
}
.welcome::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(500px 260px at 0% 0%, rgba(44,203,156,.30), transparent 60%), radial-gradient(400px 220px at 100% 100%, rgba(242,183,5,.16), transparent 60%); }
.welcome h2 { color: #fff; font-size: 1.4rem; font-weight: 900; }
.welcome p { color: var(--ink-muted); font-size: .9rem; margin-top: 4px; }
.welcome .btn-row { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.welcome .btn-ghost-ink { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.14); }
.welcome .btn-ghost-ink:hover { background: rgba(255,255,255,.16); color: #fff; }
.welcome-level { min-width: 230px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 14px 16px; }
.welcome-level b { color: #fff; }
.welcome-level .progress { background: rgba(255,255,255,.1); margin: 10px 0 6px; }
.welcome-level small { color: var(--ink-muted); font-size: .74rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-cols > div > .card { margin-bottom: 20px; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-btn { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-size: .82rem; font-weight: 700; transition: all .15s; }
.quick-btn .ico { color: var(--primary); }
.quick-btn:hover { border-color: var(--primary); background: var(--primary-bg); color: var(--text); }

.checklist { list-style: none; display: grid; gap: 4px; }
.checklist li a, .checklist li > span { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; font-size: .84rem; color: var(--text-2); }
.checklist li a:hover { background: var(--surface3); color: var(--text); }
.checklist .ck { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: transparent; }
.checklist .done .ck { background: var(--success); border-color: var(--success); color: #fff; }
.checklist .done span.lbl { color: var(--text-muted); text-decoration: line-through; }
.checklist .lbl { flex: 1; }
.checklist .pts { font-size: .7rem; color: var(--primary); font-weight: 800; }

.mini-store { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); color: var(--text); }
.mini-store:last-child { border-bottom: 0; }
.mini-store:hover { background: var(--surface2); color: var(--text); }
.mini-store .ms-main { flex: 1; min-width: 0; }
.mini-store .ms-main b { display: block; font-size: .9rem; }
.mini-store .ms-main small { color: var(--text-muted); font-size: .74rem; display: flex; gap: 10px; flex-wrap: wrap; }

/* ══ پنل فروشگاه ═════════════════════════════════════════════════════ */
.sp-head { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 22px; margin-bottom: 20px; position: relative; overflow: hidden; }
.sp-head::before { content: ''; position: absolute; inset: 0 0 auto; height: 86px; background: linear-gradient(120deg, var(--primary-bg), var(--gold-bg)); }
.sp-head-in { position: relative; display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; padding-top: 22px; }
.sp-head .store-logo-box.lg { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 0 0 5px var(--surface); }
.sp-title { flex: 1; min-width: 220px; }
.sp-title h1 { font-size: 1.45rem; font-weight: 900; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sp-title .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.sp-title .meta span { display: inline-flex; align-items: center; gap: 5px; }
.sp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sp-tabs { margin-top: 18px; position: relative; }

.score-hero { display: flex; align-items: center; gap: 20px; }
.score-hero .sh-main b { font-size: 1.1rem; font-weight: 900; display: block; }
.score-hero .sh-main small { color: var(--text-muted); font-size: .8rem; }
.subscore { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 10px; font-size: .82rem; margin-bottom: 10px; }
.subscore .lbl { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.subscore .lbl .ico { color: var(--text-muted); }
.subscore b { text-align: left; font-weight: 800; }

.rv-item { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.rv-item:last-child { border-bottom: 0; }
.rv-item .rv-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rv-item .rv-top .truncate b { display: block; font-size: .88rem; }
.rv-item .rv-top small { color: var(--text-muted); font-size: .74rem; }
.rv-item .rv-body { font-size: .88rem; line-height: 1.95; color: var(--text-2); }
.rv-item .rv-subs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rv-item .rv-subs span { font-size: .72rem; background: var(--surface3); padding: 2px 9px; border-radius: 99px; color: var(--text-2); }
.reply-box { margin-top: 12px; }
.reply-box textarea { min-height: 80px; }
.reply-box details summary { cursor: pointer; list-style: none; display: inline-flex; }
.reply-box details summary::-webkit-details-marker { display: none; }
.reply-box details[open] summary { display: none; }

.embed-box { background: #0B1512; color: #D7E7E1; border-radius: 12px; padding: 14px; font-family: var(--font-mono); font-size: .76rem; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-all; line-height: 1.7; border: 1px solid var(--border); }

/* ══ پوسته‌ی پنل مدیریت ══════════════════════════════════════════════ */
.adm-body { background: var(--bg); }
.adm-shell { display: flex; min-height: 100vh; }
.adm-sidebar {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--sidebar-w); z-index: 200;
  background: var(--ink); color: var(--ink-text); display: flex; flex-direction: column;
  border-left: 1px solid rgba(255,255,255,.06); transition: transform .3s var(--ease);
}
.adm-sidebar::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(420px 260px at 100% 0%, rgba(44,203,156,.16), transparent 60%); }
.adm-sidebar > * { position: relative; }
.adm-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; }
.adm-brand .brand-name { color: #fff; }
.adm-brand small { display: block; font-size: .68rem; color: var(--gold-l); font-weight: 700; }
.adm-search { margin: 0 14px 10px; }
.adm-search .search-field input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08); color: #fff; height: 38px; }
.adm-search .search-field input::placeholder { color: var(--ink-muted); }
.adm-search .search-field > .ico { color: var(--ink-muted); }
.adm-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-color: rgba(255,255,255,.15) transparent; }
.adm-nav-title { font-size: .68rem; font-weight: 800; color: rgba(143,167,159,.75); padding: 14px 10px 6px; letter-spacing: .03em; }
.adm-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 11px; color: #B9CCC5;
  font-size: .86rem; font-weight: 600; transition: background .15s, color .15s; margin-bottom: 1px; position: relative;
}
.adm-link .ico { color: #7F978F; transition: color .15s; }
.adm-link span { flex: 1; }
.adm-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.adm-link:hover .ico { color: #fff; }
.adm-link.active { background: rgba(44,203,156,.14); color: #fff; font-weight: 800; }
.adm-link.active .ico { color: #5EF0C4; }
.adm-link.active::before { content: ''; position: absolute; right: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px 0 0 3px; background: #2CCB9C; }
.adm-badge { font-size: .66rem; font-weight: 800; padding: 1px 8px; border-radius: 99px; background: rgba(255,255,255,.1); color: #fff; }
.adm-badge.warn { background: var(--gold-l); color: #2A1E00; }
.adm-badge.danger { background: #F06A6A; color: #fff; }
.adm-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 10px; }
.adm-foot .adm-me { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.adm-foot .adm-me b { color: #fff; font-size: .84rem; display: block; }
.adm-foot .adm-me small { color: var(--ink-muted); font-size: .7rem; }
.adm-foot .icon-btn { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08); color: #C9DAD4; width: 36px; height: 36px; }
.adm-foot .icon-btn:hover { color: #fff; border-color: rgba(255,255,255,.3); }
.adm-avatar { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #16B88C, #077257); display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }

.adm-main { flex: 1; min-width: 0; margin-right: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.adm-top {
  position: sticky; top: 0; z-index: 100; height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.adm-top h1 { font-size: 1.05rem; font-weight: 900; }
.adm-top .crumbs { font-size: .74rem; color: var(--text-muted); }
.adm-top-actions { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.adm-pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: .78rem; font-weight: 700; color: var(--text-2); }
.adm-pill b { color: var(--text); }
.adm-pill.warn { border-color: color-mix(in srgb, var(--warning) 40%, transparent); color: var(--warning); background: var(--warning-bg); }
.adm-pill.warn b { color: var(--warning); }
.adm-pill:hover { color: var(--text); }
.adm-toggle { display: none; }
.adm-backdrop { display: none; }
.adm-content { padding: 28px; flex: 1; }

/* سازگاری صفحات قدیمی مدیریت */
.btn-admin-primary { background: var(--primary); color: var(--on-primary); }
.btn-admin-primary:hover { background: var(--primary-d); color: var(--on-primary); }

.queue-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.queue-item:last-child { border-bottom: 0; }
.queue-item .q-main { flex: 1; min-width: 0; }
.queue-item .q-main b { font-size: .88rem; display: block; }
.queue-item .q-main small { color: var(--text-muted); font-size: .74rem; }
.queue-item .q-text { font-size: .82rem; color: var(--text-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.queue-actions { display: flex; gap: 6px; flex-shrink: 0; }
.queue-actions form { display: inline; }

.health-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: .84rem; }
.health-item:last-child { border-bottom: 0; }
.health-item .ico { margin-top: 3px; }
.health-item.ok .ico { color: var(--success); }
.health-item.bad .ico { color: var(--danger); }
.health-item.warn .ico { color: var(--warning); }
.health-item small { display: block; color: var(--text-muted); font-size: .74rem; }

.activity { list-style: none; position: relative; padding-right: 18px; }
.activity::before { content: ''; position: absolute; right: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.activity li { position: relative; padding: 0 0 14px; font-size: .82rem; }
.activity li::before { content: ''; position: absolute; right: -18px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.activity li b { font-weight: 700; }
.activity li small { display: block; color: var(--text-muted); font-size: .72rem; }

/* ══ ریسپانسیو ═══════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dash-cols { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .panel-grid { grid-template-columns: 1fr; }
  .panel-mobilebar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
  .panel-sidebar {
    position: fixed; top: 0; bottom: 0; right: 0; width: min(310px, 88vw); max-height: none; z-index: 450; border-radius: 0;
    transform: translateX(105%); transition: transform .3s var(--ease);
  }
  body.sidebar-open .panel-sidebar { transform: none; }
  .psb-backdrop { display: block; position: fixed; inset: 0; background: rgba(5,12,10,.55); z-index: 440; opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.sidebar-open .psb-backdrop { opacity: 1; pointer-events: auto; }
  .welcome { grid-template-columns: 1fr; }

  .adm-sidebar { transform: translateX(105%); }
  body.sidebar-open .adm-sidebar { transform: none; }
  .adm-main { margin-right: 0; }
  .adm-toggle { display: inline-flex; }
  .adm-backdrop { display: block; position: fixed; inset: 0; background: rgba(5,12,10,.55); z-index: 190; opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.sidebar-open .adm-backdrop { opacity: 1; pointer-events: auto; }
  .adm-top { padding: 0 16px; }
  .adm-content { padding: 18px 16px; }
  .adm-pill.hide-md { display: none; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .welcome { padding: 20px; }
  .subscore { grid-template-columns: 90px 1fr 30px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
}

/* صفحات قدیمی با گرید inline: در موبایل تک‌ستونه شوند */
@media (max-width: 760px) {
  .adm-content [style*="grid-template-columns"], .panel-content [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .adm-content table:not(.table) { display: block; overflow-x: auto; }
  .adm-content { overflow-x: hidden; }
}

/* سازگاری با رنگ‌های قدیمی پنل مدیریت (بنفش → رنگ برند) */
:root { --adm: var(--primary); --adm-d: var(--primary-d); --adm-dd: var(--primary-d); --adm-bg: var(--primary-bg); --adm-bg2: var(--primary-bg); --adm-border: color-mix(in srgb, var(--primary) 30%, transparent); }
