/* =========================================================
   نظام المستودع — التصميم
   برتقالي هادئ + أبيض + أسود | موبايل أولاً
   ========================================================= */
:root {
  --orange: #e8893a;
  --orange-600: #cf7428;
  --orange-100: #fbe7d5;
  --orange-50: #fdf5ee;
  --black: #1a1a1a;
  --black-2: #2a2a2a;
  --white: #ffffff;
  --page: #f4f4f5;
  --line: #e7e7e9;
  --ink: #1a1a1a;
  --ink-2: #4a4a4f;
  --muted: #86868b;
  --success: #23945c;
  --success-50: #e9f6ef;
  --danger: #d0453b;
  --danger-50: #fcecea;
  --warning: #c98a07;
  --warning-50: #fdf5e1;
  --topbar-h: 60px;
  --bn-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --bs-body-font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--page);
  --bs-border-color: var(--line);
  --bs-primary: var(--orange);
  --bs-primary-rgb: 232, 137, 58;
  --bs-link-color: var(--orange-600);
  --bs-link-hover-color: var(--black);
}

* { -webkit-tap-highlight-color: transparent; }
html, body { overscroll-behavior-y: none; }
body {
  font-family: var(--bs-body-font-family);
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }
.num, .money { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.text-muted { color: var(--muted) !important; }
.min-w-0 { min-width: 0; }
:focus-visible { outline: 3px solid rgba(232, 137, 58, .55); outline-offset: 2px; }

/* ================= Shell ================= */
.app-shell { display: flex; min-height: 100dvh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--bn-h) + var(--safe-b) + 28px);
}
@media (min-width: 992px) {
  .app-content { padding: 24px 28px 40px; }
}

/* Sidebar (desktop) */
.sidebar {
  display: none;
  width: 264px;
  flex-shrink: 0;
  background: var(--black);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100dvh;
  flex-direction: column;
  padding: 18px 14px;
}
@media (min-width: 992px) { .sidebar { display: flex; } }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 8px 18px; }
.brand-name { font-weight: 700; font-size: 17px; line-height: 1.3; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: var(--orange); color: var(--black);
  display: grid; place-items: center; font-size: 20px; overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.side-nav { flex: 1; overflow-y: auto; scrollbar-width: none; }
.side-group { font-size: 12px; color: #8a8a8e; padding: 16px 12px 6px; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  color: #d4d4d8; padding: 10px 12px; border-radius: 12px; font-weight: 500;
}
.side-link i { font-size: 18px; width: 22px; text-align: center; }
.side-link:hover { background: var(--black-2); color: #fff; }
.side-link.active { background: var(--orange); color: var(--black); font-weight: 600; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid #2f2f33; margin-top: 10px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--orange-100); color: var(--orange-600);
  display: grid; place-items: center; font-weight: 700;
}
.avatar-sm { width: 30px; height: 30px; font-size: 14px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 1020;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 992px) { .topbar { padding: 0 28px; } }
.topbar-brand .brand-mark { width: 36px; height: 36px; }
.topbar-title { flex: 1; min-width: 0; margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  display: inline-grid; place-items: center; font-size: 19px; padding: 0;
}
.icon-btn:hover { background: var(--page); color: var(--ink); }
.icon-btn-dark { background: transparent; border-color: #333; color: #d4d4d8; }
.icon-btn-dark:hover { background: var(--black-2); color: #fff; }

.blur-toggle {
  height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px;
}
.blur-toggle.active { background: var(--black); color: var(--orange); border-color: var(--black); }

/* Bottom nav (mobile) */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 1030;
  height: calc(var(--bn-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--black);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
@media (min-width: 992px) { .bottom-nav { display: none; } }
.bn-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #9a9aa0; font-size: 11px; font-weight: 500; height: 100%; position: relative;
}
.bn-item i { font-size: 21px; line-height: 1; }
.bn-item.active { color: #fff; }
.bn-item.active::before {
  content: ''; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--orange);
}
.bn-sale { display: flex; flex-direction: column; align-items: center; color: #fff; font-size: 11px; font-weight: 600; gap: 2px; }
.bn-sale-btn {
  width: 52px; height: 52px; margin-top: -22px; border-radius: 16px;
  background: var(--orange); color: var(--black);
  display: grid; place-items: center; font-size: 26px;
  box-shadow: 0 0 0 5px var(--black);
}

/* ================= Dashboard tiles ================= */
.welcome { margin: 4px 2px 6px; }
.welcome-hello { font-size: 22px; font-weight: 700; margin: 0; }
.section-title { font-size: 14px; font-weight: 600; color: var(--muted); margin: 22px 2px 10px; }
.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 380px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) { .tile-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
@media (min-width: 1200px) { .tile-grid { grid-template-columns: repeat(6, 1fr); } }

/* المربعات مستوحاة من لوحة مفاتيح الكهرباء: إطار + زر داخلي + لمبة مؤشر */
.tile {
  position: relative; aspect-ratio: 1 / 1;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 8px; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  text-align: center; transition: transform .12s ease, border-color .12s ease;
}
.tile::after {
  content: ''; position: absolute; inset: 7px; border-radius: 15px;
  border: 1px solid #f0f0f2; pointer-events: none;
}
.tile:hover { border-color: #d6d6da; color: var(--ink); }
.tile:active { transform: scale(.96); }
.tile-led {
  position: absolute; top: 14px; inset-inline-start: 14px;
  width: 7px; height: 7px; border-radius: 50%; background: #d9d9dc;
}
.tile:hover .tile-led, .tile-primary .tile-led { background: var(--orange); box-shadow: 0 0 0 3px rgba(232, 137, 58, .2); }
.tile-icon {
  width: 50px; height: 50px; border-radius: 15px;
  background: var(--orange-50); color: var(--orange-600);
  display: grid; place-items: center; font-size: 24px;
}
@media (min-width: 992px) { .tile { aspect-ratio: 5 / 4; } }
.tile-label { font-weight: 600; font-size: 14px; line-height: 1.35; }
.tile-primary { background: var(--black); border-color: var(--black); color: #fff; }
.tile-primary::after { border-color: #2e2e31; }
.tile-primary:hover { color: #fff; border-color: var(--black); }
.tile-primary .tile-icon { background: var(--orange); color: var(--black); }

/* ================= Common blocks ================= */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; font-weight: 700; margin: 0; }

.box { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
.box-pad { padding: 16px; }
.box-title { font-size: 16px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.box-title i { color: var(--orange-600); }

.toolbar { position: sticky; top: var(--topbar-h); z-index: 1010; background: var(--page); padding: 6px 0 10px; margin: -6px 0 6px; }
.search {
  position: relative;
}
.search i.bi-search { position: absolute; top: 50%; inset-inline-start: 14px; transform: translateY(-50%); color: var(--muted); font-size: 17px; pointer-events: none; }
.search .form-control { padding-inline-start: 42px; height: 50px; border-radius: var(--r-md); font-size: 16px; background: #fff; }
.search .search-clear { position: absolute; top: 50%; inset-inline-end: 8px; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font-size: 20px; display: none; }
.search.has-value .search-clear { display: block; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 1px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.chip.active { background: var(--black); border-color: var(--black); color: #fff; }
.chip .count { opacity: .6; margin-inline-start: 4px; }
.custom-range { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.custom-range .form-control { max-width: 170px; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 768px) { .kpis { grid-template-columns: repeat(4, 1fr); gap: 12px; } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; min-width: 0; }
.kpi-label { font-size: 13px; color: var(--muted); margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 20px; font-weight: 700; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-dark { background: var(--black); border-color: var(--black); color: #fff; }
.kpi-dark .kpi-label { color: #a1a1a6; }
.kpi-orange { background: var(--orange); border-color: var(--orange); color: var(--black); }
.kpi-orange .kpi-label { color: rgba(0, 0, 0, .6); }

.list { display: flex; flex-direction: column; gap: 8px; }
.row-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px; display: flex; align-items: center; gap: 12px; color: var(--ink);
}
a.row-card:hover { border-color: #d3d3d7; color: var(--ink); }
.row-card .grow { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { text-align: end; flex-shrink: 0; }
.thumb { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; background: var(--page); flex-shrink: 0; border: 1px solid var(--line); }
.thumb-lg { width: 76px; height: 76px; }
.thumb-ph { display: grid; place-items: center; color: #b4b4b8; font-size: 22px; }

.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill-muted { background: var(--page); color: var(--ink-2); }
.pill-ok { background: var(--success-50); color: var(--success); }
.pill-bad { background: var(--danger-50); color: var(--danger); }
.pill-warn { background: var(--warning-50); color: var(--warning); }
.pill-orange { background: var(--orange-50); color: var(--orange-600); }
.pill-dark { background: var(--black); color: #fff; }

.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-orange { color: var(--orange-600) !important; }

.empty {
  text-align: center; padding: 40px 16px; color: var(--muted);
  background: #fff; border: 1px dashed #d8d8dc; border-radius: var(--r-md);
}
.empty i { font-size: 38px; color: #c4c4c8; display: block; margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }

.skeleton { background: linear-gradient(90deg, #ececee 25%, #f6f6f7 37%, #ececee 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--r-md); }
.skeleton-row { height: 78px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.load-more { display: block; margin: 14px auto 0; }

.fab {
  position: fixed; z-index: 1025;
  inset-inline-end: 16px; bottom: calc(var(--bn-h) + var(--safe-b) + 16px);
  width: 58px; height: 58px; border-radius: 18px; border: 0;
  background: var(--orange); color: var(--black); font-size: 28px;
  display: grid; place-items: center; box-shadow: 0 8px 22px rgba(232, 137, 58, .35);
}
@media (min-width: 992px) { .fab { display: none; } }

/* ================= Buttons & forms ================= */
.btn { border-radius: 12px; font-weight: 600; padding: 9px 16px; }
.btn-lg { border-radius: 14px; padding: 12px 20px; font-size: 16px; }
.btn-sm { border-radius: 10px; padding: 6px 12px; }
.btn-brand { background: var(--orange); border-color: var(--orange); color: var(--black); }
.btn-brand:hover, .btn-brand:focus { background: var(--orange-600); border-color: var(--orange-600); color: var(--black); }
.btn-brand:disabled { background: var(--orange); border-color: var(--orange); color: rgba(0, 0, 0, .55); }
.btn-dark { background: var(--black); border-color: var(--black); }
.btn-soft { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-soft:hover { background: var(--page); color: var(--ink); border-color: #d6d6da; }
.btn-soft-danger { background: var(--danger-50); color: var(--danger); border: 0; }
.btn-soft-danger:hover { background: #f8d9d5; color: var(--danger); }
.btn-wa { background: #25d366; border-color: #25d366; color: #083d1f; }
.btn-wa:hover { background: #1fb957; border-color: #1fb957; color: #083d1f; }
.btn:not(.btn-icon):not(.icon-btn) > i.bi:first-child { margin-inline-end: 5px; }
.btn-icon { width: 42px; height: 42px; padding: 0; display: inline-grid; place-items: center; font-size: 18px; }
.btn-add-sale { width: 44px; height: 44px; border-radius: 13px; padding: 0; font-size: 22px; display: inline-grid; place-items: center; }

.form-label { font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--ink-2); }
.form-control, .form-select { border-radius: 12px; border-color: #dcdce0; min-height: 46px; font-size: 16px; background-color: #fff; }
.form-control:focus, .form-select:focus { border-color: var(--orange); box-shadow: 0 0 0 .22rem rgba(232, 137, 58, .2); }
.form-control:disabled { background: var(--page); }
.form-check-input:checked { background-color: var(--orange); border-color: var(--orange); }
.form-check-input:focus { box-shadow: 0 0 0 .22rem rgba(232, 137, 58, .2); border-color: var(--orange); }
.form-text { color: var(--muted); }
.input-group-text { border-radius: 12px; background: var(--page); border-color: #dcdce0; }
.required::after { content: ' *'; color: var(--danger); }
input[type=number]::-webkit-inner-spin-button { opacity: .4; }
.lock-note { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 4px; }

.img-drop {
  display: flex; align-items: center; gap: 12px; padding: 10px;
  border: 1.5px dashed #d0d0d5; border-radius: var(--r-md); background: #fafafa; cursor: pointer;
}
.img-drop img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: #eee; }
.img-drop .ph { width: 64px; height: 64px; border-radius: 10px; background: #eee; display: grid; place-items: center; font-size: 24px; color: #aaa; }
.img-drop input { display: none; }

/* Modals */
.modal-content { border: 0; border-radius: var(--r-lg); }
.modal-header { border-bottom: 1px solid var(--line); padding: 14px 18px; }
.modal-title { font-weight: 700; font-size: 18px; }
.modal-footer { border-top: 1px solid var(--line); padding: 12px 18px; }
@media (max-width: 575.98px) {
  .modal-fullscreen-sm-down .modal-content { border-radius: 0; }
  .modal-fullscreen-sm-down .modal-footer { padding-bottom: calc(12px + var(--safe-b)); }
  .modal-fullscreen-sm-down .modal-footer .btn { flex: 1; }
}

/* Tabs */
.seg { display: flex; background: #e9e9eb; border-radius: 14px; padding: 4px; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.seg .nav-link { flex: 1; white-space: nowrap; border-radius: 10px; color: var(--ink-2); font-weight: 600; padding: 9px 12px; text-align: center; font-size: 14px; }
.seg .nav-link.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; }
.table-clean { margin: 0; font-size: 14px; }
.table-clean th { background: #fafafa; color: var(--ink-2); font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--line); padding: 10px 12px; }
.table-clean td { padding: 10px 12px; vertical-align: middle; border-color: #f0f0f2; }
.table-clean tfoot td { background: #fafafa; font-weight: 700; }

/* ================= Privacy blur ================= */
.sensitive { transition: filter .2s ease; }
body.privacy-on .sensitive { filter: blur(8px); user-select: none; pointer-events: none; }

/* ================= Products ================= */
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; } }
@media (min-width: 1200px) { .product-grid { grid-template-columns: repeat(5, 1fr); } }
.p-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; color: var(--ink); display: flex; flex-direction: column; }
.p-card:hover { border-color: #d3d3d7; color: var(--ink); }
.p-card-img { aspect-ratio: 4 / 3; background: #f4f4f5; object-fit: cover; width: 100%; display: block; }
.p-card-img.ph { display: grid; place-items: center; color: #c0c0c4; font-size: 34px; }
.p-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.p-card-name { font-weight: 600; font-size: 14.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.p-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.p-card-price { font-weight: 700; font-size: 15px; }

.product-hero { display: grid; gap: 16px; }
@media (min-width: 768px) { .product-hero { grid-template-columns: 300px 1fr; } }
.product-hero-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--r-md); background: #f0f0f2; border: 1px solid var(--line); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--page); border-radius: 12px; padding: 10px 12px; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 18px; font-weight: 700; }
.stat-big .stat-value { font-size: 26px; }

/* ================= Shops ================= */
.balance-tag { font-weight: 700; font-size: 14px; }
.shop-hero { display: flex; gap: 14px; align-items: center; }
.shop-hero img, .shop-hero .ph { width: 84px; height: 84px; border-radius: 16px; object-fit: cover; background: var(--page); border: 1px solid var(--line); flex-shrink: 0; }
.debt-box { background: var(--black); color: #fff; border-radius: var(--r-md); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.debt-box .v { font-size: 24px; font-weight: 700; color: var(--orange); }
.action-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 576px) { .action-row { display: flex; flex-wrap: wrap; } }

.map-box { height: 340px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: #eaeaea; }
.map-box-lg { height: 60vh; min-height: 380px; }
.place-search-wrap { margin-bottom: 10px; }
.place-search-wrap gmp-place-autocomplete { width: 100%; }
.map-info { font-family: var(--bs-body-font-family); direction: rtl; text-align: right; min-width: 210px; }
.map-info h6 { font-weight: 700; margin-bottom: 4px; }
.map-info table { width: 100%; font-size: 13px; }
.map-info td { padding: 2px 0; }
.map-info td:last-child { text-align: left; font-weight: 600; }

/* ================= POS ================= */
.pos { display: grid; gap: 14px; }
@media (min-width: 992px) { .pos { grid-template-columns: 1fr 380px; align-items: start; } .pos-side { position: sticky; top: calc(var(--topbar-h) + 20px); } }
.pos-shop { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--black); color: #fff; border-radius: var(--r-md); padding: 12px 14px; }
.pos-shop .name { font-weight: 700; font-size: 16px; }
.pos-search { position: relative; }
.pos-results {
  position: absolute; top: calc(100% + 6px); inset-inline: 0; z-index: 1015;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .12); max-height: 58vh; overflow-y: auto; display: none;
}
.pos-results.show { display: block; }
.pos-result { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f2f2f4; cursor: pointer; width: 100%; background: none; border-inline: 0; border-top: 0; text-align: start; }
.pos-result:hover, .pos-result.focus { background: var(--orange-50); }
.pos-result.disabled { opacity: .5; cursor: not-allowed; }
.pos-result .thumb { width: 44px; height: 44px; }

.cart-item { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.cart-item.over { border-color: var(--danger); background: #fffafa; }
.cart-top { display: flex; gap: 10px; align-items: flex-start; }
.cart-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.qty { display: inline-flex; align-items: center; border: 1px solid #dcdce0; border-radius: 12px; overflow: hidden; background: #fff; }
.qty button { width: 42px; height: 42px; border: 0; background: var(--page); font-size: 20px; color: var(--ink); }
.qty button:active { background: var(--orange-100); }
.qty input { width: 64px; height: 42px; border: 0; text-align: center; font-weight: 700; font-size: 17px; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; background: var(--orange-50); }

.summary-line { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 15px; }
.summary-line + .summary-line { border-top: 1px dashed #ececef; }
.summary-line.total { font-size: 18px; font-weight: 700; }
.summary-line.grand { background: var(--black); color: #fff; border-radius: 12px; padding: 10px 12px; margin: 8px 0; border: 0; font-weight: 700; }
.summary-line.grand .money { color: var(--orange); font-size: 20px; }
.quick-pay { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick-pay .btn { flex: 1; font-size: 13px; padding: 7px 8px; white-space: nowrap; }
.pay-result { border-radius: 12px; padding: 10px 12px; margin-top: 10px; background: var(--orange-50); font-size: 14px; }
.paid-input { font-size: 22px !important; font-weight: 700; height: 56px; text-align: center; }

.checkout-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 1030;
  background: var(--black); color: #fff;
  padding: 10px 14px calc(10px + var(--safe-b));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.checkout-bar .t { font-size: 12px; color: #a1a1a6; }
.checkout-bar .v { font-size: 20px; font-weight: 700; color: var(--orange); }
@media (min-width: 992px) { .checkout-bar { display: none; } }
body.pos-page .app-content { padding-bottom: calc(90px + var(--safe-b)); }

/* ================= Invoice ================= */
.invoice-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.invoice-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.invoice-paper { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 22px; max-width: 860px; margin: 0 auto; position: relative; overflow: hidden; }
@media (max-width: 575.98px) { .invoice-paper { padding: 14px; } }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 14px; border-bottom: 3px solid var(--black); }
.inv-brand { display: flex; align-items: center; gap: 10px; }
.inv-brand img { max-height: 56px; max-width: 140px; object-fit: contain; }
.inv-brand h2 { font-size: 20px; font-weight: 700; margin: 0; }
.inv-no { text-align: end; }
.inv-no .label { background: var(--orange); color: var(--black); font-weight: 700; padding: 3px 12px; border-radius: 8px; display: inline-block; }
.inv-no .n { font-size: 22px; font-weight: 700; margin-top: 4px; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
@media (max-width: 575.98px) { .inv-parties { grid-template-columns: 1fr; } }
.inv-party { background: var(--page); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.inv-party .t { font-size: 12px; color: var(--muted); }
.inv-party .name { font-weight: 700; font-size: 16px; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.inv-table th { background: var(--black); color: #fff; font-weight: 600; padding: 9px 10px; text-align: start; white-space: nowrap; }
.inv-table th:first-child { border-start-start-radius: 10px; border-end-start-radius: 10px; }
.inv-table th:last-child { border-start-end-radius: 10px; border-end-end-radius: 10px; }
.inv-table td { padding: 9px 10px; border-bottom: 1px solid #eeeef0; }
.inv-table .c { text-align: center; }
.inv-table .e { text-align: end; }
.inv-totals { margin-top: 14px; margin-inline-start: auto; max-width: 380px; }
.inv-totals .summary-line { font-size: 15px; }
.inv-footer { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 13px; }
.inv-stamp {
  position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg);
  border: 4px solid var(--danger); color: var(--danger); font-size: 44px; font-weight: 700;
  padding: 4px 26px; border-radius: 14px; opacity: .22; pointer-events: none; white-space: nowrap;
}
.inv-items-mobile { display: none; }
@media (max-width: 575.98px) {
  .inv-table-wrap { display: none; }
  .inv-items-mobile { display: block; }
  .inv-mitem { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eeeef0; font-size: 14px; }
}
.public-bar { position: sticky; top: 0; z-index: 10; background: var(--black); color: #fff; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.public-body { background: var(--page); min-height: 100dvh; }
.public-wrap { padding: 16px; }

/* ================= Cheques ================= */
.cheque-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 768px) { .cheque-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .cheque-grid { grid-template-columns: repeat(3, 1fr); } }
.cheque-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; }
.cheque-img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; background: #efefef; cursor: zoom-in; display: block; border: 0; padding: 0; }
.cheque-img img { width: 100%; height: 100%; object-fit: cover; }
.cheque-body { padding: 12px; }
.cheque-amount { font-size: 22px; font-weight: 700; }

/* ================= Auth ================= */
.auth-body { min-height: 100dvh; background: var(--black); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 28px 22px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 64px; height: 64px; border-radius: 18px; font-size: 32px; margin: 0 auto 12px; }
.auth-brand h1 { font-size: 22px; font-weight: 700; margin: 0; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; top: 50%; inset-inline-start: 14px; transform: translateY(-50%); color: var(--muted); font-size: 18px; }
.input-icon .form-control { padding-inline-start: 44px; height: 54px; }
.input-icon .toggle-pass { position: absolute; top: 50%; inset-inline-end: 6px; transform: translateY(-50%); border: 0; background: none; color: var(--muted); font-size: 19px; width: 42px; height: 42px; }
.grecaptcha-badge { visibility: hidden; }
.recaptcha-note { font-size: 11.5px; color: var(--muted); text-align: center; margin: 14px 0 0; }

/* ================= SweetAlert ================= */
.swal2-popup { font-family: var(--bs-body-font-family) !important; border-radius: 20px !important; }
.swal2-title { font-size: 20px !important; }
.swal2-html-container { font-size: 15px !important; }
.swal2-styled.swal2-confirm { background: var(--orange) !important; color: var(--black) !important; border-radius: 12px !important; font-weight: 700 !important; }
.swal2-styled.swal2-confirm.danger { background: var(--danger) !important; color: #fff !important; }
.swal2-styled.swal2-cancel { background: var(--page) !important; color: var(--ink) !important; border-radius: 12px !important; font-weight: 600 !important; }
.swal2-input, .swal2-textarea, .swal2-select { border-radius: 12px !important; font-family: inherit !important; }
.confirm-table { width: 100%; text-align: start; font-size: 15px; }
.confirm-table td { padding: 7px 4px; border-bottom: 1px dashed #e5e5e8; }
.confirm-table td:last-child { text-align: end; font-weight: 700; }
.confirm-table tr.hl td { background: var(--orange-50); }
.confirm-table tr.dark td { background: var(--black); color: #fff; }
.confirm-table tr.dark td:last-child { color: var(--orange); }

.selection-bar {
  position: fixed; inset-inline: 12px; bottom: calc(var(--bn-h) + var(--safe-b) + 12px); z-index: 1026;
  background: var(--black); color: #fff; border-radius: 16px; padding: 10px 14px;
  display: none; align-items: center; gap: 10px; justify-content: space-between;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}
.selection-bar.show { display: flex; }
@media (min-width: 992px) { .selection-bar { inset-inline-start: 290px; bottom: 20px; } }

.diff-neg { color: var(--danger); font-weight: 700; }
.diff-pos { color: var(--success); font-weight: 700; }
.count-input { width: 96px; text-align: center; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= Print / PDF ================= */
@media print {
  @page { size: A4; margin: 10mm; }
  body, .public-body { background: #fff !important; }
  .sidebar, .topbar, .bottom-nav, .fab, .no-print, .public-bar, .checkout-bar, .selection-bar, .swal2-container { display: none !important; }
  .app-content, .public-wrap { padding: 0 !important; max-width: none !important; }
  .invoice-paper { border: 0; border-radius: 0; padding: 0; max-width: none; }
  .inv-table-wrap { display: block !important; }
  .inv-items-mobile { display: none !important; }
  .inv-parties { grid-template-columns: 1fr 1fr !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.privacy-on .sensitive { filter: none; }
}
.input-icon .form-control[dir=ltr] { padding-left: 14px; padding-right: 44px; }
