/* ظاهر مشترک همهٔ صفحه‌ها (راهنما: بخش «راهنمای ظاهر» در CLAUDE.md)
   قاعده: رنگ، فاصله، گردی، سایه و اندازهٔ متن فقط از متغیرهای :root. رنگ مستقیم در صفحه‌ها ممنوع. */

/* ---------- فونت (روی سرور خودمان؛ نسخهٔ «رقم فارسی» وزیرمتن، تا همهٔ عددها فارسی نمایش داده شوند) ---------- */
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/Vazirmatn-FD-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/Vazirmatn-FD-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/fonts/Vazirmatn-FD-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

/* ---------- متغیرها ---------- */
:root {
  /* پالت برند */
  --bronze: #8C5A2B;        /* دکمهٔ اصلی و سربرگ */
  --bronze-dark: #6E4520;   /* حالت فشرده/هاور برنزی */
  --bronze-soft: #F1E4D3;   /* زمینهٔ کم‌رنگ برنزی (گزینهٔ انتخاب‌شده، منوی فعال) */
  --gold: #C9A227;          /* فقط تأکید و جزئیات (نشانگر منو، حاشیهٔ تمرکز، خط کنار عنوان) */
  --gold-soft: #F7EDCB;     /* زمینهٔ کم‌رنگ طلایی (آیکون کارت‌ها) */
  --cream: #F6EFE2;         /* زمینهٔ صفحه */
  --ink: #1C1A17;           /* متن */

  /* سطح‌ها و خط‌ها */
  --bg: var(--cream);
  /* بافت کتانی ملایم زمینهٔ صفحه‌های کارمندی: کاشی ۲۴ پیکسلی SVG بدون درز، نخ‌های افقی برنزی و عمودی طلایی با شفافیت ۲ تا ۶ درصد */
  --bg-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cg fill='rgb(140,90,43)'%3E%3Crect y='0' width='24' height='1' opacity='.05'/%3E%3Crect y='3' width='24' height='1' opacity='.03'/%3E%3Crect y='5' width='24' height='1' opacity='.045'/%3E%3Crect y='8' width='24' height='1' opacity='.025'/%3E%3Crect y='11' width='24' height='1' opacity='.05'/%3E%3Crect y='14' width='24' height='1' opacity='.03'/%3E%3Crect y='16' width='24' height='1' opacity='.04'/%3E%3Crect y='19' width='24' height='1' opacity='.025'/%3E%3Crect y='22' width='24' height='1' opacity='.045'/%3E%3C/g%3E%3Cg fill='rgb(201,162,39)'%3E%3Crect x='1' width='1' height='24' opacity='.06'/%3E%3Crect x='4' width='1' height='24' opacity='.035'/%3E%3Crect x='7' width='1' height='24' opacity='.05'/%3E%3Crect x='10' width='1' height='24' opacity='.03'/%3E%3Crect x='13' width='1' height='24' opacity='.055'/%3E%3Crect x='16' width='1' height='24' opacity='.035'/%3E%3Crect x='19' width='1' height='24' opacity='.05'/%3E%3Crect x='22' width='1' height='24' opacity='.03'/%3E%3C/g%3E%3Cg fill='rgb(110,69,32)' opacity='.05'%3E%3Crect x='3' y='6' width='3' height='1'/%3E%3Crect x='15' y='17' width='4' height='1'/%3E%3Crect x='20' y='2' width='1' height='3'/%3E%3Crect x='9' y='12' width='1' height='4'/%3E%3C/g%3E%3C/svg%3E");
  /* همان بافت روی برنزی، کمی پررنگ‌تر (صفحهٔ ورود): نخ‌های افقی تیره و عمودی طلایی (۵ تا ۱۳ درصد) و رگه‌های کرم؛
     هر نقطهٔ زمینه با متن سفید کنتراست AA (بالای ۴٫۵) دارد */
  --bg-texture-bronze: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cg fill='rgb(28,26,23)'%3E%3Crect y='0' width='24' height='1' opacity='.12'/%3E%3Crect y='3' width='24' height='1' opacity='.07'/%3E%3Crect y='5' width='24' height='1' opacity='.1'/%3E%3Crect y='8' width='24' height='1' opacity='.06'/%3E%3Crect y='11' width='24' height='1' opacity='.13'/%3E%3Crect y='14' width='24' height='1' opacity='.07'/%3E%3Crect y='16' width='24' height='1' opacity='.1'/%3E%3Crect y='19' width='24' height='1' opacity='.06'/%3E%3Crect y='22' width='24' height='1' opacity='.11'/%3E%3C/g%3E%3Cg fill='rgb(201,162,39)'%3E%3Crect x='1' width='1' height='24' opacity='.1'/%3E%3Crect x='4' width='1' height='24' opacity='.06'/%3E%3Crect x='7' width='1' height='24' opacity='.09'/%3E%3Crect x='10' width='1' height='24' opacity='.05'/%3E%3Crect x='13' width='1' height='24' opacity='.1'/%3E%3Crect x='16' width='1' height='24' opacity='.06'/%3E%3Crect x='19' width='1' height='24' opacity='.09'/%3E%3Crect x='22' width='1' height='24' opacity='.05'/%3E%3C/g%3E%3Cg fill='rgb(246,239,226)' opacity='.08'%3E%3Crect x='3' y='6' width='3' height='1'/%3E%3Crect x='15' y='17' width='4' height='1'/%3E%3Crect x='20' y='2' width='1' height='3'/%3E%3Crect x='9' y='12' width='1' height='4'/%3E%3C/g%3E%3C/svg%3E");
  --surface: #FFFDF9;       /* کارت و جعبه */
  --surface-2: #FAF5EC;     /* سربرگ جدول، ردیف هاور */
  --row-alt: #FDF9F2;       /* ردیف‌های یک‌درمیان جدول */
  --border: #E3D6C1;
  --border-strong: #CDBB9F;
  --text: var(--ink);
  --text-muted: #625A4F;    /* کنتراست ≈ ۶:۱ روی کرم */
  --on-bronze: #FFFFFF;

  /* منوی کناری تیره (دسکتاپ): زمینهٔ مشکی برند، متن روشن (کنتراست بالای ۷:۱) */
  --nav-bg: var(--ink);
  --nav-text: #F3ECDF;
  --nav-muted: #BDB2A0;     /* کنتراست ≈ ۸:۱ روی مشکی برند */
  --nav-hover: rgba(255, 255, 255, 0.07);
  --nav-active: rgba(201, 162, 39, 0.16);
  --nav-line: rgba(255, 255, 255, 0.10);

  /* رنگ‌های وضعیت (متن تیره روی زمینهٔ روشن، کنتراست بالای ۴.۵:۱) */
  --success: #1E6B3A;  --success-bg: #E2F1E6;  --success-border: #A9D4B5;
  --warning: #7A4A00;  --warning-bg: #FCEFC9;  --warning-border: #E9C874;
  --danger:  #A3221B;  --danger-bg:  #FBE4E1;  --danger-border:  #EDAAA3;
  --info:    #1D4D8A;  --info-bg:    #E2ECFA;  --info-border:    #A8C2E8;
  --neutral: #4B453D;  --neutral-bg: #EFE8DC;

  /* فاصله‌ها */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;  --sp-5: 24px;  --sp-6: 32px;
  /* گردی گوشه‌ها */
  --r-sm: 8px;  --r-md: 12px;  --r-lg: 18px;  --r-full: 999px;
  /* سایه: دو سطح برای کارت‌ها (عادی، برجسته/هاور) + سطح ۳ برای پنجره‌های روی صفحه */
  --sh-1: 0 1px 2px rgba(28, 26, 23, 0.05), 0 2px 6px rgba(28, 26, 23, 0.05);
  --sh-2: 0 6px 18px rgba(28, 26, 23, 0.10), 0 2px 4px rgba(28, 26, 23, 0.05);
  --sh-3: 0 12px 32px rgba(28, 26, 23, 0.20);
  /* حرکت (با prefers-reduced-motion خاموش) */
  --dur: 180ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  /* اندازهٔ متن */
  --fs-xs: 12px;  --fs-sm: 14px;  --fs-md: 16px;  --fs-lg: 18px;  --fs-xl: 20px;  --fs-2xl: 24px;
  --fs-stat: 28px;          /* عدد بزرگ کارت آماری */

  /* چیدمان */
  --touch: 44px;            /* حداقل ناحیهٔ لمس */
  --thumb: 56px;            /* تصویر کوچک کالا در لیست */
  --card-img: 64px;         /* عکس کارت‌های دسته، برند و زیرگروه */
  --ad-photo: 88px;         /* تصویر کوچک عکس‌ها و فایل‌های بخش تبلیغات */
  --sidebar-w: 256px;
  --icon: 20px;             /* آیکون معمولی */
  --bottom-nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- پایه ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  margin: 0;
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.7;
  overflow-wrap: break-word;
}
a { color: var(--bronze); }
a:hover { color: var(--bronze-dark); }
h1 { font-size: var(--fs-xl); margin: 0 0 var(--sp-3); line-height: 1.4; }
h2 { font-size: var(--fs-lg); margin: 0 0 var(--sp-3); line-height: 1.4; }
h2::before { /* خط طلایی کوچک کنار عنوان بخش */
  content: ''; display: inline-block; width: 4px; height: 1em; background: var(--gold);
  border-radius: var(--r-full); margin-left: var(--sp-2); vertical-align: -2px;
}
p { margin: var(--sp-2) 0; }
.hidden { display: none !important; }
/* حاشیهٔ تمرکز طلایی (کیبورد)؛ حلقهٔ تیرهٔ داخلی تا روی زمینهٔ روشن هم دیده شود */
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; box-shadow: 0 0 0 2px var(--ink); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 1px; }

/* آیکون (Lucide، icon() در common.js یا <svg class="ico"><use href="/vendor/lucide/icons.svg#نام"/></svg>) */
.ico {
  width: var(--icon); height: var(--icon); flex: none; display: inline-block; vertical-align: -0.2em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
button .ico, a.button .ico { width: 18px; height: 18px; }
h2.with-icon { display: flex; align-items: center; gap: var(--sp-2); }
h2.with-icon::before { display: none; }
h2.with-icon .ico {
  width: 32px; height: 32px; padding: 6px; border-radius: var(--r-sm);
  background: var(--gold-soft); color: var(--bronze-dark);
}
.box.alert h2.with-icon .ico { background: var(--surface); color: var(--danger); }

/* حرکت‌ها: کوتاه (۱۵۰ تا ۲۰۰ میلی‌ثانیه) */
a, button, .item, .row, .stat, .chip, label.pick-row, input, select, textarea {
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- سربرگ (برنزی) ---------- */
.app-header {
  background: var(--bronze);
  color: var(--on-bronze);
  padding: var(--sp-2) var(--sp-4);
  padding-top: calc(var(--sp-2) + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 56px;
  position: sticky; top: 0; z-index: 20;
  box-shadow: var(--sh-1);
}
.app-header .mark { width: 36px; height: 36px; border-radius: var(--r-sm); flex: none; }
.app-header .page-title { font-size: var(--fs-lg); font-weight: 700; margin: 0; flex: 1; min-width: 0; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header .who { font-size: var(--fs-sm); opacity: 0.95; }
.app-header .header-nav { display: none; }
.app-header .app-name { display: none; font-size: var(--fs-sm); opacity: 0.9; white-space: nowrap; }
.app-header button.secondary, .app-header a.button.secondary {
  background: var(--bronze-dark); color: var(--on-bronze); border-color: rgba(255, 255, 255, 0.45);
}
.app-header button.secondary:hover, .app-header a.button.secondary:hover { background: var(--ink); border-color: var(--gold); }

/* زنگولهٔ پیام‌ها در سربرگ (کامپیوتر و گوشی) با تعداد نخوانده */
.app-header .bell {
  position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: var(--touch); height: var(--touch); border-radius: var(--r-full); color: var(--on-bronze);
}
.app-header .bell:hover { background: var(--bronze-dark); color: var(--on-bronze); }
.app-header .bell .ico { width: var(--icon); height: var(--icon); }
.app-header .bell .bell-count {
  position: absolute; top: 2px; left: 0; min-width: 20px; height: 20px; padding: 0 var(--sp-1);
  border-radius: var(--r-full); background: var(--danger); color: var(--on-bronze); border: 2px solid var(--bronze);
  font-size: var(--fs-xs); font-weight: 700; line-height: 16px; text-align: center;
}

/* صندوق پیام (public/js/messages.js) */
.item.message.unread { border-inline-start: 4px solid var(--gold); background: var(--gold-soft); }
.item.message .message-body { white-space: pre-line; margin-top: var(--sp-2); }
.item.message .message-head { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.item.message .message-head .title { flex: 1; min-width: 0; }

/* ---------- منوی کناری (دسکتاپ) ---------- */
.sidebar { display: none; }

/* ---------- منوی پایین (موبایل) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 30;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(28, 26, 23, 0.08);
  padding-bottom: var(--safe-bottom);
}
.bottom-nav a, .bottom-nav button {
  flex: 1 1 0; min-width: 0; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--bottom-nav-h);
  padding: var(--sp-1) 2px;
  color: var(--text-muted); text-decoration: none;
  font-size: var(--fs-xs); line-height: 1.3; font-weight: 500;
  background: none; border: none; border-radius: 0; box-shadow: none;
  text-align: center;
}
.bottom-nav .ico { width: 24px; height: 24px; padding: 2px 0; box-sizing: content-box; border-radius: var(--r-full); }
.bottom-nav a:hover, .bottom-nav button:hover { background: var(--surface-2); color: var(--bronze-dark); }
.bottom-nav a:active, .bottom-nav button:active { background: var(--bronze-soft); }
/* گزینهٔ فعال: آیکون در قرص برنزی کم‌رنگ + خط برنزی بالای گزینه */
.bottom-nav .current { color: var(--bronze-dark); font-weight: 700; }
.bottom-nav .current .ico { background: var(--bronze-soft); padding: 2px 16px; }
.bottom-nav .current::before {
  content: ''; position: absolute; top: 0; right: 25%; left: 25%; height: 3px;
  border-radius: 0 0 var(--r-full) var(--r-full); background: var(--bronze);
}
.bottom-nav span.label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-right: var(--sp-1);
  border-radius: var(--r-full); background: var(--danger); color: var(--on-bronze);
  font-size: var(--fs-xs); line-height: 20px; text-align: center;
}

/* برگهٔ «بیشتر» */
.more-sheet { position: fixed; inset: 0; z-index: 40; display: none; }
.more-sheet.open { display: block; }
.more-sheet .backdrop { position: absolute; inset: 0; background: rgba(28, 26, 23, 0.45); }
.more-sheet .panel {
  position: absolute; right: 0; left: 0; bottom: 0;
  max-height: 80vh; overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-4) + var(--safe-bottom));
  box-shadow: var(--sh-3);
}
.more-sheet .who { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
.more-sheet .links { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.more-sheet .links a {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: 52px; padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text); text-decoration: none; background: var(--surface-2);
  font-size: var(--fs-sm); line-height: 1.4;
}
.more-sheet .links a:hover { border-color: var(--bronze); }
.more-sheet .links a.current { border-color: var(--bronze); background: var(--bronze-soft); font-weight: 700; box-shadow: inset -3px 0 0 var(--gold); }
.more-sheet .links .ico { width: 20px; height: 20px; flex: none; color: var(--bronze); }
.more-sheet .more-group { margin-top: var(--sp-4); }
.more-sheet .more-group-title {
  display: flex; align-items: center; gap: var(--sp-2);
  margin: 0 0 var(--sp-2); padding-right: var(--sp-2);
  border-right: 3px solid var(--gold);
  color: var(--bronze-dark); font-size: var(--fs-sm); font-weight: 700;
}
.more-sheet .more-group-title .ico { width: 18px; height: 18px; flex: none; color: var(--bronze); }
.more-sheet .more-foot { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.more-sheet .sheet-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.more-sheet .sheet-actions button { flex: 1; }

/* ---------- محتوای صفحه ---------- */
main {
  max-width: 1100px; margin: 0 auto; padding: var(--sp-4);
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 96px); /* جا برای منوی پایین و دکمهٔ شناور */
}
body.no-nav main { padding-bottom: var(--sp-6); }
body.has-sidebar, body.portal { background-image: var(--bg-texture); } /* صفحه‌های کارمندی و درگاه؛ کارت‌ها روی زمینهٔ ساده (--surface) */
.box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  box-shadow: var(--sh-1);
  min-width: 0;
}
.box > h2:first-child, .box > .box-head:first-child { margin-bottom: var(--sp-3); }
/* سرتیتر جعبه با دکمه/لینک کناری */
.box-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.box-head h2 { margin: 0; }
.box.alert { border: 2px solid var(--danger-border); background: var(--danger-bg); }
/* بخش جمع‌شدنی («امروز»): سرتیتر = دکمهٔ باز و بسته (.section-toggle) + تعداد موارد (.section-count) + فلش */
.box.section > h2:first-child { margin-bottom: var(--sp-3); }
.box.section.collapsed > h2:first-child { margin-bottom: 0; }
.box.section.collapsed .section-body { display: none; }
button.section-toggle {
  width: 100%; justify-content: flex-start; gap: var(--sp-2); padding: 0;
  background: none; border: 0; box-shadow: none; color: inherit; font: inherit; text-align: start;
}
button.section-toggle:hover, button.section-toggle:active:not(:disabled) { background: none; color: var(--bronze-dark); transform: none; }
button.section-toggle > .ico:last-child { margin-inline-start: auto; width: 20px; height: 20px; padding: 0; background: none; color: var(--text-muted);
  transition: transform var(--dur) var(--ease); }
.box.section:not(.collapsed) button.section-toggle > .ico:last-child { transform: rotate(180deg); }
.section-count {
  flex: none; min-width: 28px; padding: 0 var(--sp-2); border-radius: var(--r-full);
  background: var(--gold-soft); color: var(--bronze-dark); font-size: var(--fs-sm); font-weight: 700; text-align: center;
}
.section-count.hot { background: var(--danger); color: var(--on-bronze); }
.section-more { margin-top: var(--sp-3); }
fieldset.plain { border: none; padding: 0; margin: 0; min-width: 0; }

/* ---------- فرم ---------- */
label { display: block; margin: var(--sp-3) 0 var(--sp-1); font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
input, select, button, textarea { font-family: inherit; font-size: var(--fs-md); }
input, select, textarea {
  width: 100%;
  min-height: var(--touch);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: max(16px, var(--fs-md)); /* حداقل ۱۶ پیکسل تا آیفون زوم نکند */
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--bronze); box-shadow: 0 0 0 3px var(--bronze-soft); }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: var(--bronze); }
/* فیلد نامعتبر و پیام خطای زیر همان فیلد (common.js) */
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-bg) !important; }
.field-error {
  display: flex; align-items: flex-start; gap: var(--sp-1); margin-top: var(--sp-1);
  color: var(--danger); font-size: var(--fs-sm); font-weight: 500; line-height: 1.5;
}
.field-error::before { content: '!'; flex: none; width: 18px; height: 18px; border-radius: var(--r-full); background: var(--danger);
  color: var(--on-bronze); font-size: var(--fs-xs); font-weight: 700; line-height: 18px; text-align: center; margin-top: 1px; }
/* بخش‌بندی فرم: هر بخش با عنوان کوچک و خط جداکننده */
.form-section { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.form-section:first-child, .box > h2 + .form-section { margin-top: 0; padding-top: 0; border-top: none; }
.form-section-title {
  display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-1);
  font-size: var(--fs-md); font-weight: 700; color: var(--bronze-dark);
}
.form-section-title .ico { color: var(--bronze); }
.form-hint { margin: 0 0 var(--sp-2); color: var(--text-muted); font-size: var(--fs-sm); }
input:disabled, select:disabled, textarea:disabled, fieldset:disabled input, fieldset:disabled select {
  background: var(--surface-2); color: var(--text-muted);
}
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--bronze); flex: none; }
input[type="file"] { padding: var(--sp-2); background: var(--surface-2); }
input[dir="ltr"] { text-align: left; }
textarea { min-height: 80px; line-height: 1.6; }
.checkbox { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); min-height: var(--touch); }
.checkbox input { width: 22px; }

/* ---------- دکمه ---------- */
button, a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--touch);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--bronze);
  border-radius: var(--r-md);
  background: var(--bronze);
  color: var(--on-bronze);
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--sh-1);
  -webkit-tap-highlight-color: transparent;
}
button:hover, a.button:hover { background: var(--bronze-dark); border-color: var(--bronze-dark); color: var(--on-bronze); }
/* فشرده شدن: کمی پایین‌تر و تیره‌تر */
button:active:not(:disabled), a.button:active { transform: translateY(1px) scale(0.98); box-shadow: none; }
/* ثانویه: حاشیه‌دار */
button.secondary, a.button.secondary {
  background: var(--surface); color: var(--bronze-dark); border-color: var(--bronze); box-shadow: none;
}
button.secondary:hover, a.button.secondary:hover { background: var(--bronze-soft); color: var(--bronze-dark); border-color: var(--bronze-dark); }
button.secondary:active:not(:disabled), a.button.secondary:active { background: var(--bronze-soft); }
/* دکمهٔ آیکونی: مربع ۴۴ پیکسلی، فقط آیکون (aria-label اجباری) */
button.icon-btn, a.button.icon-btn { width: var(--touch); min-width: var(--touch); padding: 0; }
button.icon-btn .ico, a.button.icon-btn .ico { width: var(--icon); height: var(--icon); }
/* دکمهٔ خطر (لغو، رد) */
button.danger, a.button.danger { background: var(--danger); border-color: var(--danger); color: var(--on-bronze); }
button.danger:hover, a.button.danger:hover { background: var(--ink); border-color: var(--ink); }
button.small, a.button.small { min-height: var(--touch); min-width: var(--touch); padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }
button.full { width: 100%; margin-top: var(--sp-4); }
a.button.big, button.big { font-size: var(--fs-lg); padding: var(--sp-3) var(--sp-5); min-height: 52px; font-weight: 700; }
/* غیرفعال: کم‌رنگ، بدون سایه و بدون واکنش به هاور */
button:disabled, button:disabled:hover {
  opacity: 1; cursor: not-allowed; box-shadow: none; transform: none;
  background: var(--neutral-bg); border-color: var(--border-strong); color: var(--text-muted);
}
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }

/* ---------- دکمهٔ شناور «+» (فقط موبایل؛ روی دسکتاپ یک دکمهٔ معمولی است) ---------- */
@media (max-width: 899.98px) {
  .fab {
    position: fixed; z-index: 25;
    left: var(--sp-4);
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + var(--sp-4));
    min-height: 56px; min-width: 56px;
    padding: var(--sp-2) var(--sp-5);
    border-radius: var(--r-full) !important;
    box-shadow: var(--sh-3) !important;
    font-size: var(--fs-md) !important; font-weight: 700;
    max-width: calc(100vw - 2 * var(--sp-4));
  }
  .fab.fab-hidden-mobile { display: none; }
}

/* ---------- پیام‌ها ---------- */
.error { color: var(--danger); margin-top: var(--sp-3); font-weight: 500; }
.success { color: var(--success); margin-top: var(--sp-3); font-weight: 500; }
.error:empty, .success:empty { margin: 0; }
.muted { color: var(--text-muted); font-size: var(--fs-sm); }

/* حالت خالی لیست (emptyState در common.js): تصویر کوچک برند + متن + دکمهٔ کار بعدی */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  text-align: center;
  color: var(--text-muted);
  padding: var(--sp-5) var(--sp-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  margin: var(--sp-2) 0;
  font-size: var(--fs-sm);
}
.empty .empty-text { margin: 0; max-width: 36ch; }
.empty-art { width: 96px; height: 64px; }
.empty-art .hex { fill: var(--gold-soft); stroke: var(--gold); stroke-width: 1.5; }
.empty-art .tray { fill: var(--surface); stroke: var(--bronze); stroke-width: 2; stroke-linejoin: round; }
.empty-art .tray-line { fill: none; stroke: var(--bronze); stroke-width: 2; stroke-linejoin: round; }

/* اسکلت بارگذاری: خط‌های خاکستری با درخشش ملایم تا رسیدن داده.
   ظرفی با کلاس skeleton-zone تا خالی است اسکلت نشان می‌دهد؛ اگر بعد از ۱۲ ثانیه هم چیزی نیامد (خطا)، اسکلت جمع می‌شود. */
@keyframes sk-shine { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes sk-hide { to { opacity: 0; height: 0; min-height: 0; margin: 0; } }
.skeleton { display: flex; flex-direction: column; gap: var(--sp-2); }
.skeleton-card { padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.sk-line, .skeleton-zone:empty::before {
  background: linear-gradient(90deg, var(--neutral-bg) 0%, var(--surface-2) 50%, var(--neutral-bg) 100%);
  background-size: 200% 100%; animation: sk-shine 1.2s linear infinite;
}
.sk-line { height: 12px; border-radius: var(--r-full); margin: var(--sp-2) 0; }
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w90 { width: 90%; }
.skeleton-zone:empty::before {
  content: ''; display: block; height: 132px; border-radius: var(--r-md);
  /* سه کارت خاکستری: لایهٔ ماسک خط‌های سفید بین کارت‌ها را می‌سازد */
  -webkit-mask: linear-gradient(#000 0 36px, transparent 36px 48px, #000 48px 84px, transparent 84px 96px, #000 96px 132px);
  mask: linear-gradient(#000 0 36px, transparent 36px 48px, #000 48px 84px, transparent 84px 96px, #000 96px 132px);
  animation: sk-shine 1.2s linear infinite, sk-hide 0.2s 12s forwards;
}

/* ---------- برچسب وضعیت ---------- */
/* نقطهٔ رنگی + متن؛ رنگ‌ها از متغیرهای وضعیت (همهٔ صفحه‌ها یکسان) */
.badge {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
  font-size: var(--fs-xs); font-weight: 500; line-height: 1.6;
  padding: 1px var(--sp-2) 1px 10px; margin-right: var(--sp-2);
  border-radius: var(--r-full);
  background: var(--neutral-bg); color: var(--neutral);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: var(--r-full); background: currentColor; }
.badge.ok { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge.warn, .badge.lock { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge.off { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }

/* ---------- کارت (لیست‌های موبایل و بخش‌های داشبورد) ---------- */
.item {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  background: var(--surface);
  min-width: 0;
}
.item .title { font-weight: 700; line-height: 1.6; }
.item .title a { color: inherit; }
.item .actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); align-items: center; }
.item .actions select, .item .actions input { width: auto; min-width: 0; flex: 1 1 140px; }
a.item { color: inherit; text-decoration: none; }
a.item:hover { border-color: var(--bronze); box-shadow: var(--sh-2); }
a.item:active { transform: scale(0.995); }
.item.overdue, .item.late { border-color: var(--danger-border); background: var(--danger-bg); }
.item.overdue .muted, .item.late .muted { color: var(--text); }
/* سفارشی که تاریخ ارسالش امروز یا گذشته است (صف‌ها): برجسته، نه قرمز */
.item.due { border-color: var(--warning-border); background: var(--warning-bg); }
/* «برگشت» (sendBackBox، backNotice در common.js): کادر برجستهٔ سفارش/درخواست برگشتی و فرم برگشت */
.box.back-notice { border: 2px solid var(--warning-border); background: var(--warning-bg); }
.back-notice .back-text { white-space: pre-line; margin-top: var(--sp-2); }
.back-notice .muted { color: var(--text); }
.send-back { margin-top: var(--sp-3); }
.send-back-form { margin-top: var(--sp-3); display: grid; gap: var(--sp-2); }
.send-back-form textarea { width: 100%; }
.item.due .muted { color: var(--text); }

/* خط زمانی سفارش (درگاه مشتری): مرحلهٔ انجام‌شده با نقطهٔ برنزی، انجام‌نشده کم‌رنگ */
.timeline { list-style: none; margin: var(--sp-3) 0 0; padding: 0; }
.timeline li { position: relative; padding: 0 var(--sp-5) var(--sp-3) 0; border-right: 2px solid var(--border-strong); margin-right: var(--sp-2); }
.timeline li:last-child { border-right-color: transparent; }
.timeline li::before {
  content: ''; position: absolute; right: -7px; top: 4px; width: 12px; height: 12px;
  border-radius: var(--r-full); background: var(--bronze); border: 2px solid var(--surface);
}
.timeline li.pending { opacity: 0.45; }
.timeline li.pending::before { background: var(--border-strong); }

/* ---------- لیست واکنش‌گرا (rowList در common.js): موبایل = کارت، دسکتاپ = جدول ---------- */
.rows-head { display: none; }
.row {
  display: block; position: relative;
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--sp-3); margin-bottom: var(--sp-2);
  background: var(--surface); color: inherit; text-decoration: none;
}
a.row:hover { border-color: var(--bronze); color: inherit; box-shadow: var(--sh-2); }
.row .cell { display: flex; gap: var(--sp-2); font-size: var(--fs-sm); line-height: 1.6; min-width: 0; }
.row .cell::before { content: attr(data-label); color: var(--text-muted); flex: none; min-width: 84px; }
.row .cell.main { font-size: var(--fs-md); font-weight: 700; margin-bottom: var(--sp-1); display: block; }
.row .cell.main::before, .row .cell.no-label::before { display: none; }
.row .cell.blank { display: none; }
.row .cell.actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.row .cell.actions::before { display: none; }
.row .cell.actions input { width: auto; flex: 1 1 140px; min-width: 0; }
.row.late { border-color: var(--danger-border); background: var(--danger-bg); }

/* ---------- جدول ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.lines { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.lines th {
  background: var(--surface-2); color: var(--text-muted); font-weight: 700;
  border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
table.lines th, table.lines td { border-bottom: 1px solid var(--border); padding: var(--sp-2) var(--sp-3); text-align: right; vertical-align: top; }
table.lines tr:nth-child(even) td { background: var(--row-alt); }
table.lines tr:hover td { background: var(--bronze-soft); }
table.lines tr.total td { font-weight: 700; border-top: 2px solid var(--bronze); }
table.lines td input, table.lines td select { min-width: 90px; }
table.lines td button, table.lines td a.button { white-space: nowrap; }
/* جدول فقط‌خواندنی اکسل صورتحساب (درگاه): قاب جدا با اسکرول افقی و عمودی، هر خانه در یک خط */
.sheet-frame { border: 1px solid var(--border); border-radius: var(--r-md); max-height: 60vh; overflow: auto; margin-top: var(--sp-2); }
.sheet-frame table.lines th, .sheet-frame table.lines td { white-space: nowrap; }
td.behind { color: var(--danger); font-weight: 700; }

/* ---------- اجزای دیگر ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-3); }
.grid2 > * { min-width: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); }
ul.errors { padding-right: var(--sp-5); margin: var(--sp-2) 0; max-height: 300px; overflow-y: auto; }
ul.errors li.warning { color: var(--warning); }
ul.plain { list-style: none; padding: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mb-3 { margin-bottom: var(--sp-3); }
.strong { font-weight: 700; }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.big-number { font-size: var(--fs-xl); font-weight: 700; margin: var(--sp-3) 0; }

/* دکمه‌های انتخابی بزرگ (نوع فعالیت، تاریخ پیگیری) */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.choices.three { grid-template-columns: repeat(3, 1fr); } /* روش پرداخت: نقد، چک، اعتباری */
.choices button {
  background: var(--surface); color: var(--text);
  border: 2px solid var(--border-strong);
  padding: var(--sp-3) var(--sp-2);
  min-height: 52px; box-shadow: none;
}
.choices button:hover { background: var(--surface-2); color: var(--text); border-color: var(--bronze); }
.choices button.selected { border-color: var(--bronze); background: var(--bronze-soft); color: var(--bronze-dark); font-weight: 700; }
.gps { margin-top: var(--sp-2); font-size: var(--fs-sm); }

/* قیف فروش */
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.lost-form { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px dashed var(--border-strong); }

/* دکمه‌های «اطلاع به …» (اطلاع‌رسانی دستی سفارش با پیام‌رسان، notifyBox در common.js) */
.notify { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); }
.notify-group {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2); border: 1px solid var(--info-border); border-radius: var(--r-sm); background: var(--info-bg);
}
.notify-group .notify-select { width: auto; flex: 1 1 160px; min-width: 0; }
.notify-group .notify-meta { flex: 1 1 100%; font-size: var(--fs-sm); }
.notify-group .success { margin-top: 0; flex: 1 1 100%; }
.notify-panel { border-color: var(--info-border); }
/* سه گزینهٔ پیام‌رسان (واتساپ، تلگرام، روبیکا)؛ ترجیحی گیرنده اول و برجسته */
.notify-options { flex: 1 1 100%; display: flex; flex-direction: column; gap: var(--sp-2); }
.notify-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.notify-row .notify-option { min-width: 110px; }
.notify-row .notify-option.preferred { box-shadow: 0 0 0 2px var(--gold); font-weight: 700; }
.notify-row .success { margin-top: 0; }
/* راهنمای ماندگار کامپیوتر: «متن پیام کپی شد …» با «کپی دوباره» و «کپی شماره» */
.notify-help {
  flex: 1 1 100%; display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-3); border: 1px solid var(--success-border); border-radius: var(--r-sm); background: var(--surface);
  font-size: var(--fs-sm);
}
.notify-help .success, .notify-help .error { margin-top: 0; }
.notify-help .actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.notify-help .notify-text { width: 100%; min-height: 120px; }

/* سفارش */
.total-bar {
  position: sticky; bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
  background: var(--surface);
  border-top: 2px solid var(--bronze);
  padding: var(--sp-3) var(--sp-4);
  margin: 0 calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4));
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--sp-2);
  z-index: 5;
}
.qty-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-2); }
.qty-row input { width: 110px; flex: none; }
.qty-row select { width: auto; }
/* درصد تخفیف ویژه (پیش‌فاکتور مدیر منطقه، تأیید نهایی) */
input.pct, .qty-row input.pct { width: 96px; flex: none; }
.qty-row .pct-label { font-size: var(--fs-sm); color: var(--text-muted); }
.price { font-weight: 700; }
.no-price { color: var(--danger); font-size: var(--fs-sm); }
/* فرم سفارش دومرحله‌ای (public/js/order-picker.js) */
.step-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.step-title { font-size: var(--fs-md); font-weight: 700; color: var(--bronze-dark); margin: var(--sp-3) 0 0; }
.step-head .step-title { margin: 0; }
/* ردیف کالا با تیک بزرگ؛ کل ردیف قابل لمس است */
label.pick-row {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: calc(var(--touch) + var(--sp-3));
  margin: 0 0 var(--sp-2); padding: var(--sp-2) var(--sp-3);
  border: 2px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); font-size: var(--fs-md); font-weight: 400; cursor: pointer;
}
label.pick-row input[type="checkbox"] { width: 28px; height: 28px; }
label.pick-row .pick-text { flex: 1; min-width: 0; }
label.pick-row .muted, label.pick-row .no-price { font-size: var(--fs-sm); }
label.pick-row.picked { border-color: var(--bronze); background: var(--bronze-soft); }
label.pick-row.disabled { background: var(--surface-2); cursor: default; }
/* فیلتر سه‌سطحی دسته‌بندی کالا (public/js/category-filter.js): کارت‌های عکس‌دار قابل لمس (عکس + نام زیر آن)، با اسکرول افقی */
.chips {
  display: flex; flex-wrap: nowrap; gap: var(--sp-2); overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: var(--sp-1) 0; margin-top: var(--sp-2); scrollbar-width: thin;
}
.chips .chip {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
  width: calc(var(--card-img) + var(--sp-5)); min-height: var(--touch); padding: var(--sp-2) var(--sp-1);
  border-radius: var(--r-md); border: 2px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: var(--fs-sm); font-weight: 500;
}
.chips .chip .chip-img {
  width: var(--card-img); height: var(--card-img); border-radius: var(--r-sm); object-fit: cover; background: var(--surface-2);
}
.chips .chip .chip-name { line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.chips .chip.active { background: var(--bronze); border-color: var(--bronze); color: var(--on-bronze); font-weight: 700; }
/* جای عکس وقتی عکس نیست یا بار نشد: آیکون ساده (هرگز عکس شکسته) */
.no-image { display: inline-flex; align-items: center; justify-content: center; color: var(--bronze); background: var(--surface-2); }
.no-image .ico { width: 50%; height: 50%; }
/* تصویر کوچک کالا جلوی نام؛ زدن روی آن عکس بزرگ را باز می‌کند */
.thumb, .thumb-img, span.thumb {
  flex: none; width: var(--thumb); height: var(--thumb); border-radius: var(--r-sm);
}
button.thumb { min-height: 0; padding: 0; border: 1px solid var(--border); background: var(--surface-2); box-shadow: none; overflow: hidden; cursor: zoom-in; }
button.thumb:hover { background: var(--surface-2); border-color: var(--bronze); }
.thumb-img { display: block; object-fit: cover; }
.item.with-thumb { display: flex; gap: var(--sp-3); align-items: flex-start; }
.item.with-thumb > .item-body { flex: 1; min-width: 0; }
/* عکس بزرگ روی صفحه */
.zoom {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); padding: var(--sp-4); background: rgba(28, 26, 23, 0.85); color: var(--on-bronze);
}
.zoom .zoom-img { width: min(100%, 480px); height: auto; max-height: 75vh; border-radius: var(--r-md); background: var(--surface); object-fit: contain; }
.zoom span.zoom-img { width: 200px; height: 200px; }
.zoom .zoom-title { font-weight: 700; text-align: center; }
/* مدیریت عکس (categories.html، products.html) */
.image-manage { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.bulk-row { display: flex; align-items: center; gap: var(--sp-3); }
.bulk-row .item-body { flex: 1; min-width: 0; }
/* سرتیتر گروه‌ها در لیست کالا: دسته، برند، زیرگروه */
.group-head { margin: var(--sp-4) 0 var(--sp-2); line-height: 1.4; }
.group-head.l1 { font-size: var(--fs-lg); font-weight: 700; color: var(--bronze-dark); border-bottom: 2px solid var(--gold); padding-bottom: var(--sp-1); }
.group-head.l2 { font-size: var(--fs-md); font-weight: 700; margin-top: var(--sp-3); }
.group-head.l3 { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); margin-top: var(--sp-2); }
/* درخت دسته‌بندی (categories.html) */
.tree-children { margin-inline-start: var(--sp-4); padding-inline-start: var(--sp-3); border-inline-start: 2px solid var(--border); }

/* بخش تبلیغات: تصویرهای کوچک عکس محل، طرح و نصب (زدن روی تصویر = عکس بزرگ) و ردیف‌های ابعاد */
.ad-photos { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.ad-photo { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); width: var(--ad-photo); }
.ad-photo .thumb-img, .ad-photo .no-image, .ad-photo .ad-file {
  width: var(--ad-photo); height: var(--ad-photo); border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2);
}
.ad-photo button.ad-zoom { min-height: 0; padding: 0; border: none; background: none; box-shadow: none; cursor: zoom-in; }
.ad-photo .ad-file { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--bronze); text-decoration: none; }
.ad-photo .ad-name { font-size: var(--fs-xs); color: var(--text-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-photo button.small { min-height: var(--touch); padding: 0 var(--sp-2); font-size: var(--fs-xs); }
.ad-final { border: 2px solid var(--gold); }
/* «اقلام تبلیغ» در فرم درخواست تبلیغ: هر قلم یک کارت (موبایل‌اول)؛ عرض و ارتفاع همیشه کنار هم */
.ad-item-row .title { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.ad-item-row .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-2); }
.ad-item-row .pair > * { min-width: 0; }
.changes { margin: var(--sp-1) 0 0; padding-inline-start: var(--sp-4); font-size: var(--fs-sm); }

/* سطر سفارش بدون تعداد (بعد از زدن «ثبت») */
.item.missing { border: 2px solid var(--danger); background: var(--danger-bg); }
.item.missing .muted { color: var(--text); }

/* تارگت و گزارش */
.progress { position: relative; height: 12px; background: var(--neutral-bg); border-radius: var(--r-full); margin: var(--sp-2) 0; overflow: hidden; }
.progress .bar { position: absolute; top: 0; bottom: 0; right: 0; background: var(--success); border-radius: var(--r-full); }
.progress .bar.behind { background: var(--danger); }
.progress .mark { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--ink); }

.title { font-weight: 700; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }

/* درگاه مشتری روی موبایل: نام مشتری در سربرگ جا نمی‌شود */
@media (max-width: 899.98px) {
  body.portal .app-header .who { display: none; }
}

/* ---------- انتخاب‌گر تاریخ شمسی (public/js/jalali-date.js) ---------- */
/* دکمه‌ای که شبیه فیلد است؛ فیلد اصلی مخفی مقدار میلادی را نگه می‌دارد */
button.jdate-field {
  display: block; width: 100%; min-height: var(--touch);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: max(16px, var(--fs-md)); font-weight: 400; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
button.jdate-field:hover { background: var(--surface); color: var(--text); border-color: var(--bronze); }
button.jdate-field.empty-value { color: var(--text-muted); }
button.jdate-field:disabled { background: var(--surface-2); color: var(--text-muted); opacity: 1; }
.jdate-pop { position: fixed; inset: 0; z-index: 50; display: none; }
.jdate-pop.open { display: block; }
.jdate-pop .backdrop { position: absolute; inset: 0; background: rgba(28, 26, 23, 0.45); }
.jdate-pop .panel {
  position: absolute; right: 0; left: 0; bottom: 0;
  max-height: 90vh; overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-4) + var(--safe-bottom));
  box-shadow: var(--sh-3);
}
.jdate-head { display: flex; gap: var(--sp-2); align-items: center; }
.jdate-head select { flex: 1; min-width: 0; }
.jdate-head button { flex: none; }
.jdate-week, .jdate-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--sp-1); text-align: center; }
.jdate-week { margin-top: var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); }
.jdate-days { margin-top: var(--sp-1); }
.jdate-days button {
  min-height: var(--touch); padding: 0; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); font-weight: 400;
}
.jdate-days button:hover { background: var(--bronze-soft); color: var(--bronze-dark); border-color: var(--bronze); }
.jdate-days button.today { border-color: var(--gold); border-width: 2px; }
.jdate-days button.selected { background: var(--bronze); color: var(--on-bronze); border-color: var(--bronze); font-weight: 700; }
.jdate-days button:disabled { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.jdate-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.jdate-actions button { flex: 1; }

/* رمز اولیه و نام کاربری: چپ‌چین با فونت هم‌عرض تا حرف‌ها با هم اشتباه نشوند */
.code { font-family: ui-monospace, Menlo, Consolas, monospace; direction: ltr; unicode-bidi: isolate; letter-spacing: 1px; }
/* لینک عمومی کاتالوگ: روی موبایل بشکند، از صفحه بیرون نزند */
.catalog-link { word-break: break-all; letter-spacing: 0; }

/* ---------- شمارهٔ تماس پشتیبانی (showSupport در common.js) ---------- */
.support-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); color: var(--text-muted); }
.support-line .support-phone { display: inline-flex; align-items: center; min-height: var(--touch); font-weight: 700; color: var(--bronze-dark); direction: ltr; unicode-bidi: isolate; }
.support-line .ico { width: 18px; height: 18px; flex: none; }
/* روز و ساعت زندهٔ تهران بالای صفحه‌های اول (startClock در common.js) */
.clock-line { margin-bottom: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-inline-start: 3px solid var(--gold); background: var(--surface); border-radius: var(--r-sm); font-size: var(--fs-md); font-weight: 700; color: var(--ink); box-shadow: var(--sh-1); }
.report-time { margin: calc(-1 * var(--sp-2)) 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- صفحهٔ ورود (login.html) ----------
   کامپیوتر و گوشی یکسان: کل صفحه برنزی با بافت کتانی؛ وسط صفحه به ترتیب: لوگو و نام برنامه، کارت فرم، شمارهٔ پشتیبانی.
   .login-stack با margin: auto وسط می‌ماند ولی اگر جا کم شد (کیبورد باز) بالایش بریده نمی‌شود و صفحه اسکرول می‌خورد. */
body.login-page { min-height: 100vh; min-height: 100dvh; }
body.login-page main { width: 100%; max-width: none; padding: 0; margin: 0; }
body.login-screen { background: var(--bronze) var(--bg-texture-bronze); color: var(--on-bronze); }
body.login-screen main {
  display: flex; min-height: 100vh; min-height: 100dvh;
  padding: calc(var(--sp-5) + env(safe-area-inset-top, 0px)) var(--sp-4) calc(var(--sp-5) + var(--safe-bottom));
}
.login-stack { width: 100%; max-width: 420px; margin: auto; display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); text-align: center; }
.login-brand .login-logo { display: block; width: 240px; max-width: 80%; height: auto; padding: var(--sp-3) var(--sp-4);
  background: var(--cream); border-radius: var(--r-lg); box-shadow: var(--sh-2); }
.login-brand .login-title { margin: 0; font-size: var(--fs-xl); font-weight: 700; line-height: 1.5; color: var(--on-bronze); }
.login-brand .login-title::after { content: ''; display: block; width: 48px; height: 3px; margin: var(--sp-2) auto 0;
  border-radius: var(--r-full); background: var(--gold); }
.login-stack .login-card { width: 100%; margin: 0; padding: var(--sp-5); color: var(--text); box-shadow: var(--sh-3); }
.login-card h1 { font-size: var(--fs-xl); }
.login-card .login-hint { margin: 0 0 var(--sp-2); color: var(--text-muted); font-size: var(--fs-sm); }
.login-card input { scroll-margin-bottom: 96px; } /* فیلد هنگام باز شدن کیبورد با فاصله بالای آن می‌ماند */
.login-screen .support-line { justify-content: center; margin: 0; color: var(--on-bronze); }
.login-screen .support-line .support-phone { color: var(--on-bronze); }
@media (min-width: 900px) {
  .login-brand .login-logo { width: 280px; }
  .login-brand .login-title { font-size: var(--fs-2xl); }
}

/* ---------- کارت‌های آماری (statCard در common.js) ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.stat {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0; min-height: 84px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  color: var(--text); text-decoration: none;
}
a.stat:hover { border-color: var(--bronze); box-shadow: var(--sh-2); color: var(--text); }
a.stat:active { transform: scale(0.98); }
.stat .stat-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--r-md); background: var(--gold-soft); color: var(--bronze-dark);
}
.stat .stat-icon .ico { width: 22px; height: 22px; }
.stat .stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat .stat-value { font-size: var(--fs-stat); font-weight: 700; line-height: 1.3; overflow-wrap: normal; }
.stat .stat-value.small, .stat.money .stat-value { font-size: var(--fs-lg); }
.stat .stat-label { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.4; }
.stat .stat-note { font-size: var(--fs-xs); color: var(--text-muted); }
.stat.warn .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat.danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat.danger .stat-value { color: var(--danger); }
.stat.ok .stat-icon { background: var(--success-bg); color: var(--success); }
.stat.info .stat-icon { background: var(--info-bg); color: var(--info); }

/* ---------- داشبورد «امروز»: تارگت (حلقه) و نمودار فروش ۷ روز ---------- */
.dash-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--sp-4); }
.ring-wrap { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-track { fill: none; stroke: var(--neutral-bg); stroke-width: 12; }
.ring .ring-bar { fill: none; stroke: var(--success); stroke-width: 12; stroke-linecap: round; }
.ring .ring-bar.behind { stroke: var(--danger); }
.ring .ring-mark { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.ring .ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring .ring-text strong { font-size: var(--fs-xl); line-height: 1.2; }
.ring .ring-text span { font-size: var(--fs-xs); color: var(--text-muted); }
.ring-info { flex: 1 1 180px; min-width: 0; }
.ring-info .legend { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-sm); }
.legend .key { display: inline-block; width: 12px; height: 4px; border-radius: var(--r-full); margin-left: var(--sp-2); vertical-align: middle; background: var(--success); }
.legend .key.behind { background: var(--danger); }
.legend .key.mark { background: var(--ink); width: 4px; height: 12px; }
.spark { width: 100%; height: auto; display: block; overflow: visible; }
.spark .bar { fill: var(--bronze); }
.spark .bar.today { fill: var(--gold); }
.spark .bar.zero { fill: var(--border-strong); }
.spark .axis { stroke: var(--border-strong); stroke-width: 1; }
.spark text { fill: var(--text-muted); font-size: 11px; font-family: inherit; }
.spark text.val { fill: var(--text); font-weight: 700; }
.chart-total { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.chart-total strong { font-size: var(--fs-lg); }

/* ---------- درگاه: کارت‌های صفحهٔ اول و شبکهٔ کارت‌های عکس‌دار کالا ---------- */
.portal-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.portal-card {
  display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; min-height: 112px; padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  color: var(--text); text-decoration: none;
}
a.portal-card:hover { border-color: var(--bronze); box-shadow: var(--sh-2); color: var(--text); }
.portal-card .stat-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: var(--r-md); background: var(--gold-soft); color: var(--bronze-dark); }
.portal-card .pc-title { font-size: var(--fs-sm); color: var(--text-muted); }
.portal-card .pc-value { font-size: var(--fs-lg); font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.portal-card .pc-note { font-size: var(--fs-xs); color: var(--text-muted); }
/* شبکهٔ کارت کالا: گوشی دو ستون، کامپیوتر چند ستون؛ عکس بالا، نام و قیمت زیر آن */
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.product-grid > .group-head, .product-grid > .empty { grid-column: 1 / -1; }
.product-grid .item.with-thumb, .product-grid label.pick-row {
  position: relative; flex-direction: column; align-items: stretch; gap: var(--sp-2);
  margin: 0; padding: var(--sp-2); height: 100%;
}
.product-grid .thumb, .product-grid .thumb-img, .product-grid span.thumb {
  width: 100%; height: auto; aspect-ratio: 1 / 1; border-radius: var(--r-sm);
}
.product-grid button.thumb { display: block; }
.product-grid .thumb-img { height: 100%; }
.product-grid .item .title, .product-grid .pick-text .title { font-size: var(--fs-sm); line-height: 1.5; }
.product-grid .item .muted, .product-grid .pick-text .muted, .product-grid .no-price { font-size: var(--fs-xs); line-height: 1.6; }
.product-grid .price { font-size: var(--fs-sm); }
/* تیک کارت: گوشهٔ بالای عکس، بزرگ و قابل لمس */
.product-grid label.pick-row input[type="checkbox"] {
  position: absolute; top: var(--sp-3); right: var(--sp-3); z-index: 2; width: 28px; height: 28px;
  background: var(--surface); border-radius: var(--r-sm); box-shadow: var(--sh-1);
}
/* گوشی: آیکون بالای عدد تا عدد و عنوان جای کافی داشته باشند */
@media (max-width: 899.98px) {
  .stat { flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-3); }
  .stat .stat-icon { width: 36px; height: 36px; }
  .stat .stat-value { font-size: var(--fs-2xl); }
  .stat .stat-value.small, .stat.money .stat-value { font-size: var(--fs-md); }
  /* کارت تنهای ردیف آخر: تمام عرض، آیکون کنار عدد */
  .stats > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; flex-direction: row; align-items: center; }
}
@media (min-width: 600px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) {
  .stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .portal-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-3); }
  .dash-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---------- موبایل خیلی باریک ---------- */
@media (max-width: 420px) {
  .grid2 { grid-template-columns: 1fr; }
  .row .cell::before { min-width: 72px; }
}

/* ---------- دسکتاپ (۹۰۰ پیکسل و بیشتر) ---------- */
@media (min-width: 900px) {
  body.has-sidebar { padding-right: var(--sidebar-w); }
  .bottom-nav, .more-sheet { display: none !important; }
  main { padding: var(--sp-5); padding-bottom: var(--sp-6); }
  .app-header { padding: var(--sp-3) var(--sp-5); }
  .app-header .mark { display: none; }

  /* منوی کناری تیره: زمینهٔ مشکی برند، متن روشن، سرتیتر گروه‌ها طلایی با آیکون، نشانگر طلایی کنار صفحهٔ فعال */
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; top: 0; right: 0; bottom: 0; width: var(--sidebar-w); z-index: 30;
    background: var(--nav-bg); color: var(--nav-text);
    border-left: 1px solid var(--nav-line);
    overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  }
  .sidebar .brand { display: block; padding: var(--sp-4); text-decoration: none; border-bottom: 1px solid var(--nav-line); }
  /* لوگو روی کارت کرم تا رنگ‌های خودش روی زمینهٔ تیره دیده شوند */
  .sidebar .brand img { display: block; width: 100%; max-width: 168px; height: auto; margin: 0 auto;
    padding: var(--sp-2) var(--sp-3); background: var(--cream); border-radius: var(--r-md); }
  .sidebar .brand .app-name { margin-top: var(--sp-2); text-align: center; color: var(--nav-text); font-size: var(--fs-sm); font-weight: 700; }
  .app-header .app-name { display: block; }
  .sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-2); }
  .sidebar nav a, .sidebar .side-foot a {
    position: relative;
    display: flex; align-items: center; gap: var(--sp-3);
    min-height: var(--touch); padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-sm);
    color: var(--nav-text); text-decoration: none; font-size: var(--fs-sm);
  }
  .sidebar nav a:hover, .sidebar .side-foot a:hover { background: var(--nav-hover); color: var(--on-bronze); }
  .sidebar nav a .ico, .sidebar .side-foot a .ico { width: var(--icon); height: var(--icon); flex: none; color: var(--nav-muted); }
  .sidebar nav a:hover .ico, .sidebar .side-foot a:hover .ico { color: var(--gold); }
  .sidebar nav a.current, .sidebar .side-foot a.current { background: var(--nav-active); color: var(--on-bronze); font-weight: 700; }
  .sidebar nav a.current .ico, .sidebar .side-foot a.current .ico { color: var(--gold); }
  .sidebar nav a.current::before, .sidebar .side-foot a.current::before {
    content: ''; position: absolute; right: calc(-1 * var(--sp-2)); top: 8px; bottom: 8px; width: 4px;
    border-radius: var(--r-full) 0 0 var(--r-full); background: var(--gold);
  }
  .sidebar .nav-group { margin-top: var(--sp-1); }
  .sidebar .nav-group-head {
    display: flex; align-items: center; gap: var(--sp-3); width: 100%;
    min-height: var(--touch); padding: var(--sp-2) var(--sp-3);
    background: none; border: none; border-radius: var(--r-sm); box-shadow: none;
    color: var(--gold); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0; text-align: right;
  }
  .sidebar .nav-group-head:hover { background: var(--nav-hover); color: var(--gold); }
  .sidebar .nav-group-head:active { transform: none; }
  .sidebar .nav-group-head span { flex: 1; font-size: var(--fs-sm); }
  .sidebar .nav-group-head .ico { width: 18px; height: 18px; flex: none; color: var(--gold); }
  .sidebar .nav-group-head .ico:last-child { width: 16px; height: 16px; color: var(--nav-muted); transition: transform var(--dur) var(--ease); }
  .sidebar .nav-group.open .nav-group-head .ico:last-child { transform: rotate(180deg); }
  .sidebar .nav-group-items { display: none; flex-direction: column; gap: 2px; padding-right: var(--sp-3); }
  .sidebar .nav-group.open .nav-group-items { display: flex; }
  .sidebar .nav-top { display: flex; flex-direction: column; gap: 2px; }
  .sidebar .side-foot a { margin-bottom: var(--sp-2); }
  .sidebar .side-foot { margin-top: auto; padding: var(--sp-3) var(--sp-3) var(--sp-4); border-top: 1px solid var(--nav-line); font-size: var(--fs-sm); }
  .sidebar .side-foot .who { color: var(--nav-muted); margin-bottom: var(--sp-2); padding: 0 var(--sp-2); }
  .sidebar .side-foot button { width: 100%; background: transparent; color: var(--nav-text); border-color: rgba(255, 255, 255, 0.28); }
  .sidebar .side-foot button:hover { background: var(--nav-hover); border-color: var(--gold); color: var(--on-bronze); }
  .sidebar :focus-visible { box-shadow: none; }

  /* درگاه مشتری: بدون منوی کناری، منو در سربرگ */
  body.portal .app-header .mark { display: block; }
  body.portal .app-header .header-nav { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
  body.portal .app-header .header-nav a {
    color: var(--on-bronze); text-decoration: none; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); font-size: var(--fs-sm);
  }
  body.portal .app-header .header-nav a:hover { background: var(--bronze-dark); }
  body.portal .app-header .header-nav a.current { background: var(--bronze-dark); font-weight: 700; box-shadow: inset 0 -3px 0 var(--gold); }
  body.portal main { max-width: 900px; }

  .mobile-only { display: none !important; }
  /* سرتیتر چسبان جدول‌ها: محفظه تا ۷۰٪ ارتفاع صفحه، بعد اسکرول داخل خودش */
  .table-wrap { max-height: 70vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
  table.lines th { position: sticky; top: 0; z-index: 1; }
  .table-wrap > table.lines, .table-wrap > .rows { margin: 0; }
  .table-wrap table.lines tr:last-child td, .table-wrap .row:last-child .cell { border-bottom: none; }
  .total-bar { bottom: 0; }

  /* انتخاب‌گر تاریخ روی دسکتاپ: پنجرهٔ وسط صفحه */
  .jdate-pop .panel { right: 50%; left: auto; bottom: auto; top: 15vh; width: 380px; transform: translateX(50%); border-radius: var(--r-lg); }

  /* لیست واکنش‌گرا به شکل جدول */
  .rows { display: table; width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
  .rows-head, .row { display: table-row; }
  .rows-head .cell {
    display: table-cell; padding: var(--sp-2) var(--sp-3);
    background: var(--surface-2); color: var(--text-muted); font-weight: 500; white-space: nowrap;
    border-bottom: 1px solid var(--border-strong);
  }
  .row { border: none; border-radius: 0; margin: 0; padding: 0; background: none; }
  .row .cell, .row .cell.main, .row .cell.actions, .row .cell.blank {
    display: table-cell; padding: var(--sp-2) var(--sp-3); vertical-align: top;
    border-bottom: 1px solid var(--border); font-size: var(--fs-sm); margin: 0;
  }
  .row .cell::before { display: none; }
  .row .cell.main { font-weight: 700; }
  .row .cell.nowrap { white-space: nowrap; }
  /* ستون اصلی جدول‌های پرستون (مثل لیست سفارش‌ها) که نباید باریک شود */
  .row .cell.wide { min-width: 200px; }
  .row .cell.actions > * + * { margin-top: var(--sp-1); }
  .row .cell.actions input { width: 100%; min-width: 120px; }
  .rows-head .cell { position: sticky; top: 0; z-index: 1; font-weight: 700; }
  .row:nth-child(odd) .cell { background: var(--row-alt); }
  a.row:hover .cell, div.row:hover .cell { background: var(--bronze-soft); }
  .row.late .cell { background: var(--danger-bg); }
  a.row:hover { box-shadow: none; }
  .row .badge { margin: 0 var(--sp-1) 0 0; }
}

/* ---------- برگهٔ سفارش (order-sheet.html) و قالب چاپ A4 ---------- */
.sheet {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-5); box-shadow: var(--sh-1);
}
.sheet-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4);
  padding-bottom: var(--sp-3); margin-bottom: var(--sp-4); border-bottom: 3px solid var(--bronze);
}
.sheet-head img { height: 56px; width: auto; }
.sheet-brand { font-size: var(--fs-lg); font-weight: 700; color: var(--bronze); }
.sheet-number {
  margin-right: auto; font-size: var(--fs-lg); font-weight: 700; direction: ltr; white-space: nowrap;
  padding: var(--sp-1) var(--sp-3); border: 1px solid var(--gold); border-radius: var(--r-sm);
}
.sheet-meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-1) var(--sp-4); font-size: var(--fs-sm); }
.sheet-meta > * { min-width: 0; }
.daily-total { font-size: var(--fs-lg); font-weight: 700; }
@media screen and (max-width: 599.98px) {
  .sheet { padding: var(--sp-3); }
  .sheet-head img { height: 40px; }
  .sheet-meta { grid-template-columns: 1fr; }
}
details.group > summary { cursor: pointer; padding: var(--sp-2) 0; font-weight: 700; min-height: var(--touch); }
details.group details.group { margin-right: var(--sp-4); }
details.group > summary .muted { font-weight: 400; }

@page { size: A4; margin: 12mm; }
@media print {
  .app-header, .sidebar, .bottom-nav, .more-sheet, .no-print, .fab { display: none !important; }
  body, body.has-sidebar, body.portal { background: var(--surface); padding: 0; }
  main { max-width: none; padding: 0; }
  .sheet { border: none; box-shadow: none; border-radius: 0; padding: 0; }
  .table-wrap { overflow: visible; max-height: none; border: none; }
  table.lines th { position: static; }
  table.lines tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
