/* ركيزة — الأنماط العامة (RTL) */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #6b7682;
  --border: #e1e5ea;
  --primary: #1f5f8b;
  --primary-soft: #e6f0f7;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #1e7b4a;
  --success-soft: #e7f5ec;
  --warning-soft: #fff6e0;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* الشريط العلوي */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 18px;
}
.company-name { color: var(--muted); font-weight: 500; }
.badge {
  font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary);
}
.userbox { display: flex; gap: 16px; align-items: center; color: var(--muted); }

/* التخطيط */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 220px; background: var(--surface); border-left: 1px solid var(--border); padding: 16px 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 10px 20px; color: var(--text); }
.sidebar a:hover { background: var(--primary-soft); text-decoration: none; }
.content { flex: 1; padding: 24px 28px; max-width: 1200px; }
.page-title { margin: 0 0 20px; font-size: 22px; }

/* البطاقات */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.card h2 { margin: 0 0 16px; font-size: 17px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; }

/* النماذج */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; font: inherit;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.actions { margin-top: 20px; display: flex; gap: 10px; }

.btn {
  display: inline-block; padding: 9px 18px; font: inherit; font-weight: 500;
  border: 1px solid var(--primary); border-radius: 6px;
  background: var(--primary); color: #fff; cursor: pointer;
}
.btn:hover { opacity: .92; text-decoration: none; }
.btn-light { background: #fff; color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* الجداول */
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; }
table.grid th { background: #fafbfc; font-weight: 500; color: var(--muted); font-size: 13px; }
/* الأرقام: تُكتب من اليسار لليمين لكنها تُحاذى تحت عنوان عمودها */
table.grid td.num { text-align: right; direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* التنبيهات */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.alert-info { background: var(--primary-soft); color: var(--primary); }
.alert-warning { background: var(--warning-soft); color: #8a5a00; }

.status { padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.status-active { background: var(--success-soft); color: var(--success); }
.status-suspended, .status-expired { background: var(--danger-soft); color: var(--danger); }

/* صفحة الدخول */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; }
.login-box .brand { justify-content: center; margin-bottom: 24px; font-size: 22px; }
.login-box .field { margin-bottom: 14px; }
.login-box .btn { width: 100%; }
.muted { color: var(--muted); }

}

/* التبويبات */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 16px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab .count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--warning-soft); color: #8a5a00; font-size: 12px; text-align: center; }
.grid select { padding: 5px 8px; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: #fff; }

/* الأرصدة والفلاتر */
.bal-credit { color: var(--danger); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bal-debit { color: var(--success); font-variant-numeric: tabular-nums; white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 160px; }
.filters .field input, .filters .field select { padding: 7px 10px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
tr.inactive td { color: var(--muted); }
tr.total td { font-weight: 700; background: #fafbfc; }
.lines td { padding: 6px 8px; }
.lines input, .lines select { width: 100%; padding: 7px 8px; font: inherit; border: 1px solid var(--border); border-radius: 6px; }
.lines .amount { direction: ltr; text-align: right; }
.link-danger { color: var(--danger); background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }
@media print { .sidebar, .topbar, .filters, .actions, .no-print { display: none !important; } .content { padding: 0; } }
.print-head { display: none; }
@media print {
  .print-head { display: block; margin-bottom: 12px; }
  .page-title { display: none; }
  body { background: #fff; font-size: 12px; }
  .card { border: 0; padding: 0; }
  table.grid th, table.grid td { padding: 4px 6px; }
  .stat { padding: 8px; } .stat .value { font-size: 16px; }
}

/* حقول التاريخ والأرقام: اتجاه ثابت حتى لا تنقلب الكتابة */
input[type=date], input[type=number], input[dir=ltr], .amount { direction: ltr; text-align: right; }

/* =====================================================================
   التنقل: سطح المكتب
   ===================================================================== */
.ic { flex-shrink: 0; }
.topbar { position: sticky; top: 0; z-index: 30; gap: 12px; }
.brand { min-width: 0; }
.brand .company-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand .company-name::before { content: "· "; }
.userbox .who { color: inherit; }
.nav-toggle, .nav-close { display: none; background: none; border: 0; padding: 6px; color: var(--text); cursor: pointer; border-radius: 8px; }
.nav-toggle:hover, .nav-close:hover { background: var(--primary-soft); }
.sidebar a { display: flex; align-items: center; gap: 10px; }
.sidebar a .ic { color: var(--muted); }
.sidebar a.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; box-shadow: inset -3px 0 0 var(--primary); }
.sidebar a.active .ic { color: var(--primary); }
.drawer-head, .drawer-only, .nav-backdrop, .bottom-nav { display: none; }
.sidebar { position: sticky; top: 56px; align-self: flex-start; max-height: calc(100vh - 56px); overflow-y: auto; }

/* =====================================================================
   الجوال والأجهزة الصغيرة
   ===================================================================== */
@media (max-width: 860px) {
  body { font-size: 15px; }
  .topbar { height: 54px; padding: 0 10px; }
  .nav-toggle { display: inline-flex; }
  .brand { font-size: 16px; gap: 8px; flex: 1; }
  .brand .logo-mark { width: 30px; height: 30px; font-size: 16px; }
  .brand .company-name { font-size: 14px; max-width: 46vw; }
  .area-app .brand .brand-name { display: none; }
  .area-app .brand .company-name::before { content: ""; }
  .userbox { display: none; }

  .layout { display: block; min-height: auto; }
  /* القائمة المنزلقة من اليمين */
  .sidebar {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: 82vw; max-width: 320px; max-height: none;
    padding: 0 0 20px; border-left: 0; box-shadow: -8px 0 24px rgba(0,0,0,.12);
    transform: translateX(105%); transition: transform .22s ease; overflow-y: auto;
  }
  .nav-open .sidebar { transform: none; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 32, .38); }
  .nav-open .nav-backdrop { display: block; }
  .nav-open { overflow: hidden; }
  .drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
  .drawer-who { font-weight: 700; }
  .nav-close { display: inline-flex; }
  .drawer-only { display: block; }
  .drawer-only:first-of-type { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
  .sidebar a { padding: 13px 20px; font-size: 16px; }

  /* الشريط السفلي */
  .has-nav .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
    color: var(--muted); font: inherit; font-size: 11.5px; background: none; border: 0; border-radius: 10px; cursor: pointer;
  }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 500; }
  .bottom-nav .ic { width: 22px; height: 22px; }
  .has-nav .content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

  .content { padding: 14px 12px; max-width: none; }
  .page-title { font-size: 19px; margin-bottom: 14px; }

  /* بطاقات المؤشرات: عمودان مضغوطان */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat .label { font-size: 12px; }
  .stat .value { font-size: 19px; overflow-wrap: anywhere; }

  .card { padding: 14px; margin-bottom: 14px; border-radius: 12px; }
  .card h2 { font-size: 16px; }

  /* النماذج: عمود واحد، وحقول 16px حتى لا يكبّر iOS الشاشة */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .field input, .field select, .field textarea, .lines input, .lines select, .grid select { font-size: 16px; padding: 11px 12px; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters .field { min-width: 0; }
  .filters .btn, .actions .btn { width: 100%; text-align: center; padding: 12px; }
  .actions { flex-direction: column; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar > div { display: flex; gap: 8px; }
  .toolbar > div .btn { flex: 1; text-align: center; }
  .checks { grid-template-columns: 1fr; }

  /* التبويبات: تمرير أفقي بدل الالتفاف */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: 10px 12px; }

  /* الجداول: تمرير أفقي مع خط أصغر */
  table.grid { font-size: 13.5px; }
  table.grid th, table.grid td { padding: 9px 8px; }

  /* سطور السند: كل سطر بطاقة */
  table.lines thead { display: none; }
  table.lines, table.lines tbody, table.lines tr, table.lines td { display: block; width: 100%; }
  table.lines tbody tr { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 10px 10px 4px; margin-bottom: 10px; background: #fff; }
  table.lines tbody td { border: 0; padding: 4px 0; }
  table.lines tbody td:last-child { position: absolute; top: 6px; left: 8px; width: auto; padding: 0; }
  table.lines tfoot, table.lines tfoot tr { display: flex; width: 100%; }
  table.lines tfoot td { display: flex; align-items: center; border: 0; }
  table.lines tfoot td:first-child { flex: 1; }
  table.lines td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
  table.lines td.net { text-align: right; font-weight: 700; }
  table.lines td.net::before { display: inline; margin-left: 8px; }
  /* اليومية على الجوال: الحقول الصغيرة متجاورة */
  #sheet table.lines tbody tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; }
  #sheet table.lines tbody td { display: block; }
  #sheet table.lines tbody td.wname, #sheet table.lines tbody td[data-label="سبب الخصم"], #sheet table.lines tbody td.net { grid-column: 1 / -1; }
  #sheet table.lines tbody td:last-child { position: static; }
  .link-danger { font-size: 18px; padding: 4px 8px; }

  /* صفحة الدخول */
  .login-box { width: calc(100vw - 32px); padding: 24px; }
}

@media (max-width: 380px) {
  .stat .value { font-size: 17px; }
  .bottom-nav a, .bottom-nav button { font-size: 10.5px; }
}

@media print {
  .bottom-nav, .nav-toggle, .nav-backdrop { display: none !important; }
}

/* tabs: horizontal scroll on mobile (fix wrapping/overlap) */
@media (max-width: 860px) {
  .tabs { display: flex; flex-wrap: nowrap !important; overflow-x: auto; overflow-y: hidden; }
  .tabs > a, .tabs > button, .tabs > span { flex: 0 0 auto; white-space: nowrap; line-height: 1.4; }
  .actions-row a.btn, .actions-row button.btn, form .btn { display: inline-flex; align-items: center; justify-content: center; }
}

/* ===== بطاقات الموبايل (cards.js) ===== */
.filter-bar { display: none; }
@media (max-width: 860px) {
  /* الفلاتر المطوية */
  .filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 12px 12px 0; }
  .card > .filter-bar { padding: 12px 12px 0; }
  .filter-toggle { display: inline-flex !important; align-items: center; gap: 6px; width: auto !important; padding: 8px 14px !important; }
  .filter-toggle.on { background: var(--primary); color: #fff; border-color: var(--primary); }
  .filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .filter-chips span { font-size: 12px; background: #eef4f9; color: var(--primary); border-radius: 12px; padding: 3px 10px; }
  form.filters.foldable { display: none !important; }
  form.filters.foldable.open { display: flex !important; padding: 0 12px 12px !important; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }

  /* الجدول → قائمة بطاقات */
  .card:has(> table.cardify) { background: transparent; border: 0; box-shadow: none; overflow: visible !important; }
  table.cardify { display: flex; flex-direction: column; gap: 10px; background: transparent; border: 0; }
  table.cardify thead { display: none; }
  table.cardify tbody, table.cardify tfoot { display: contents; }
  table.cardify tfoot tr { order: -1; }
  table.cardify tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 12px 14px; box-shadow: 0 1px 2px rgba(16,24,40,.04);
  }
  table.cardify tr.c-click { cursor: pointer; }
  table.cardify tr.c-click:active { background: #f4f8fb; }
  table.cardify td { display: block; border: 0 !important; padding: 0 !important; text-align: right; background: none; }
  table.cardify td.c-empty { display: none !important; }

  /* السطر الأعلى: التاريخ ورقم السند */
  table.cardify td.c-top { order: 1; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
  table.cardify td.c-top[data-label="السند"]::before { content: "سند "; }
  table.cardify td.c-top[data-label="#"]::before { content: "#"; }
  table.cardify td.c-top + td.c-top { padding-inline-start: 8px !important; border-inline-start: 1px solid var(--border) !important; }
  /* العنوان */
  table.cardify td.c-title { order: 2; flex: 1 1 100%; font-size: 15px; font-weight: 600; line-height: 1.6; color: var(--text); white-space: normal; }
  /* الوسوم */
  table.cardify td.c-chip { order: 3; font-size: 12px; background: #f1f4f7; color: #475467; border-radius: 12px; padding: 3px 10px !important; max-width: 100%; }
  table.cardify td.c-chip.muted { color: #475467; }
  table.cardify td.c-chip a { color: var(--primary); }
  /* مفتاح: قيمة */
  table.cardify td.c-kv { order: 4; flex: 1 1 100%; display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding-top: 4px !important; border-top: 1px dashed #edf0f3 !important; }
  table.cardify td.c-kv::before { content: attr(data-label); color: var(--muted); direction: rtl; flex: 0 0 auto; }
  table.cardify td.c-kv.num, table.cardify td.c-amt, table.cardify tr.c-sum td.num[data-label] { direction: ltr; flex-direction: row-reverse; unicode-bidi: normal; }
  table.cardify td.c-kv select, table.cardify td.c-kv input { max-width: 60%; }
  table.cardify td.c-pos { color: #0f7b4a; }
  table.cardify td.c-neg { color: #b42318; }
  /* المبلغ */
  table.cardify td.c-amt { order: 5; flex: 1 1 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 18px; font-weight: 700; color: var(--text); margin-top: 4px; padding-top: 6px !important; border-top: 1px solid #edf0f3 !important; }
  table.cardify td.c-amt::before { content: attr(data-label); font-size: 12.5px; font-weight: 400; color: var(--muted); }
  table.cardify td.c-amt > * { direction: rtl; }
  table.cardify tr.tone-out td.c-amt { color: #b42318; }
  table.cardify tr.tone-in td.c-amt { color: #0f7b4a; }
  table.cardify td.c-by { order: 6; font-size: 11.5px; color: var(--muted); align-self: center; }
  table.cardify td.c-by::before { content: "بواسطة "; }
  table.cardify td.c-act { order: 7; flex: 0 0 auto; margin-inline-start: auto; }
  table.cardify td.c-act .btn { width: auto !important; padding: 6px 12px !important; }
  table.cardify td.c-act:has(.btn) { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; }

  /* صفوف الإجمالي/الرصيد السابق */
  table.cardify tr.c-sum { background: #eef4f9; border-color: #d5e3ee; font-weight: 600; color: var(--primary); }
  table.cardify tr.c-sum td { flex: 1 1 auto; }
  table.cardify tr.c-sum td[data-label] { flex: 1 1 100%; display: flex; justify-content: space-between; font-size: 15px; }
  table.cardify tr.c-sum td[data-label]::before { content: attr(data-label); font-weight: 500; color: var(--muted); }
  table.cardify tr.c-sum td.muted { color: var(--muted); font-weight: 400; }
}
@media print { .filter-bar { display: none !important; } }

/* ===== الأصناف والفواتير ===== */
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.seg label { margin: 0; cursor: pointer; position: relative; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: block; padding: 9px 16px; font-size: 14px; color: var(--muted); border-inline-start: 1px solid var(--border); }
.seg label:first-child span { border-inline-start: 0; }
.seg input:checked + span { background: var(--primary); color: #fff; font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.grand { font-size: 24px; font-weight: 700; color: var(--primary); direction: ltr; text-align: right; padding: 4px 0; font-variant-numeric: tabular-nums; }
a.chip, span.chip { display: inline-block; font-size: 13px; background: #f1f4f7; color: var(--primary); border-radius: 12px; padding: 3px 10px; margin: 2px; }
.stats a.stat { color: inherit; }

.invoice-doc .inv-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 2px solid var(--primary); padding-bottom: 12px; margin-bottom: 12px; }
.invoice-doc .inv-company { font-size: 20px; font-weight: 700; color: var(--primary); }
.invoice-doc .inv-title { font-size: 18px; font-weight: 700; }
.invoice-doc .inv-meta { text-align: left; }
.invoice-doc .inv-sub { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 12px; color: var(--text); }
.invoice-doc .inv-total { font-size: 18px; font-weight: 700; }
.invoice-doc table.grid tfoot td { font-weight: 600; }

@media (max-width: 860px) {
  .seg { display: flex; width: 100%; }
  .seg label { flex: 1; }
  .seg span { text-align: center; padding: 11px 6px; }
  .grand { text-align: left; }
  .invoice-doc .inv-head { flex-direction: column; }
  .invoice-doc .inv-meta { text-align: right; }
  .invoice-doc table.grid { font-size: 13px; }
  .invoice-doc table.grid th, .invoice-doc table.grid td { padding: 8px 6px; }
}
@media print {
  .invoice-doc { box-shadow: none; border: 0; padding: 0; max-width: 80mm; margin: 0 auto; font-size: 12px; }
  .invoice-doc .inv-head { flex-direction: column; text-align: center; align-items: center; }
  .invoice-doc .inv-meta { text-align: center; }
  .invoice-doc table.grid th, .invoice-doc table.grid td { padding: 4px 2px; }
  .bottom-nav, .filter-bar { display: none !important; }
}

/* ===== الصناديق ===== */
.cash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 12px; }
.cash-card { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.cash-card .cash-bal { font-size: 26px; font-weight: 700; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.cash-card .cash-actions { display: flex; gap: 6px; margin-top: 6px; }
.stats a.stat { text-decoration: none; }
@media (max-width: 860px) { .cash-grid { grid-template-columns: 1fr; } .cash-card .cash-actions .btn { width: auto !important; } }
.readonly-box { padding: 9px 12px; border: 1px dashed var(--border); border-radius: 8px; background: #fafbfc; color: var(--text); min-height: 40px; display: flex; align-items: center; }

/* ===================== الكاشير ===================== */
body.pos-mode .sidebar, body.pos-mode .bottom-nav, body.pos-mode .nav-toggle, body.pos-mode .page-title, body.pos-mode main > h1 { display: none !important; }
body.pos-mode .layout, body.pos-mode main { display: block; }
body.pos-mode main { padding: 10px 12px 0 !important; max-width: none !important; margin: 0 !important; }
#pos { display: flex; flex-direction: column; height: calc(100vh - 76px); height: calc(100dvh - 76px); }
.pos-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pos-shift { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pos-shift .dot { width: 10px; height: 10px; border-radius: 50%; background: #c4cdd5; display: inline-block; }
.pos-shift .dot.on { background: #12b76a; box-shadow: 0 0 0 3px #d1fadf; }
.pos-bar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 12px; text-align: center; line-height: 20px; }
.pos-tabs-m { display: none; }
.pos-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 380px; gap: 12px; }
.pos-menu, .pos-ticket { min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.pos-search { padding: 10px 10px 0; }
.pos-search input { width: 100%; font-size: 16px; padding: 10px 12px; border-radius: 10px; }
.pos-groups { display: flex; gap: 6px; padding: 10px; overflow-x: auto; flex: 0 0 auto; border-bottom: 1px solid var(--border); }
.pos-groups button { flex: 0 0 auto; border: 1px solid var(--border); background: #fff; border-radius: 22px; padding: 9px 16px; font: inherit; font-size: 15px; cursor: pointer; white-space: nowrap; }
.pos-groups button.on { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.pos-items { flex: 1; overflow-y: auto; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; align-content: start; }
.pos-item { border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 12px 8px; min-height: 86px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  font: inherit; cursor: pointer; text-align: center; transition: transform .08s, background .15s; -webkit-tap-highlight-color: transparent; }
.pos-item:hover { border-color: var(--primary); }
.pos-item.hit { transform: scale(.95); background: #eef4f9; }
.pos-item .n { font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--text); }
.pos-item .p { font-size: 14px; color: var(--primary); direction: ltr; font-variant-numeric: tabular-nums; }
.pos-ticket-head { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); align-items: center; }
.pos-table { flex: 1; font: inherit; font-size: 16px; font-weight: 600; padding: 10px; border-radius: 10px; border: 2px dashed var(--border); background: #fafbfc; cursor: pointer; }
.pos-table.set { border-style: solid; border-color: var(--primary); color: var(--primary); background: #eef4f9; }
.pos-lines { flex: 1; overflow-y: auto; padding: 4px 10px; }
.pos-lines .empty { text-align: center; padding: 30px 10px; }
.pos-line { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "name qty total" "more more more"; gap: 2px 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.ln-name { grid-area: name; font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.ln-name small { display: block; color: #b54708; font-weight: 400; }
.ln-name .ln-price { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; direction: ltr; text-align: right; }
.ln-qty { grid-area: qty; display: flex; align-items: center; gap: 4px; }
.ln-qty button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.ln-qty b { min-width: 28px; text-align: center; font-size: 16px; cursor: pointer; }
.ln-total { grid-area: total; font-weight: 700; direction: ltr; min-width: 64px; text-align: left; font-variant-numeric: tabular-nums; }
.ln-more { grid-area: more; display: flex; gap: 4px; justify-content: flex-start; }
.ln-more button { border: 0; background: none; color: var(--muted); font-size: 14px; padding: 2px 8px; cursor: pointer; border-radius: 6px; }
.ln-more button:hover { background: #f1f4f7; }
.pos-totals { padding: 8px 12px; border-top: 1px solid var(--border); background: #fafbfc; }
.pos-totals .row, .close-sum .row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 14px; }
.pos-totals .row b, .close-sum .row b { direction: ltr; font-variant-numeric: tabular-nums; }
.pos-totals .row.big, .close-sum .row.big { font-size: 22px; color: var(--primary); padding-top: 6px; }
.linkbtn { border: 0; background: none; color: var(--primary); cursor: pointer; font: inherit; font-size: 12px; text-decoration: underline; }
.pos-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; padding: 10px; }
.pos-actions .btn { padding: 14px; font-size: 16px; width: 100%; }
.btn.pos-pay { background: #12b76a; border-color: #12b76a; font-size: 18px; font-weight: 700; }
.btn.pos-pay:hover { background: #039855; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.pos-modal { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pos-modal[hidden] { display: none; }
.pos-dialog { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(16,24,40,.25); }
.pos-dialog.wide { max-width: 760px; }
.pos-dialog h2 { margin: 0 0 12px; }
.pos-dialog .field { margin-bottom: 12px; }
.pos-dialog .field input, .pos-dialog .field select { width: 100%; font-size: 17px; padding: 10px; }
.pos-dialog .actions .btn { width: 100%; padding: 14px; font-size: 17px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head .x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.pos-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 12px; }
.pos-tbl { border: 2px solid #d1fadf; background: #f6fef9; border-radius: 12px; padding: 14px 6px; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.pos-tbl b { font-size: 16px; }
.pos-tbl small { color: var(--muted); direction: ltr; }
.pos-tbl.busy { border-color: #fec84b; background: #fffaeb; }
.pos-tbl.busy small { color: #b54708; font-weight: 700; }
.pos-tbl.on { outline: 3px solid var(--primary); }
.pos-olist { display: flex; flex-direction: column; gap: 8px; }
.pos-o { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.pos-o .amt { font-size: 18px; direction: ltr; }
.pos-o .btn { margin-inline-start: 4px; }
.pay-total { font-size: 34px; font-weight: 800; text-align: center; color: var(--primary); direction: ltr; margin: 4px 0 14px; }
.pay-methods { display: flex; width: 100%; margin-bottom: 14px; }
.pay-methods label { flex: 1; }
.pay-methods span { text-align: center; padding: 13px 4px; font-size: 15px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.quick .btn { flex: 1; padding: 10px 4px; direction: ltr; }
.change { font-size: 16px; margin-bottom: 12px; }
.change b { direction: ltr; display: inline-block; font-size: 20px; }
.chk { display: flex; align-items: center; gap: 8px; margin: 6px 0 14px; }
.close-sum { background: #fafbfc; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
.close-sum .warn { color: #b54708; margin: 8px 0 0; }
.pos-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #101828; color: #fff; padding: 12px 22px; border-radius: 12px; z-index: 300; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 90vw; }
.pos-toast.bad { background: #b42318; }

@media (max-width: 1100px) { .pos-main { grid-template-columns: 1fr 330px; } .pos-items { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); } }
@media (max-width: 860px) {
  #pos { height: calc(100vh - 64px); height: calc(100dvh - 64px); }
  body.pos-mode main { padding: 8px 8px 0 !important; }
  .pos-bar { margin-bottom: 6px; }
  .pos-bar-actions .btn { padding: 7px 10px !important; font-size: 13px; width: auto !important; }
  .pos-tabs-m { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
  .pos-tabs-m button { font: inherit; font-size: 15px; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
  .pos-tabs-m button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
  .pos-tabs-m button.on .pill { background: #fff; color: var(--primary); }
  .pos-main { grid-template-columns: 1fr; }
  #pos[data-pane="menu"] .pos-ticket, #pos[data-pane="ticket"] .pos-menu { display: none; }
  .pos-items { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; padding: 8px; }
  .pos-item { min-height: 78px; padding: 10px 6px; }
  .pos-item .n { font-size: 14px; }
  .pos-dialog { padding: 16px; border-radius: 14px; }
  .pos-o { grid-template-columns: 1fr auto; }
  .pos-o > div:last-child { grid-column: 1 / -1; display: flex; gap: 6px; }
  .pos-o .btn { flex: 1; margin: 0; width: auto !important; }
}
@media print { body.pos-mode * { visibility: hidden; } }

/* ===== صور الأصناف ===== */
.img-field { display: flex; gap: 14px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.img-prev { width: 96px; height: 96px; border-radius: 14px; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.img-prev span { color: #fff; font-size: 40px; font-weight: 700; }
.thumb-sm { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; vertical-align: middle; margin-inline-end: 8px; }
.thumb-ph { width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; vertical-align: middle; margin-inline-end: 8px; }
.pos-item img, .pos-item .ph, .wt-item img, .wt-item .ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 9px; display: block; }
.pos-item .ph, .wt-item .ph { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 30px; font-weight: 700; opacity: .9; }
.pos-item { padding: 6px 6px 8px; }
.pos-tbl em { font-style: normal; font-size: 12px; color: #b42318; font-weight: 700; }
.pos-tbl.bill { border-color: #f04438; background: #fef3f2; animation: billpulse 1.4s ease-in-out infinite; }
@keyframes billpulse { 50% { box-shadow: 0 0 0 4px rgba(240,68,56,.18); } }
.pos-o.bill { border-color: #f04438; background: #fef3f2; }
.autoprint { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 0 6px; }

/* ===== شاشة الجرسون ===== */
body.waiter-mode main { padding-bottom: 0 !important; }
#wt { max-width: 1200px; margin: 0 auto; }
.wt-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; position: sticky; top: 0; z-index: 5; background: var(--bg, #f5f7f9); padding: 4px 0; }
.wt-bar .wt-title { flex: 1; font-size: 20px; font-weight: 700; text-align: center; }
.wt-bar .btn { width: auto !important; }
.wt-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wt-tables .pos-tbl { padding: 22px 8px; }
.wt-tables .pos-tbl b { font-size: 18px; }
#vMenu .pos-search { padding: 0 0 8px; }
#vMenu .pos-groups { padding: 0 0 10px; border: 0; }
.wt-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding-bottom: 90px; }
.wt-item { position: relative; border: 1px solid var(--border); background: #fff; border-radius: 14px; padding: 6px 6px 10px; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 6px; text-align: center; -webkit-tap-highlight-color: transparent; }
.wt-item:active { transform: scale(.97); }
.wt-item .n { font-weight: 600; font-size: 15px; line-height: 1.35; }
.wt-item .p { color: var(--primary); direction: ltr; }
.wt-item .badge { position: absolute; top: 10px; left: 10px; background: #12b76a; color: #fff; font-style: normal; font-weight: 700; min-width: 28px; height: 28px; line-height: 28px; border-radius: 14px; padding: 0 6px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.wt-cart { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 24px)); z-index: 50; border: 0; border-radius: 14px;
  background: var(--primary); color: #fff; font: inherit; font-size: 16px; padding: 14px 18px; display: flex; gap: 8px; align-items: center; box-shadow: 0 10px 30px rgba(16,24,40,.3); cursor: pointer; }
.wt-cart b { direction: ltr; }
.wt-cart .go { margin-inline-start: auto; font-weight: 700; }
.wt-cart.new { background: #12b76a; }
.wt-line.done .ln-name { color: var(--muted); }
.ln-price.new { color: #12b76a !important; font-weight: 700; }
.wt-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; margin-top: 12px; }
.wt-actions .btn { width: 100%; padding: 14px; font-size: 16px; }
.wt-sheet .pos-dialog { max-width: 560px; }
.ln-qty button:disabled { opacity: .3; }
@media (max-width: 860px) {
  .wt-tables { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .wt-tables .pos-tbl { padding: 16px 6px; }
  .wt-items { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .wt-sheet { align-items: flex-end; padding: 0; }
  .wt-sheet .pos-dialog { border-radius: 18px 18px 0 0; max-height: 88vh; }
}
@media (min-width: 600px) and (max-width: 860px) { .wt-items { grid-template-columns: repeat(3, 1fr); } }
/* العنصر المخفي يبقى مخفياً مهما كان نمط عرضه */
[hidden] { display: none !important; }

/* ===== تقرير نهاية اليوم ===== */
.day-report .dr-head { text-align: center; margin-bottom: 14px; }
.dr-co { font-size: 15px; color: var(--muted); }
.dr-title { font-size: 24px; font-weight: 800; color: var(--primary); }
.dr-date { font-size: 15px; }
.dr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-bottom: 12px; }
.dr-sec { margin: 0; }
.dr-sec h3 { margin: 0 0 8px; font-size: 16px; color: var(--primary); }
.dr-sec .row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 14px; }
.dr-sec .row b { direction: ltr; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dr-sec .row.sep { border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 8px; }
.dr-sec .row.total { border-top: 2px solid var(--text); margin-top: 4px; padding-top: 6px; font-size: 16px; font-weight: 700; }
.dr-sec .shift { border-bottom: 1px dashed var(--border); padding: 6px 0; }
.dr-sec .shift:last-child { border-bottom: 0; }
.dr-hours .hr { display: grid; grid-template-columns: 48px 1fr auto 40px; gap: 8px; align-items: center; font-size: 13px; padding: 2px 0; }
.dr-hours .bar { background: #f1f4f7; border-radius: 4px; height: 12px; overflow: hidden; }
.dr-hours .bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.dr-hours b { direction: ltr; }
.dr-foot { text-align: center; font-size: 12px; }
@media print {
  .day-report .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .day-report .stats .stat { border: 1px solid #ccc; }
  body.print-80 .day-report { width: 72mm; margin: 0 auto; font-size: 11px; }
  body.print-80 .dr-grid { display: block; }
  body.print-80 .day-report .card { border: 0; border-top: 1px dashed #000; padding: 6px 0; margin: 0; border-radius: 0; }
  body.print-80 .dr-stats { display: none; }
  body.print-80 .dr-sec .row { font-size: 11px; padding: 1px 0; }
  body.print-80 .dr-title { font-size: 16px; }
  body.print-80 .dr-hours .hr { grid-template-columns: 34px 1fr auto 26px; font-size: 10px; }
}

/* ===== شاشة المطبخ ===== */
body.kds-mode { background: #101828; }
body.kds-mode .topbar { display: none; }
body.kds-mode main { padding: 10px !important; }
#kds { color: #fff; }
.kds-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.kds-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.kds-tabs button { border: 1px solid #344054; background: #1d2939; color: #d0d5dd; border-radius: 22px; padding: 9px 18px; font: inherit; font-size: 16px; cursor: pointer; }
.kds-tabs button.on { background: #fff; color: #101828; font-weight: 700; }
.kds-info { margin-inline-start: auto; color: #98a2b3; font-size: 15px; }
.kds-bar .btn { width: auto !important; }
.kds-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-items: start; }
.kds-t { background: #fff; color: #101828; border-radius: 14px; padding: 12px; border-top: 8px solid #12b76a; display: flex; flex-direction: column; gap: 8px; }
.kds-t.preparing { border-top-color: #2e90fa; }
.kds-t.warn { border-top-color: #f79009; }
.kds-t.late { border-top-color: #f04438; animation: billpulse 1.4s infinite; }
.kds-t .kh { display: flex; justify-content: space-between; align-items: center; }
.kds-t .kh b { font-size: 22px; }
.kds-t .age { font-size: 18px; font-weight: 700; color: #475467; }
.kds-t.late .age { color: #f04438; }
.kds-t .km { color: #667085; font-size: 13px; }
.kds-t ul { list-style: none; margin: 0; padding: 0; }
.kds-t li { font-size: 19px; padding: 6px 0; border-bottom: 1px dashed #eaecf0; }
.kds-t li b { color: #1f5f8b; }
.kds-t li small { display: block; color: #b54708; font-size: 15px; font-weight: 600; }
.kds-t .ka { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kds-t .ka .btn { width: 100%; padding: 12px; font-size: 16px; }
.kds-t .prep { display: flex; align-items: center; justify-content: center; color: #2e90fa; font-weight: 700; }
.kds-empty { color: #98a2b3; font-size: 22px; text-align: center; padding: 60px 0; grid-column: 1 / -1; }
.kds-ready { margin-top: 16px; color: #d0d5dd; }
.kds-ready summary { cursor: pointer; font-size: 16px; }
.kds-r { padding: 6px 0; border-bottom: 1px solid #344054; }
.kds-r .linkbtn { color: #84caff; }

/* إشعار "جاهز" عند الجرسون */
.wt-ready { background: #ecfdf3; border: 2px solid #12b76a; border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.wt-ready .r { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #a6f4c5; }
.wt-ready .r:last-child { border-bottom: 0; }
.wt-ready .r .btn { width: auto !important; padding: 8px 12px; }

/* ===== المنيو العام (QR) ===== */
body.menu-page { background: #f7f5f2; margin: 0; }
.mn-head { position: sticky; top: 0; z-index: 10; background: #1f5f8b; color: #fff; padding: 14px 14px 0; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.mn-co { font-size: 22px; font-weight: 800; text-align: center; }
.mn-table { text-align: center; font-size: 14px; opacity: .85; margin-top: 2px; }
.mn-head input { width: 100%; box-sizing: border-box; margin: 10px 0; border: 0; border-radius: 12px; padding: 11px 14px; font: inherit; font-size: 16px; }
.mn-groups { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.mn-groups::-webkit-scrollbar { display: none; }
.mn-groups a { flex: 0 0 auto; color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.4); border-radius: 20px; padding: 7px 14px; font-size: 14px; white-space: nowrap; }
.mn-groups a.on { background: #fff; color: #1f5f8b; font-weight: 700; }
.mn-main { max-width: 1000px; margin: 0 auto; padding: 10px 12px 30px; }
.mn-sec { scroll-margin-top: 170px; }
.mn-sec h2 { font-size: 19px; margin: 18px 4px 10px; color: #1f2933; }
.mn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.mn-item { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(16,24,40,.08); display: flex; flex-direction: column; }
.mn-item img, .mn-item .ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.mn-item .ph { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 36px; font-weight: 800; }
.mn-txt { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 4px; }
.mn-txt .n { font-weight: 700; font-size: 15px; line-height: 1.35; }
.mn-txt .p { color: #1f5f8b; font-weight: 800; font-size: 16px; }
.mn-txt .p small { font-weight: 500; font-size: 12px; }
.mn-empty, .mn-foot { text-align: center; color: #667085; padding: 20px; }
@media (max-width: 420px) { .mn-grid { grid-template-columns: repeat(2, 1fr); } }

/* بطاقات QR للطباعة */
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.qr-card { background: #fff; border: 2px dashed var(--border); border-radius: 14px; padding: 14px; text-align: center; break-inside: avoid; }
.qr-co { font-weight: 800; color: var(--primary); }
.qr-img svg { width: 150px; height: 150px; margin: 8px auto; display: block; }
.qr-t { font-size: 20px; font-weight: 800; }
.qr-hint { font-size: 12px; color: var(--muted); }
@media print {
  .qr-sheet { grid-template-columns: repeat(3, 1fr); gap: 8mm; }
  .qr-card { border: 1px dashed #999; padding: 6mm; }
  .qr-img svg { width: 45mm; height: 45mm; }
}
