/* GoFix — أحمر وأسود */
:root {
  --red: #d71920;
  --red-dark: #a8121a;
  --red-soft: #fdecec;
  --ink: #141414;
  --ink-2: #2a2a2a;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --bg: #f5f5f5;
  --card: #fff;
  --ok: #1f8a4c;
  --ok-soft: #e7f5ec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .92em; }
a { color: var(--red-dark); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.3; }

/* ---------- أزرار ---------- */
.btn {
  font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: .5em 1em; border-radius: 8px; cursor: pointer; white-space: nowrap; min-height: 40px;
}
.btn:hover:not(:disabled) { border-color: #bdbdbd; background: #fafafa; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); }
.btn-danger { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-danger-ghost { color: var(--red-dark); }
.btn-sm { padding: .3em .75em; min-height: 34px; font-size: .92em; }
.btn-block { width: 100%; }
.btn-on { border-color: var(--red); color: var(--red-dark); background: var(--red-soft); }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 1.1em; height: 1.1em;
  border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
.icon-btn { font: inherit; background: none; border: 0; cursor: pointer; padding: .25em .5em; border-radius: 6px; color: inherit; min-width: 32px; min-height: 32px; }
.icon-btn:hover:not(:disabled) { background: #eee; }
.icon-btn:disabled { opacity: .3; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; margin-top: .75em; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- كروت ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25em; margin-bottom: 1em; }
.card.narrow { max-width: 520px; }
.hero h2 { font-size: 1.35em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: .3em; padding: 1em; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink); border-inline-start: 4px solid var(--red); }
.tile:hover { background: #fffafa; }

/* ---------- البراند ---------- */
.brand { display: flex; align-items: center; gap: .5em; }
.brand img { max-height: 36px; max-width: 140px; object-fit: contain; }
.brand-text { font-weight: 800; font-size: 1.35em; letter-spacing: .5px; direction: ltr; }
.brand-text b { color: var(--red); }
.brand-big { justify-content: center; margin-bottom: 1em; }
.brand-big img { max-height: 72px; max-width: 220px; }
.brand-big .brand-text { font-size: 2.2em; }
.brand-name { font-weight: 600; }

/* ---------- الدخول ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1em;
  background: linear-gradient(160deg, #141414 0%, #141414 45%, #2a0b0d 100%); }
.auth-card { width: 100%; max-width: 380px; padding: 2em 1.5em; }
.auth-card h2 { text-align: center; }

/* ---------- الهيكل ---------- */
.layout { display: flex; min-height: 100vh; }
.side { width: 240px; background: var(--ink); color: #eee; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.side-brand { padding: 1em 1.1em; border-bottom: 1px solid #2c2c2c; }
.side-brand .brand-text { color: #fff; }
.nav { display: flex; flex-direction: column; padding: .5em; gap: 2px; flex: 1; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: .7em; padding: .65em .8em; color: #ddd; text-decoration: none; border-radius: 8px; }
.nav a:hover { background: #222; color: #fff; }
.nav a.active { background: var(--red); color: #fff; font-weight: 600; }
.nav-ic { width: 1.4em; text-align: center; }
.side-user { padding: 1em; border-top: 1px solid #2c2c2c; display: flex; align-items: center; justify-content: space-between; gap: .5em; }
.side-user .muted { color: #9a9a9a; }
.side-user .btn { background: transparent; color: #eee; border-color: #444; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75em; padding: .75em 1.25em; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 1.2em; margin: 0; }
.topbar .brand { display: none; }
.menu-btn { display: none; font-size: 1.3em; }
.page { padding: 1.25em; max-width: 1300px; width: 100%; }
.scrim { display: none; }

@media (max-width: 860px) {
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 30; transform: translateX(100%); transition: transform .2s; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
  .menu-btn { display: inline-block; }
  .topbar .brand { display: flex; }
  .page { padding: .75em; }
}

/* ---------- جداول ---------- */
.dt { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.dt-toolbar { display: flex; flex-wrap: wrap; gap: .5em; align-items: center; padding: .75em; border-bottom: 1px solid var(--line); }
.dt-search { flex: 1 1 200px; max-width: 320px; }
.dt-spacer { flex: 1; }
.dt-scroll { overflow-x: auto; }
.dt-table { width: 100%; border-collapse: collapse; }
.dt-table th, .dt-table td { padding: .6em .75em; text-align: start; border-bottom: 1px solid #efefef; vertical-align: middle; }
.dt-table thead th { background: #fafafa; font-weight: 600; font-size: .92em; color: #333; position: sticky; top: 0; white-space: nowrap; }
.dt-table th.sortable { cursor: pointer; user-select: none; }
.dt-table th.sortable:hover { color: var(--red-dark); }
.sort-ind { color: var(--red); font-size: .8em; }
.dt-filter-row th { padding: .35em .5em; background: #fff; }
.dt-filter { width: 100%; min-width: 80px; padding: .3em .5em !important; min-height: 32px !important; font-size: .9em; }
.dt-table tbody tr.clickable { cursor: pointer; }
.dt-table tbody tr:hover { background: #fff7f7; }
.dt-table tr.row-off td { color: #9a9a9a; }
.dt-empty { text-align: center !important; color: var(--muted); padding: 2em !important; }
.dt-actions { white-space: nowrap; text-align: end !important; }
.dt-actions > * { margin-inline-start: .25em; }
.al-num { text-align: end !important; font-variant-numeric: tabular-nums; }
.al-center { text-align: center !important; }
.dt-pager { display: flex; align-items: center; gap: .5em; padding: .6em .75em; }

/* على الموبايل: كل صف كارت */
@media (max-width: 640px) {
  .dt-table thead tr:first-child { display: none; }
  .dt-table, .dt-table tbody, .dt-table tr, .dt-table td { display: block; width: 100%; }
  .dt-filter-row { display: grid !important; grid-template-columns: 1fr 1fr; }
  .dt-table tbody tr { border-bottom: 6px solid var(--bg); padding: .4em 0; }
  .dt-table td { border: 0; display: flex; justify-content: space-between; gap: 1em; padding: .3em .9em; text-align: end !important; }
  .dt-table td::before { content: attr(data-label); color: var(--muted); font-size: .9em; text-align: start; }
  .dt-table td.dt-actions::before, .dt-table td.dt-empty::before { content: none; }
  .dt-search { max-width: none; flex-basis: 100%; }
}

.pill { display: inline-block; padding: .1em .65em; border-radius: 999px; background: #eee; font-size: .85em; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-off { background: #f0f0f0; color: #888; }
.pill-brand { background: var(--red-soft); color: var(--red-dark); font-weight: 600; }

/* ---------- نماذج ---------- */
input, select, textarea { font: inherit; border: 1px solid #cfcfcf; border-radius: 8px; padding: .5em .7em; background: #fff; color: inherit; min-height: 40px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px rgba(215,25,32,.12); }
input:disabled, select:disabled, textarea:disabled { background: #f3f3f3; color: #777; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--red); margin: 0; }
input[type=file] { padding: .35em; }
.form { display: grid; grid-template-columns: 1fr; gap: .9em; }
.modal-wide .form { grid-template-columns: 1fr 1fr; }
.modal-wide .form .full, .modal-wide .form .form-error, .modal-wide .form .form-intro { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .3em; }
.field label { font-weight: 600; font-size: .93em; }
.req { color: var(--red); }
.hint { font-size: .85em; color: var(--muted); }
.field-error { color: var(--red-dark); font-size: .87em; min-height: 0; }
.field-error:empty { display: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); background: #fff8f8; }
.form-error { background: var(--red-soft); color: var(--red-dark); border-radius: 8px; padding: .6em .8em; font-size: .93em; }
.form-intro { background: #f6f6f6; border-radius: 8px; padding: .6em .8em; font-size: .93em; }
.check { display: inline-flex; align-items: center; gap: .5em; cursor: pointer; font-weight: normal !important; }
.check.disabled { opacity: .5; cursor: not-allowed; }
.field-check { justify-content: center; }
.img-field { display: flex; flex-wrap: wrap; align-items: center; gap: .5em; }
.img-preview { max-height: 64px; max-width: 180px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }
.inline-input { width: 7em; min-height: 32px; padding: .2em .5em; display: inline-block; }
.fee-preview { background: #f7f7f7; border-radius: 8px; padding: .6em .8em; display: flex; flex-wrap: wrap; align-items: center; gap: .3em; }

/* ---------- الصلاحيات ---------- */
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75em; }
.perm-groups > p { grid-column: 1 / -1; margin: 0; }
.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: .5em .8em .8em; margin: 0; display: flex; flex-direction: column; gap: .45em; }
.perm-group legend { font-weight: 700; padding: 0 .3em; color: var(--red-dark); }
.ov-row { display: grid; grid-template-columns: auto 1fr; gap: .2em .5em; align-items: center; padding: .25em; border-radius: 6px; }
.ov-row .ov-sel { grid-column: 1 / -1; min-height: 34px; padding: .25em .5em; font-size: .9em; }
.ov-row.ov-set { background: #fff4f4; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--ok); }
.dot-off { background: #c9c9c9; }

/* ---------- نوافذ ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 1em; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 460px; max-height: calc(100vh - 2em); display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: .9em 1.1em; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 1.1em; }
.modal-body { padding: 1.1em; overflow-y: auto; }
.modal-foot { display: flex; gap: .5em; padding: .8em 1.1em; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .overlay { padding: 0; place-items: end stretch; }
  .modal, .modal-wide { max-width: none; border-radius: 14px 14px 0 0; max-height: 92vh; }
  .modal-wide .form { grid-template-columns: 1fr; }
}
.col-list { list-style: none; padding: 0; margin: 0 0 1em; border: 1px solid var(--line); border-radius: 8px; }
.col-list li { display: flex; align-items: center; gap: .5em; padding: .35em .6em; border-bottom: 1px solid #f0f0f0; }
.col-list li:last-child { border-bottom: 0; }

/* ---------- تبويبات وشرايح ---------- */
.tabs { display: flex; gap: .25em; border-bottom: 2px solid var(--line); margin-bottom: 1em; overflow-x: auto; }
.tab { font: inherit; background: none; border: 0; padding: .6em 1em; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab.active { border-color: var(--red); color: var(--red-dark); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: .4em; margin-bottom: .9em; }
.chip { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .3em .9em; cursor: pointer; display: inline-flex; gap: .5em; align-items: center; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip-n { background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 .5em; font-size: .85em; }
.chip.active .chip-n { background: var(--red); }

/* ---------- عرض البيانات ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .25em 2em; margin-bottom: 1em; }
.grid2 .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.kv-row { display: flex; justify-content: space-between; gap: 1em; padding: .55em 0; border-bottom: 1px dashed #eee; align-items: center; }
.kv-row b { font-weight: 600; text-align: end; white-space: pre-line; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .5em 1.5em; margin: 0 0 1.25em; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ---------- تحميل ورسايل ---------- */
.splash { display: grid; place-items: center; padding: 3em; }
.spinner { width: 34px; height: 34px; border: 3px solid #ddd; border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toasts { position: fixed; bottom: 1em; inset-inline-start: 50%; transform: translateX(50%); display: flex; flex-direction: column; gap: .5em; z-index: 100; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: .65em 1.1em; border-radius: 8px; box-shadow: var(--shadow); transition: opacity .3s; border-inline-start: 4px solid var(--ok); }
.toast-err { border-color: var(--red); }
.toast-info { border-color: #999; }
.toast.out { opacity: 0; }

/* ---------- المرحلة 2 ---------- */
.mono { font-family: Consolas, "Courier New", monospace; font-size: .92em; }
.txt-in { color: var(--ok); font-weight: 600; }
.txt-out { color: var(--red-dark); font-weight: 600; }
.pill-warn { background: #fff3d6; color: #8a5a00; }
.pill-bad { background: var(--red-soft); color: var(--red-dark); font-weight: 600; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: .6em 1em; display: flex; flex-direction: column; min-width: 150px; border-inline-start: 4px solid var(--ink); }
.stat b { font-size: 1.25em; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.stat.warn { border-color: #e0a100; }
.lines-table td { vertical-align: top; }
.lines-table input { min-height: 36px; padding: .3em .5em; }
.line-item { min-width: 260px; }
.line-num { width: 5em; }
.line-money { width: 8em; }
.lines-foot { display: flex; align-items: center; gap: .5em; padding: .6em 0 0; }
.lines-foot b { font-size: 1.15em; }
.lines-view tfoot th { background: #fafafa; }
@media (max-width: 640px) {
  .lines-table thead tr:first-child { display: none; }
  .lines-table td::before { content: none; }
  .lines-table tr { display: grid !important; grid-template-columns: 1fr 1fr auto auto; gap: .3em; padding: .5em 0; }
  .lines-table td { display: block; padding: 0 !important; }
  .lines-table td:first-child { grid-column: 1 / -1; }
  .line-item, .line-num, .line-money { width: 100%; min-width: 0; }
}
.mono, .nowrap { white-space: nowrap; }
.dt-table td .date-cell { white-space: nowrap; }

/* ---------- المرحلة 3: الكاشير ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(340px, 1fr); gap: 12px; align-items: start; }
.pos .card { margin: 0; padding: 1em; }
.pos-search { font-size: 1.05em; min-height: 46px; margin-bottom: .6em; }
.pos-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; max-height: calc(100vh - 230px); overflow-y: auto; padding: 2px; }
.pos-item { font: inherit; text-align: start; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .6em .7em; cursor: pointer; display: flex; flex-direction: column; gap: .25em; }
.pos-item:hover { border-color: var(--red); background: #fff8f8; }
.pos-item-name { font-weight: 600; }
.pos-item-meta { display: flex; justify-content: space-between; gap: .4em; align-items: center; font-size: .85em; }
.pos-item-price { font-weight: 700; color: var(--red-dark); text-align: start; unicode-bidi: plaintext; }
.pos-side { position: sticky; top: 70px; display: flex; flex-direction: column; gap: .7em; max-height: calc(100vh - 90px); overflow-y: auto; }
.pos-side-head { display: flex; justify-content: space-between; align-items: center; }
.pos-customer { display: flex; flex-direction: column; gap: .4em; }
.pos-row-btn { display: flex; gap: .4em; align-items: center; }
.pos-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .4em; }
.pos-empty { color: var(--muted); text-align: center; padding: 1.2em; border: 1px dashed var(--line); border-radius: 8px; }
.pos-cart-lines { display: flex; flex-direction: column; gap: .5em; }
.cart-line { border: 1px solid var(--line); border-radius: 8px; padding: .5em .6em; display: flex; flex-direction: column; gap: .35em; }
.cart-line-top { display: flex; justify-content: space-between; gap: .5em; }
.cart-name { font-weight: 600; }
.cart-line-bottom { display: flex; align-items: center; gap: .4em; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; }
.qty-in { width: 3.6em; text-align: center; min-height: 34px; padding: .2em; }
.stepper .qty-in { border: 0; }
.price-in { width: 7em; min-height: 34px; padding: .2em .4em; }
.serial-in { min-height: 34px; padding: .2em .5em; border-color: #e0a100; }
.tot-row { display: flex; justify-content: space-between; padding: .2em 0; }
.tot-row.big b { font-size: 1.35em; color: var(--red-dark); }
.tot-row.em b { color: var(--ink); }
.tot-row.warn b { color: #8a5a00; }
.pos-totals { border-top: 1px solid var(--line); padding-top: .5em; }
.pos-disc { display: grid; grid-template-columns: auto 5.5em 1fr; gap: .4em; align-items: center; }
.pos-disc select, .pos-disc input { min-height: 34px; padding: .2em .4em; }
.pos-pay { display: flex; flex-direction: column; gap: .4em; border-top: 1px solid var(--line); padding-top: .5em; }
.pay-head { display: flex; gap: .4em; align-items: center; }
.pay-head b { flex: 1; }
.pay-row { display: grid; grid-template-columns: 1fr 8em auto auto; gap: .4em; align-items: center; }
.pay-row select, .pay-row input { min-height: 38px; padding: .2em .5em; }
.pos-credit { background: #fff8e6; border-radius: 8px; padding: .4em .6em; }
.pos-due { display: flex; align-items: center; gap: .5em; font-size: .92em; }
.pos-due input { width: auto; min-height: 34px; padding: .2em .4em; }
.pos-submit { font-size: 1.1em; min-height: 50px; }
@media (max-width: 960px) {
  .pos { grid-template-columns: 1fr; }
  .pos-results { max-height: 45vh; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .pos-side { position: static; max-height: none; }
}
.ret-lines { display: flex; flex-direction: column; gap: .4em; margin-bottom: .5em; }
.ret-line { display: grid; grid-template-columns: 1fr auto auto auto; gap: .6em; align-items: center; border-bottom: 1px dashed var(--line); padding: .35em 0; }
@media (max-width: 640px) { .ret-line { grid-template-columns: 1fr auto auto; } .ret-line label { grid-column: 1 / -1; } }

/* ---------- البيان ---------- */
.receipt-wrap { display: flex; justify-content: center; background: #eee; padding: 12px; border-radius: 8px; }
.receipt { background: #fff; color: #000; font-size: 13px; line-height: 1.45; padding: 12px; width: 80mm; max-width: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.receipt.size-58mm { width: 58mm; font-size: 11.5px; }
.receipt.size-a4 { width: 190mm; font-size: 14px; }
.receipt.cancelled { background: repeating-linear-gradient(-45deg, #fff, #fff 14px, #fff2f2 14px, #fff2f2 28px); }
.r-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.r-head img { max-height: 56px; max-width: 70%; object-fit: contain; }
.r-shop { font-weight: 800; font-size: 1.15em; }
.r-title { text-align: center; font-weight: 800; margin: 6px 0; border-block: 1px dashed #000; padding: 3px 0; }
.r-kv { display: flex; justify-content: space-between; gap: 8px; }
.r-kv b { font-weight: 600; text-align: end; unicode-bidi: plaintext; }
.r-big b { font-size: 1.2em; font-weight: 800; }
.r-lines { width: 100%; border-collapse: collapse; margin: 6px 0; }
.r-lines th, .r-lines td { padding: 2px 4px; text-align: start; border-bottom: 1px dotted #999; vertical-align: top; }
.r-lines th { border-bottom: 1px solid #000; font-size: .9em; }
.r-lines td:nth-child(n+2), .r-lines th:nth-child(n+2) { text-align: end; white-space: nowrap; }
.r-sub td { font-size: .85em; color: #333; border-bottom: 1px dotted #999; }
.r-totals { border-top: 1px dashed #000; padding-top: 4px; }
.r-note { margin-top: 6px; font-size: .9em; }
.r-foot { text-align: center; margin-top: 8px; border-top: 1px dashed #000; padding-top: 4px; font-weight: 600; }
#print-area { display: none; }
@media print {
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  body.printing { background: #fff; }
  #print-area .receipt { box-shadow: none; padding: 0; }
  @page { margin: 4mm; }
}
.trade-box { display: flex; flex-direction: column; gap: .35em; margin-top: .4em; }
.trade-row { display: grid; grid-template-columns: 1fr auto auto; gap: .5em; align-items: center; background: #eef7f0; border-radius: 8px; padding: .3em .6em; }
.trade-row b { color: var(--ok); }
/* ---------- الخزنة ---------- */
.day-head { display: flex; flex-wrap: wrap; gap: .75em; align-items: center; justify-content: space-between; margin-bottom: .8em; }
.btn-row { display: flex; flex-wrap: wrap; gap: .4em; align-items: center; }
.inline-date { width: auto; min-height: 36px; padding: .2em .5em; }
.inline-lbl { display: inline-flex; align-items: center; gap: .3em; font-size: .92em; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.mini-card { margin: 0; }
.mini-card h3 { font-size: 1em; color: var(--red-dark); }
table.mini { width: 100%; border-collapse: collapse; }
table.mini th, table.mini td { padding: .35em .3em; border-bottom: 1px solid #f0f0f0; text-align: start; }
table.mini th { font-size: .85em; color: var(--muted); font-weight: 600; }
td.strong { font-weight: 700; }
tr.strike td { text-decoration: line-through; }

/* ---------- التقارير ---------- */
.reports { display: flex; flex-direction: column; gap: 10px; }
.rp-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: .7em .9em; }
.rp-f { display: flex; flex-direction: column; gap: 2px; font-size: .85em; color: var(--muted); }
.rp-f select, .rp-f input { min-height: 36px; padding: .2em .5em; width: auto; min-width: 120px; color: var(--ink); font-size: 1.08em; }
.rp-range { align-self: center; font-size: .9em; }
.rp-cmp { align-self: center; }
.rp-quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rp-quick:empty { display: none; }
.qchip { padding: 0; overflow: hidden; }
.chip-btn, .chip-x { font: inherit; background: none; border: 0; cursor: pointer; padding: .25em .7em; }
.chip-x { padding: .25em .5em; color: var(--muted); border-inline-start: 1px solid var(--line); }
.rp-tabs { align-items: center; flex-wrap: wrap; gap: .3em; margin-bottom: 0; }
.rp-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.w { margin: 0; padding: .9em 1em; display: flex; flex-direction: column; min-width: 0; }
.w-s { grid-column: span 1; } .w-m { grid-column: span 2; } .w-l { grid-column: span 4; }
@media (max-width: 1100px) { .rp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .w-m, .w-l { grid-column: span 2; } }
@media (max-width: 700px) { .rp-grid { grid-template-columns: 1fr; } .w-s, .w-m, .w-l { grid-column: span 1; } .rp-f select, .rp-f input { min-width: 0; } }
.w-head { display: flex; align-items: flex-start; gap: .4em; margin-bottom: .5em; }
.w-title { flex: 1; min-width: 0; }
.w-title h3 { font-size: 1em; margin: 0; }
.w-note { font-size: .82em; }
.w-tools { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.w-tools .icon-btn { color: var(--muted); font-size: .95em; }
.w-tools .icon-btn:hover { color: var(--ink); }
.w-tools .danger:hover { color: var(--red-dark); }
.w-size { width: auto; min-height: 30px; padding: 0 .3em; font-size: .85em; }
.w-drag { cursor: grab; color: var(--muted); font-size: 1.2em; padding: 0 .2em; }
.w.editing { outline: 2px dashed #d9d7d2; outline-offset: -2px; }
.w.dragging { opacity: .4; }
.w.drop { outline-color: var(--red); }
.w-body { min-height: 80px; transition: opacity .2s; }
.w-body.loading-dim { opacity: .45; }
.w-sub { font-size: .9em; margin: .8em 0 .3em; color: var(--muted); }
.rp-empty { grid-column: 1 / -1; text-align: center; padding: 2em; }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.cat-item { font: inherit; text-align: start; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: .7em .8em; cursor: pointer; display: flex; flex-direction: column; gap: .25em; }
.cat-item:hover { border-color: var(--red); background: #fff8f8; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .4em .8em; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.kpi { border: 1px solid #efeeea; border-radius: 10px; padding: .6em .75em; display: flex; flex-direction: column; gap: .15em; }
.kpi.snap { background: #fafaf8; }
.kpi-label { color: var(--muted); font-size: .88em; }
.kpi-value { font-size: 1.55em; font-weight: 700; text-align: start; unicode-bidi: plaintext; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: .4em; min-height: 26px; }
.kpi-hint { font-size: .78em; color: #9a9892; }
.delta { font-size: .82em; font-weight: 600; white-space: nowrap; direction: ltr; }
.delta.good { color: #006300; } .delta.bad { color: #b42318; } .delta.neutral { color: var(--muted); }
table.pnl { width: 100%; border-collapse: collapse; }
table.pnl td, table.pnl th { padding: .35em .3em; border-bottom: 1px solid #f0f0f0; text-align: start; }
table.pnl th { font-size: .85em; color: var(--muted); }
.pnl-subtotal td { font-weight: 700; background: #fafaf8; }
.pnl-total td { font-weight: 800; font-size: 1.08em; border-top: 2px solid var(--ink); }
tr.row-alert td { background: #fff4f4; }
a.wa { margin-inline-start: .4em; text-decoration: none; }
.dt-table.compact th, .dt-table.compact td { padding: .35em .5em; font-size: .9em; }

/* الرسومات */
.chart { position: relative; width: 100%; }
.chart-plot { width: 100%; }
.chart-svg { display: block; overflow: visible; font-family: inherit; }
.chart-svg .ax { font-size: 11px; fill: #6b6a66; font-variant-numeric: tabular-nums; }
.chart-svg .lbl { font-size: 12px; fill: #2a2a2a; }
.chart-svg .val { font-size: 11.5px; fill: #52514e; font-variant-numeric: tabular-nums; }
.chart-svg .end-label { font-size: 12px; fill: #2a2a2a; font-weight: 600; }
.chart-svg .donut-total { font-size: 18px; font-weight: 700; fill: #141414; }
.chart-svg .hit { cursor: crosshair; }
.chart-hbar .hit, .chart-bar .hit { cursor: pointer; }
.chart-svg .mark { transition: opacity .15s; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 6px; direction: rtl; }
.lg-item { font: inherit; font-size: .85em; background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); padding: 2px 0; }
.lg-item.off { opacity: .4; text-decoration: line-through; }
.lg-key.box { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.lg-key.line { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.chart-tip { position: fixed; z-index: 200; display: none; pointer-events: none; background: #fff; border: 1px solid #e4e3df; box-shadow: 0 6px 24px rgba(0,0,0,.12); border-radius: 8px; padding: .5em .7em; font-size: 13px; min-width: 140px; direction: rtl; }
.tip-title { color: var(--muted); font-size: .9em; margin-bottom: .25em; }
.tip-row { display: flex; align-items: center; gap: .5em; }
.tip-row b { font-variant-numeric: tabular-nums; }
.tip-name { color: var(--muted); font-size: .9em; }
.tip-key.line { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
.tip-key.box { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.spark { display: block; }
.w-empty { text-align: center; padding: 2em 0; }
table.rtable { width: 100%; border-collapse: collapse; font-size: .9em; }
table.rtable th, table.rtable td { padding: .35em .5em; border-bottom: 1px solid #f0f0f0; text-align: start; white-space: nowrap; }
table.rtable th { color: var(--muted); font-weight: 600; background: #fafaf8; position: sticky; top: 0; }
table.rtable td.al-num, table.rtable th.al-num { text-align: end; font-variant-numeric: tabular-nums; }
.w .dt-scroll { max-height: 420px; overflow: auto; }
@media (max-width: 700px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: .5em .6em; }
  .kpi-value { font-size: 1.3em; }
  .kpi .spark { width: 70px; }
  .w { padding: .7em; }
}

/* ---------- المرحلة 7: الضمان والـ QR ---------- */
.r-terms { margin-top: 6px; font-size: .85em; border-top: 1px dashed #000; padding-top: 4px; }
.r-qr { display: flex; align-items: center; gap: 8px; margin-top: 8px; border-top: 1px dashed #000; padding-top: 6px; font-size: .85em; font-weight: 600; }
.r-qr svg { flex: none; width: 26mm; height: 26mm; }
.receipt.size-58mm .r-qr svg { width: 22mm; height: 22mm; }
.cust-link { display: grid; gap: 10px; }
.qr-box { display: flex; justify-content: center; }
.qr-box svg { border: 1px solid var(--line, #ddd); border-radius: 8px; max-width: 100%; height: auto; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.w-search { display: flex; gap: 8px; margin-bottom: 12px; }
.w-search input { flex: 1; }
.w-card { border: 1px solid var(--line, #ddd); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--card, #fff); }
.w-card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.w-card-head b { font-size: 1.05em; }
.w-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0; font-size: .92em; }
.w-claims { margin: 6px 0 0; padding: 0; list-style: none; font-size: .9em; }
.w-claims li { padding: 3px 0; border-top: 1px dashed var(--line, #ddd); }
.w-off { background: #fff7e6; border: 1px solid #f0c36d; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.rule-src { font-size: .85em; }
.txt-warn { color: #9a6200; font-weight: 600; }
.inline-select { font: inherit; padding: .35em .5em; border: 1px solid var(--line); border-radius: 8px; background: var(--card, #fff); }
/* النسخة التجريبية */
.demo-login { background: #fff7e6; border: 1px solid #f0c36d; border-radius: 10px; padding: 12px; margin: 10px 0 4px; }
.demo-login p { margin: 4px 0 8px; font-size: .92em; }
.demo-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-tag { background: #f0a400; color: #1a1300; font-weight: 700; font-size: .8em; padding: .2em .7em; border-radius: 999px; margin-inline-end: 8px; white-space: nowrap; }
