/* برگه‌ی چاپیِ نرخ‌نامه (/prices/print) — A4، با همان فونت و رنگِ سایت (زردِ Tailwind + سنگیِ گرم).
   برای چاپگرِ سیاه‌وسفید هم خوانا: رنگ فقط کمک است، فلش‌ها و وزنِ خط بارِ معنا را می‌برند. */
@font-face { font-family: Vazirmatn; src: url("/fonts/Vazirmatn-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url("/fonts/Vazirmatn-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url("/fonts/Vazirmatn-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url("/fonts/Vazirmatn-Black.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }

:root {
  --ink: #0C0A09; --ink-2: #292524; --fg: #1C1917; --fg-2: #44403C; --muted: #78716C; --line: #E7E5E4; --line-2: #D6D3D1;
  --wash: #F5F5F4; --wash-2: #FAFAF9; --yellow: #FACC15; --yellow-deep: #CA8A04; --yellow-soft: #FEF9C3;
  --rise: #DC2626; --fall: #059669;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #E7E5E4; color: var(--fg); font: 400 12px/1.7 Vazirmatn, Tahoma, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
img, svg { display: block; max-width: 100%; }
.icon { width: 18px; height: 18px; flex: none; }
.flipx { transform: scaleX(-1); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
:focus-visible { outline: 2px solid var(--yellow-deep); outline-offset: 2px; border-radius: 6px; }

/* ───── نوارِ ابزار (فقط صفحه) ───── */
.tools { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 12px max(16px, calc((100vw - 210mm) / 2)); background: rgb(250 250 249 / .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.tools label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.tools input { accent-color: var(--ink); width: 16px; height: 16px; }
.t-back { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-2); text-decoration: none; font-weight: 600; }
.t-back:hover { color: var(--ink); }
.t-cats { display: flex; flex-wrap: wrap; gap: 6px 12px; border: 0; margin: 0; padding: 0; flex: 1; min-width: 0; }
.t-cats legend { float: right; margin-inline-end: 4px; font-weight: 700; color: var(--muted); }
.t-opts { display: flex; gap: 12px; flex-wrap: wrap; }
.t-print { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--yellow); color: var(--ink); font: 700 14px Vazirmatn, sans-serif; cursor: pointer; box-shadow: 0 1px 2px rgb(28 25 23 / .1), inset 0 -2px 0 rgb(12 10 9 / .1); }
.t-print:hover { background: #FDE047; }

/* ───── برگ ───── */
.sheet { width: 210mm; min-height: 297mm; margin: 18px auto 40px; padding: 11mm 11mm 9mm; background: #fff; box-shadow: 0 30px 70px -20px rgb(28 25 23 / .35); display: flex; flex-direction: column; }
@media (max-width: 820px) { .sheet { width: auto; min-height: 0; margin: 12px; padding: 18px 14px; } }

.sh-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8mm; align-items: center; padding-bottom: 5mm; border-bottom: 2.4px solid var(--ink); position: relative; }
.sh-head::after { content: ""; position: absolute; inset-inline-start: 0; bottom: -2.4px; width: 38mm; height: 2.4px; background: var(--yellow); }
.sh-brand { display: flex; align-items: center; gap: 5mm; min-width: 0; }
.sh-brand img { height: 19mm; width: auto; }
.sh-kicker { margin: 0; font-size: 11px; font-weight: 700; color: var(--yellow-deep); }
.sh-brand h1 { margin: 0; font-size: 24px; line-height: 1.35; font-weight: 900; color: var(--ink); }
.sh-tag { margin: 0; color: var(--muted); font-size: 11.5px; }
.sh-meta { margin: 0; display: grid; gap: 2px; padding-inline-start: 6mm; border-inline-start: 1px solid var(--line-2); }
.sh-meta div { display: grid; }
.sh-meta dt { color: var(--muted); font-size: 10px; }
.sh-meta dd { margin: 0; font-weight: 700; font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.sh-qr { margin: 0; display: grid; justify-items: center; gap: 2px; width: 25mm; }
.sh-qr svg { width: 22mm; height: 22mm; }
.sh-qr figcaption { text-align: center; font-size: 9.5px; line-height: 1.5; color: var(--fg-2); font-weight: 600; }
.sh-qr figcaption .ltr { font-weight: 500; color: var(--muted); font-size: 8.5px; }

/* گروه‌ها در دو ستون؛ هیچ گروهی بینِ دو ستون یا دو برگ نمی‌شکند */
.sh-body { flex: 1; column-count: 2; column-gap: 7mm; column-rule: 1px solid var(--line); padding-top: 5mm; }
.sh-cat { break-inside: avoid; margin: 0 0 4.5mm; }
.sh-cat[hidden] { display: none; }
.sh-cat h2 { display: flex; align-items: center; gap: 7px; margin: 0 0 1.5mm; padding: 1.6mm 2.5mm; border-radius: 6px; background: var(--wash); border-inline-start: 3px solid var(--yellow); font-size: 13.5px; font-weight: 800; color: var(--ink); }
.sh-cat h2 .ic { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); }
.sh-cat h2 .ic svg { width: 15px; height: 15px; }
.sh-cat h2 small { margin-inline-start: auto; font-weight: 500; color: var(--muted); font-size: 10.5px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
thead th { font-size: 9.5px; font-weight: 600; color: var(--muted); text-align: start; padding: .6mm 2mm; border-bottom: 1px solid var(--line-2); }
tbody th, tbody td { padding: 1.15mm 2mm; border-bottom: 1px solid var(--line); vertical-align: baseline; }
tbody tr:nth-child(even) { background: var(--wash-2); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { text-align: start; font-weight: 600; color: var(--fg); }
tbody th .spec { margin-inline-start: 5px; font: 700 9.5px Vazirmatn, sans-serif; color: var(--muted); }
tbody th .unit { margin-inline-start: 4px; color: var(--muted); font-weight: 400; font-size: 10px; }
.c-price { text-align: end; white-space: nowrap; }
td.c-price { font-weight: 800; font-size: 13px; color: var(--ink); }
.c-chg { text-align: end; white-space: nowrap; width: 21mm; }
td.c-chg { font-size: 10px; font-weight: 700; }
td.c-chg .up { color: var(--rise); }
td.c-chg .down { color: var(--fall); }
td.c-chg .flat { color: var(--line-2); }
tr.off td.c-price { font-weight: 600; font-size: 11px; color: var(--muted); }
tr.off th { color: var(--muted); }
.no-change .c-chg { display: none; }

.sh-foot { margin-top: 4mm; padding-top: 3mm; border-top: 1px solid var(--line-2); break-inside: avoid; }
.sh-note { margin: 0 0 2.5mm; color: var(--fg-2); font-size: 10.5px; }
.sh-contact { display: grid; grid-template-columns: 1.4fr 1.4fr 1fr .9fr; gap: 4mm; padding: 2.5mm 3mm; border-radius: 8px; background: var(--ink); color: #D6D3D1; font-size: 10.5px; }
.sh-contact div { display: grid; gap: 1px; min-width: 0; }
.sh-contact b { color: var(--yellow); font-size: 10px; }
.sh-contact span span { margin-inline-end: 8px; }
@media (max-width: 820px) {
  .sh-head { grid-template-columns: 1fr auto; }
  .sh-meta { grid-column: 1 / -1; grid-row: 2; border: 0; padding: 0; grid-template-columns: repeat(3, auto); justify-content: start; gap: 4px 16px; }
  .sh-body { column-count: 1; }
  .sh-contact { grid-template-columns: 1fr 1fr; }
}

/* فشرده: همه در یک برگ (ردیف‌ها کوتاه‌تر، سه ستون) */
.compact .sh-body { column-count: 3; column-gap: 5mm; }
.compact tbody th, .compact tbody td { padding: .6mm 1.4mm; }
.compact td.c-price { font-size: 11.5px; }
.compact .sh-cat { margin-bottom: 3mm; }
.compact .sh-cat h2 { font-size: 12px; padding: 1mm 2mm; }
.compact .c-chg { width: 16mm; }

@page { size: A4 portrait; margin: 10mm 10mm 9mm; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .sheet { margin: 0; padding: 0; box-shadow: none; width: auto; min-height: 0; }
  .sh-body { column-count: 2; }
  .compact .sh-body { column-count: 3; }
  .sh-head { grid-template-columns: minmax(0, 1fr) auto auto; }
  .sh-meta { grid-column: auto; grid-row: auto; display: grid; grid-template-columns: none; border-inline-start: 1px solid var(--line-2); padding-inline-start: 6mm; }
  .sh-contact { grid-template-columns: 1.4fr 1.4fr 1fr .9fr; }
  a { color: inherit; text-decoration: none; }
}
.sh-cat h2 .ic .picon { width: 18px; height: 18px; }
