@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn[wght].woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --text: #17202b;
  --muted: #5d6877;
  --primary: #1f3a5f;
  --primary-hover: #183049;
  --primary-soft: #e8eef6;
  --accent: #b5651d;
  --ok: #1d7a4a;
  --ok-soft: #e4f4ea;
  --warn: #9a6200;
  --warn-soft: #fdf2dc;
  --danger: #b42323;
  --danger-soft: #fbe7e7;
  --info: #2457a6;
  --info-soft: #e6eefb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.7;
}
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ───── سربرگ ───── */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--primary); color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.top-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 16px; min-height: 56px; }
.brand { font-weight: 800; font-size: 16px; margin-inline-end: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand small { font-weight: 400; opacity: .75; font-size: 12px; }
.nav { display: flex; gap: 2px; }
.nav a {
  color: #dfe7f1; text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1;
}
.nav .out { opacity: .8; }

@media (max-width: 760px) {
  .top-in { padding: 6px 12px; }
  .brand small { display: none; }
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface);
    border-top: 1px solid var(--line); justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .nav a { flex-direction: column; gap: 0; color: var(--muted); font-size: 11px; padding: 6px 4px; flex: 1; text-align: center; }
  .nav a.on { background: var(--primary-soft); color: var(--primary); }
  .nav a:hover { background: var(--surface-2); color: var(--primary); }
  .nav .ico { font-size: 18px; }
  body { padding-bottom: 72px; }
}
@media (min-width: 761px) { .nav .ico { display: none; } }

main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 21px; margin: 0; font-weight: 800; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 700; }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.head .sp { flex: 1; }
.muted { color: var(--muted); }
.sp { flex: 1; }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ───── دکمه و فرم ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: 14px;
  min-height: 40px; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:focus-visible, .field input:focus-visible, .field textarea:focus-visible, select:focus-visible, .chip:focus-visible, .nav a:focus-visible {
  outline: 3px solid #7aa7e0; outline-offset: 1px;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); border-color: #e7b9b9; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.field { display: grid; gap: 4px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .field select, select.input, input.input {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
  padding: 8px 12px; min-height: 42px; font-size: 15px;
}
.field textarea { min-height: 84px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); }
.field.err input, .field.err textarea { border-color: var(--danger); }
.ltr { direction: ltr; text-align: right; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 16px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ───── نوار ابزار ───── */
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.search { flex: 1 1 220px; position: relative; }
.search input { width: 100%; padding-inline-start: 36px; }
.search::before { content: "⌕"; position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 18px; }
.chips { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.chip { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--muted); min-height: 34px; }
.chip.on { background: var(--primary); color: #fff; font-weight: 600; }
.chip:hover:not(.on) { background: var(--surface-2); color: var(--text); }
.viewsw .chip { font-size: 16px; padding: 4px 10px; }
.count { color: var(--muted); font-size: 13px; }

/* ───── کاتالوگ: آلبومی ───── */
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .album { grid-template-columns: 1fr 1fr; gap: 10px; } }
.pcard { display: flex; flex-direction: column; overflow: hidden; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.pcard:hover { box-shadow: var(--shadow-lg); }
.pcard .ph { aspect-ratio: 4 / 3; background: #fff; display: grid; place-items: center; border-bottom: 1px solid var(--line); position: relative; }
.pcard .ph img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.pcard .bd { padding: 10px 12px 12px; display: grid; gap: 4px; flex: 1; }
.pcard .t { font-weight: 700; font-size: 15px; line-height: 1.5; }
.pcard .t small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
.pcard .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; }
.price { font-weight: 800; color: var(--primary); white-space: nowrap; }
.price small { font-weight: 500; font-size: 12px; color: var(--muted); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.sun { background: #fff4e5; border-color: #f2d8b0; color: #8a5300; }
.tag.opt { background: var(--info-soft); border-color: #c9d8f2; color: var(--info); }
.ph .tag { position: absolute; top: 8px; inset-inline-start: 8px; }
.size { font-size: 13px; color: var(--muted); direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.dots { display: flex; gap: 4px; flex-wrap: wrap; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); background: #ccc; }
@media (max-width: 520px) {
  .pcard .bd { padding: 8px 10px 10px; }
  .pcard .t { font-size: 14px; }
}

/* ───── کاتالوگ: لیستی ───── */
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); }
.tbl th { text-align: right; font-size: 13px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl .th { width: 84px; }
.tbl .th img { width: 76px; height: 57px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.wrap-tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.colors { display: flex; flex-wrap: wrap; gap: 4px; }
.cpill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 20px; padding: 1px 8px 1px 4px; font-size: 13px; background: var(--surface); white-space: nowrap; }
.cpill .dot { width: 12px; height: 12px; }
.cpill b { font-weight: 700; color: var(--muted); font-size: 12px; }

/* لیستِ موبایل به‌صورتِ سطرهای فشرده */
@media (max-width: 760px) {
  .tbl.resp thead { display: none; }
  .tbl.resp, .tbl.resp tbody, .tbl.resp tr, .tbl.resp td { display: block; width: 100%; }
  .tbl.resp tr { display: grid; grid-template-columns: 84px 1fr; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .tbl.resp td { padding: 0; border: 0; }
  .tbl.resp td.th { grid-row: span 6; }
  .tbl.resp td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12px; }
  .tbl.resp td.hide-m { display: none; }
}

/* ───── پنجرهٔ محصول ───── */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 35, .5); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 16px; width: min(860px, 100%); max-height: calc(100dvh - 32px); overflow: auto; box-shadow: var(--shadow-lg); position: relative; }
.modal .x { position: sticky; top: 8px; float: left; margin: 8px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 20px; line-height: 1; }
.pview { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; padding: 20px; }
@media (max-width: 720px) {
  .modal-bg { padding: 0; place-items: end stretch; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .pview { grid-template-columns: 1fr; padding: 12px 16px 20px; gap: 12px; }
}
.gal-main { aspect-ratio: 4/3; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: grid; place-items: center; overflow: hidden; }
.gal-main img { width: 100%; height: 100%; object-fit: contain; }
.gal-th { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.gal-th button { border: 2px solid transparent; border-radius: 8px; padding: 0; background: #fff; cursor: pointer; width: 72px; height: 54px; flex: none; }
.gal-th button.on { border-color: var(--primary); }
.gal-th img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 12px 0; font-size: 14px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-weight: 600; }
.vpick { display: grid; gap: 6px; margin: 12px 0; }
.vopt { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px; cursor: pointer; background: var(--surface); text-align: right; width: 100%; }
.vopt.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.vopt .dot { width: 20px; height: 20px; }
.vopt .n { flex: 1; font-weight: 600; }
.vopt .s { font-size: 13px; color: var(--muted); }
.vopt[disabled] { opacity: .5; cursor: not-allowed; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 38px; height: 38px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 18px; }
.stepper button:hover { background: var(--line); }
.stepper span { min-width: 38px; text-align: center; font-weight: 700; }
.stepper.sm button { width: 30px; height: 30px; font-size: 16px; }
.stepper.sm span { min-width: 30px; }

/* ───── سبد و فرم ───── */
.two { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.cline { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cline:last-child { border-bottom: 0; }
.cline img { width: 72px; height: 54px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.cline .acts { display: grid; justify-items: end; gap: 6px; }
.sum { display: grid; gap: 6px; font-size: 14px; }
.sum .r { display: flex; justify-content: space-between; gap: 8px; }
.sum .tot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; font-size: 17px; font-weight: 800; }
.stack { display: grid; gap: 12px; }
.sticky { position: sticky; top: 72px; }

/* ───── سفارش‌ها ───── */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 20px; white-space: nowrap; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st.placed { background: var(--info-soft); color: var(--info); }
.st.preparing { background: var(--warn-soft); color: var(--warn); }
.st.shipped { background: var(--ok-soft); color: var(--ok); }
.st.cancelled { background: var(--danger-soft); color: var(--danger); }
.new-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; margin-inline-end: 6px; }

.timeline { display: flex; gap: 0; margin: 4px 0 8px; }
.timeline .s { flex: 1; text-align: center; position: relative; font-size: 13px; color: var(--muted); padding-top: 26px; }
.timeline .s::before { content: ""; position: absolute; top: 6px; right: 50%; transform: translateX(50%); width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); z-index: 1; }
.timeline .s::after { content: ""; position: absolute; top: 12px; right: 50%; width: 100%; height: 2px; background: var(--line-strong); }
.timeline .s:last-child::after { display: none; }
.timeline .s.done { color: var(--text); font-weight: 600; }
.timeline .s.done::before { background: var(--ok); border-color: var(--ok); }
.timeline .s.done::after { background: var(--ok); }
.timeline .s small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.shipimg { border-radius: var(--radius); border: 1px solid var(--line); max-height: 420px; object-fit: contain; background: #fff; width: 100%; cursor: zoom-in; }
.drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; background: var(--surface-2); display: grid; gap: 6px; justify-items: center; }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.drop img { max-height: 220px; border-radius: 8px; }
.note { border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.note.info { background: var(--info-soft); color: #1d447f; }
.note.warn { background: var(--warn-soft); color: #6f4700; }
.note.err { background: var(--danger-soft); color: var(--danger); }
.note.ok { background: var(--ok-soft); color: #145536; }

/* ───── API ───── */
code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; direction: ltr; unicode-bidi: isolate; }
pre.code { direction: ltr; text-align: left; background: #0f1720; color: #e6edf3; padding: 12px 14px; border-radius: 10px; overflow-x: auto; font: 13px/1.6 ui-monospace, Consolas, monospace; margin: 0; white-space: pre; }
#kv { user-select: all; white-space: pre-wrap; word-break: break-all; }
.docs p, .docs ol, .docs ul { margin: 0; }
.docs h2 { margin: 0; }
.ep { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 2px; }
.ep .m { display: inline-block; background: var(--ok-soft); color: var(--ok); font-weight: 800; font-size: 12px; padding: 0 6px; border-radius: 5px; }

/* ───── موجودیِ قطعی / تأمین‌کننده ───── */
.sk { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 0 7px; border-radius: 6px; line-height: 20px; white-space: nowrap; margin-inline-end: 4px; }
.sk.shop { background: var(--ok-soft); color: var(--ok); }
.sk.sup { background: var(--warn-soft); color: var(--warn); }
.sks { display: flex; flex-wrap: wrap; gap: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }

/* ───── حساب و پرداخت ───── */
.bal-n { font-size: 26px; font-weight: 800; line-height: 1.4; }
.bal-n.owe { color: var(--danger); }
.bal-n.cred { color: var(--ok); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kpis > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; }
.kpis span { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .kpis { grid-template-columns: 1fr 1fr; } }
.prow { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.prow-ph img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.prow-act { display: grid; gap: 6px; justify-items: end; min-width: 200px; }
@media (max-width: 640px) {
  .prow { grid-template-columns: 1fr auto; }
  .prow-act { grid-column: 1 / -1; justify-items: stretch; min-width: 0; }
}
.paytag { font-size: 12px; font-weight: 700; white-space: nowrap; }
.paytag.full { color: var(--ok); }
.paytag.part { color: var(--warn); }
.paytag.none { color: var(--muted); }

/* ───── مدیریتِ محصولات ───── */
.price-in { width: 130px; min-height: 36px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 8px; direction: ltr; text-align: left; font-variant-numeric: tabular-nums; }
.pcard .price-in { flex: 1; width: auto; min-width: 0; }
.pcard .row { flex-wrap: wrap; }
.price-in.saved { border-color: var(--ok); background: var(--ok-soft); }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 12px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; right: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { right: 21px; }
.switch input:focus-visible + span { outline: 3px solid #7aa7e0; }
.vis { font-size: 12px; font-weight: 700; white-space: nowrap; }
.nw { white-space: nowrap; }
.tbl td .size { white-space: nowrap; }
.vis.y { color: var(--ok); }
.vis.n { color: var(--muted); }
.pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 16px; }
.pick { position: relative; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: #fff; padding: 0; }
.pick img { aspect-ratio: 4/3; object-fit: contain; width: 100%; }
.pick.on { border-color: var(--ok); }
.pick .ck { position: absolute; top: 6px; inset-inline-end: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); display: grid; place-items: center; font-size: 14px; color: #fff; }
.pick.on .ck { background: var(--ok); border-color: var(--ok); }
.pick .ord { position: absolute; bottom: 6px; inset-inline-start: 6px; }

/* ───── ورود ───── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #1f3a5f 0%, #2c5282 55%, #f4f5f7 55.2%); }
.login .card { width: min(400px, 100%); padding: 28px 24px; }
.login h1 { margin-bottom: 4px; }

/* ───── فاکتور ───── */
.inv { background: #fff; max-width: 860px; margin: 0 auto; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: #111; }
.inv-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 12px; margin-bottom: 16px; }
.inv-h h1 { font-size: 22px; }
.inv-meta { display: grid; grid-template-columns: auto auto; gap: 2px 12px; font-size: 14px; }
.inv-meta dt { color: #555; }
.inv-meta dd { margin: 0; font-weight: 700; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.inv-box { border: 1px solid #ccc; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.inv-box h3 { margin: 0 0 4px; font-size: 13px; color: #555; font-weight: 600; }
.inv table { width: 100%; border-collapse: collapse; font-size: 14px; }
.inv th, .inv td { border: 1px solid #bbb; padding: 6px 8px; text-align: right; }
.inv th { background: #f1f2f4; font-weight: 700; }
.inv td.n, .inv th.n { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv tfoot td { font-weight: 700; }
.inv .grand td { font-size: 16px; background: #f1f2f4; }
.inv-foot { margin-top: 16px; font-size: 13px; color: #444; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.inv-stamp { display: inline-block; border: 2px solid var(--ok); color: var(--ok); padding: 2px 12px; border-radius: 6px; font-weight: 800; transform: rotate(-4deg); }
.inv-draft { display: inline-block; border: 2px solid var(--warn); color: var(--warn); padding: 2px 12px; border-radius: 6px; font-weight: 800; }
@media (max-width: 640px) {
  .inv { padding: 16px 12px; }
  .inv-parties { grid-template-columns: 1fr; }
  .inv-h { flex-direction: column; }
  .inv table { font-size: 12px; }
  .inv th, .inv td { padding: 4px 5px; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; padding: 0; }
  .top, .nav, .noprint, #toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .inv { border: 0; box-shadow: none; padding: 0; max-width: none; }
}

/* ───── پیام ───── */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #17202b; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); }
@media (max-width: 760px) { #toast { bottom: 84px; } }
@keyframes fade { from { opacity: 0; } }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, #eceef1 0%, #f6f7f9 50%, #eceef1 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
