@font-face {
  font-family: 'Vazir';
  src: url('../fonts/Vazir.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --ok: #15803d;
  --bad: #b91c1c;
  --warn: #92400e;
}

* { box-sizing: border-box; }
html { direction: rtl; }
body {
  margin: 0;
  font-family: 'Vazir', Tahoma, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.9;
  font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: .3em 0; line-height: 1.5; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.inline { display: inline; }
.inline-label { display: inline-flex; gap: .5rem; align-items: center; font-weight: 600; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* ---- اجزای پایه ---- */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: .6em 1.2em;
  font: inherit;
  cursor: pointer;
  text-align: center;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-small { padding: .3em .8em; font-size: .85rem; }
.btn-block { display: block; width: 100%; }

input, select, textarea {
  display: block;
  width: 100%;
  padding: .55em .75em;
  margin: .3em 0 1em;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
textarea { resize: vertical; }
label { display: block; font-weight: 600; }
label.check { font-weight: 400; display: flex; gap: .5rem; align-items: center; margin: .3em 0; }
label.check input { width: auto; margin: 0; }
.cell { margin: 0; padding: .3em .5em; min-width: 90px; }

.alert, .notice { padding: .8em 1em; border-radius: 10px; margin: 1em 0; }
.alert-error, .notice-error { background: #fee2e2; color: var(--bad); }
.alert-ok, .notice-ok { background: #dcfce7; color: var(--ok); }
.notice { background: #fef3c7; color: var(--warn); }
.errlist { margin: 0; padding-right: 1.2rem; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 480px; }
.table th, .table td { padding: .6em; border-bottom: 1px solid var(--border); text-align: right; vertical-align: middle; }
.table tfoot th { border-top: 2px solid var(--border); }
.table tr.archived td { opacity: .5; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }

.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: #eef2ff; border-radius: 999px; padding: .15em .7em; margin: .15em; font-size: .85rem;
}
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid #0002; vertical-align: middle; }
.badge { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 .5em; font-size: .8rem; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.summary { padding-right: 1.2rem; }
fieldset.attr-box { border: 1px dashed var(--border); border-radius: 12px; padding: .8rem 1rem; margin: 1rem 0; }
fieldset.attr-box legend { font-weight: 700; padding: 0 .4rem; }

/* ---- ورود و نصب ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card, .install-card {
  background: var(--card); border-radius: 16px; padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .06); width: 100%; max-width: 440px;
}
.install-wrap { max-width: 720px; margin: 2rem auto; padding: 1rem; }
.install-card { max-width: none; }
.steps { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.steps li { padding: .3em .8em; border-radius: 999px; background: #e5e7eb; font-size: .85rem; }
.steps li.done { background: #dcfce7; color: var(--ok); }
.steps li.current { background: var(--primary); color: #fff; }

/* ---- پنل مدیریت ---- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: #0f172a; color: #e2e8f0;
  padding: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { font-weight: 700; font-size: 1.2rem; margin-bottom: 1rem; }
.sidebar nav a { display: block; padding: .6em .8em; border-radius: 8px; color: #e2e8f0; }
.sidebar nav a.active, .sidebar nav a:hover { background: #1e293b; }
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 1rem; background: var(--card);
  padding: .8rem 1.2rem; border-bottom: 1px solid var(--border);
}
.topbar h1 { flex: 1; font-size: 1.1rem; margin: 0; }
.topbar .user { display: flex; align-items: center; gap: .6rem; }
.menu-toggle {
  display: none; background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: .3em .6em; font-size: 1.1rem; cursor: pointer;
}
.content { padding: 1.2rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.card, .panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 1rem 1.2rem; margin-top: 1rem;
}
.card span { display: block; color: var(--muted); font-size: .9rem; }
.card strong { font-size: 1.15rem; }
.cards + .panel { margin-top: 1rem; }

/* ---- فروشگاه ---- */
.shop-head { background: var(--card); border-bottom: 1px solid var(--border); }
.head-row { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; }
.shop-head nav { display: flex; gap: 1rem; }
.shop-head .brand { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.shop-foot { text-align: center; color: var(--muted); padding: 2rem 0; }
.shop-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1.2rem; align-items: start; }
.cats ul { list-style: none; padding: 0; margin: 0; }
.cats a { display: block; padding: .4em .6em; border-radius: 8px; color: var(--text); }
.cats a.active, .cats a:hover { background: #e0e7ff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.product-card {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 1rem; color: var(--text);
}
.product-card:hover { border-color: var(--primary); }
.price { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.product-page .buy-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 1rem 1.2rem; margin: 1rem 0; max-width: 520px;
}
.attr-group { margin: 1rem 0; }
.attr-group h4 { margin: .2em 0; }
.options { display: flex; flex-wrap: wrap; gap: .5rem; }
.opt {
  display: inline-flex; align-items: center; gap: .4rem; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; padding: .35em .8em; font: inherit; cursor: pointer;
}
.opt.active { border-color: var(--primary); box-shadow: 0 0 0 2px #bfdbfe; }
.opt-color .swatch { width: 18px; height: 18px; }
.qty input { width: 110px; }
.checkout { display: grid; grid-template-columns: 1fr 320px; gap: 1rem; align-items: start; }

/* ---- موبایل ---- */
@media (max-width: 900px) {
  .checkout, .shop-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; right: 0; z-index: 50;
    transform: translateX(100%); transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .topbar { padding: .6rem .8rem; }
  .topbar .user span { display: none; }
  .content { padding: .8rem; }
  .install-wrap { margin: 1rem auto; }
  .install-card, .auth-card { padding: 1.1rem; }
  .card, .panel { padding: .8rem; }
  h1 { font-size: 1.3rem; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

/* ---- مسیر سفارش ---- */
.timeline { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 1rem 0; }
.timeline li { padding: .35em .9em; border-radius: 999px; background: #e5e7eb; color: var(--muted); font-size: .9rem; }
.timeline li.done { background: #dcfce7; color: var(--ok); }
.check.full { grid-column: 1 / -1; }

/* ---- تصاویر و جست‌وجو ---- */
.gallery { display: flex; flex-wrap: wrap; gap: .6rem; margin: .6rem 0; }
.gallery.thumbs img { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.gallery-main img { width: 100%; max-height: 480px; object-fit: contain; background: #fff; border-radius: 14px; border: 1px solid var(--border); }
.gal-item { width: 140px; text-align: center; display: flex; flex-direction: column; gap: .3rem; align-items: center; }
.gal-item img { width: 140px; height: 140px; object-fit: cover; border-radius: 10px; }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; }
.card-img { width: 100%; height: 180px; object-fit: contain; background: #fff; border-radius: 10px; margin-bottom: .5rem; }
.card-img.placeholder { display: flex; align-items: center; justify-content: center; color: var(--muted); border: 1px dashed var(--border); }
.search { display: flex; gap: .4rem; margin-bottom: 1rem; }
.search input { margin: 0; flex: 1; }
input[type="search"] { min-width: 220px; }

/* ---- اعلان‌ها ---- */
.bell { position: relative; font-size: 1.2rem; text-decoration: none; margin-inline-start: auto; }
.badge-red { position: absolute; top: -6px; right: -10px; background: #dc2626; color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 .4em; }
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-list li { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .5rem; background: #fff; }
.notif-list li.unread { border-color: #93c5fd; background: #eff6ff; }
.notif-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---- تیکت ---- */
.msg { border-radius: 12px; padding: .6rem .9rem; margin-bottom: .6rem; max-width: 85%; }
.msg-customer { background: #eff6ff; margin-inline-start: auto; }
.msg-admin { background: #f0fdf4; }
.msg-head { display: flex; justify-content: space-between; gap: 1rem; }
.unread-row td { font-weight: 700; }

/* ---- باشگاه و کیف پول ---- */
.loyalty-box { background: #fefce8; border-color: #fde68a; }

/* ---- فاکتور و برگه جمع‌آوری ---- */
body.print { background: #fff; }
.print-actions { display: flex; gap: .6rem; padding: 1rem; }
.doc { max-width: 820px; margin: 0 auto; padding: 1.5rem; background: #fff; }
.doc-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--text); padding-bottom: .6rem; margin-bottom: 1rem; }
.doc-meta div { font-size: .95rem; }
.totals { width: 60%; margin-inline-start: auto; }
.totals tr.grand th, .totals tr.grand td { font-size: 1.1rem; border-top: 2px solid var(--text); }
.check-cell { width: 60px; text-align: center; font-size: 1.3rem; }
.qty-cell { font-size: 1.2rem; }
@media print {
  .print-actions, .menu-toggle { display: none !important; }
  body { background: #fff; }
  .doc { padding: 0; box-shadow: none; }
  a { color: inherit; }
}

/* ---- نمودار ساده و انبار ---- */
.bars { display: grid; gap: .3rem; margin-bottom: 1rem; }
.bar-row { display: grid; grid-template-columns: 60px 1fr 140px; gap: .5rem; align-items: center; }
.bar { background: #e5e7eb; border-radius: 6px; height: 14px; overflow: hidden; }
.bar > div { background: var(--primary); height: 100%; }

/* ---- بخش دو: فیلترها و پیشنهاد جست‌وجو ----*/
.suggest-wrap { position: relative; }
.suggest-box { position: absolute; top: 100%; right: 0; left: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; z-index: 20; box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.suggest-box a { display: block; padding: .5rem .8rem; color: var(--text); border-bottom: 1px solid var(--border); }
.suggest-box a:hover { background: #eef2ff; }
.attr-filter { border: 1px solid var(--border); border-radius: 10px; padding: .4rem .7rem; margin: .5rem 0; }
.attr-filter legend { font-weight: 700; font-size: .9rem; }
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---- فونت یکسان با قالب فروشگاه (وزیرمتن) ---- */
body { font-family: 'VazirLocal', 'Vazirmatn', 'Vazir', Tahoma, 'Segoe UI', sans-serif; }

/* ---- منوی گروه‌بندی‌شده ---- */
.sidebar nav { display: block; }
.nav-group { margin-bottom: 14px; }
.nav-title { font-size: 12px; color: #94a3b8; padding: 6px 10px 4px; font-weight: 700; letter-spacing: .2px; }
.sidebar nav a { font-size: 14px; padding: 7px 12px; }

/* ---- منوی کشویی ---- */
.nav-group { margin-bottom: 6px; border-radius: 8px; }
.nav-group > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: '▾'; font-size: 12px; transition: transform .2s; }
.nav-group:not([open]) > summary::after { transform: rotate(-90deg); }
.nav-group > a { display: block; margin-top: 2px; }
.nav-group > summary:hover { color: #fff; }
.site-link { display: block; margin-bottom: 12px; padding: 8px 12px; border-radius: 8px; background: #1e293b; color: #93c5fd !important; font-size: 14px; }
.site-link-top { font-size: 14px; color: var(--primary); white-space: nowrap; }
