/* ==========================================================
   DR FIT ZONE — نظام إدارة المتجر
   ========================================================== */
:root {
  --font: 'Cairo', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e8ef;
  --border-strong: #d3d9e3;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --primary: #15803d;
  --primary-hover: #166534;
  --primary-soft: #ecfdf3;
  --primary-ring: rgba(21, 128, 61, 0.18);
  --lime: #a3e635;
  --danger: #dc2626;
  --danger-text: #b91c1c;
  --danger-soft: #fef2f2;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --violet: #6d28d9;
  --violet-soft: #f5f3ff;
  --sidebar-bg: #0b1220;
  --sidebar-text: #a7b1c2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.2);
  --topbar-h: 64px;
  --sidebar-w: 262px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.35; }
img, svg { flex-shrink: 0; }
[hidden] { display: none !important; }
::selection { background: rgba(163, 230, 53, 0.45); }

.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.bold { font-weight: 700; }
.text-green { color: var(--primary); }
.text-red { color: var(--danger-text); }
.text-amber { color: var(--warning); }
.text-blue { color: var(--info); }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.mt-lg { margin-top: 22px; }
.w-auto { width: auto !important; }
.grow { flex: 1 1 auto; }
.spacer { flex: 1 1 auto; }
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* ---------------- Layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
  overflow-y: auto;
  z-index: 40;
  scrollbar-width: thin;
  scrollbar-color: #1f2a40 transparent;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--lime);
  color: #0b1220;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(163, 230, 53, 0.22);
}
.brand-name { color: #fff; font-weight: 800; font-size: 16px; letter-spacing: 0.4px; line-height: 1.2; direction: ltr; text-align: right; }
.brand-sub { font-size: 12px; color: var(--sidebar-text); display: flex; align-items: center; gap: 6px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 3px rgba(163, 230, 53, 0.18); display: inline-block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  font-size: 11.5px;
  font-weight: 700;
  color: #5d6b82;
  padding: 14px 12px 6px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-weight: 600;
  font-size: 14px;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav a.active { background: rgba(163, 230, 53, 0.11); color: #fff; }
.nav a.active .ic { color: var(--lime); }
.nav a.active::before {
  content: '';
  position: absolute;
  inset-inline-start: -14px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 4px;
  background: var(--lime);
}
.nav-badge {
  margin-inline-start: auto;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 0 7px;
  line-height: 19px;
  min-width: 20px;
  text-align: center;
}
.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.user-card { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; }
.user-card .who { min-width: 0; flex: 1; }
.user-card b { display: block; color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card small { font-size: 12px; color: var(--sidebar-text); }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #1c2740;
  color: var(--lime);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}
.sidebar .icon-btn { color: var(--sidebar-text); }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.clock { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.menu-btn { display: none !important; }
.content { padding: 24px; width: 100%; max-width: 1480px; margin: 0 auto; }
.content.wide { max-width: none; padding: 16px; }
.sidebar-overlay { display: none; }

/* ---------------- Cards / KPIs ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-head h3 { font-size: 15.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card-head h3 .ic { color: var(--muted); }
.card-head .link { font-size: 13px; font-weight: 700; color: var(--primary); }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.section { margin-top: 16px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  display: flex;
  gap: 13px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #f1f5f9;
  color: #475569;
}
.kpi-main { min-width: 0; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-value { font-size: 21px; font-weight: 800; line-height: 1.3; margin-top: 2px; white-space: nowrap; }
.kpi-value .cur { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.tone-green .kpi-icon { background: var(--primary-soft); color: var(--primary); }
.tone-blue .kpi-icon { background: var(--info-soft); color: var(--info); }
.tone-amber .kpi-icon { background: var(--warning-soft); color: var(--warning); }
.tone-red .kpi-icon { background: var(--danger-soft); color: var(--danger); }
.tone-violet .kpi-icon { background: var(--violet-soft); color: var(--violet); }
.kpi.highlight {
  background: linear-gradient(140deg, #0b1220 0%, #16213a 100%);
  border-color: #0b1220;
  color: #fff;
}
.kpi.highlight .kpi-label, .kpi.highlight .kpi-sub, .kpi.highlight .kpi-value .cur { color: #b8c2d3; }
.kpi.highlight .kpi-icon { background: rgba(163, 230, 53, 0.14); color: var(--lime); }
.kpi.highlight.neg .kpi-icon { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.delta { font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--primary); }
.delta.down { color: var(--danger-text); }
.kpi.highlight .delta.up { color: var(--lime); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
  user-select: none;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: #c2c9d6; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-dark { background: #0f172a; border-color: #0f172a; color: #fff; }
.btn-dark:hover { background: #1e293b; border-color: #1e293b; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger-text); border-color: #fecaca; }
.btn-danger-soft:hover { background: #fee2e2; border-color: #fca5a5; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: #eef1f6; border-color: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; gap: 6px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15.5px; }
.btn-xl { height: 58px; font-size: 18px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: #eef1f6; color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn.success:hover { background: var(--primary-soft); color: var(--primary); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }

/* ---------------- Forms ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.hint { font-size: 12px; color: var(--muted); font-weight: 500; }
.req { color: var(--danger); font-style: normal; }
.input, .select, .textarea {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 14.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input[disabled], .select[disabled] { background: #f1f5f9; color: var(--muted); }
.input-sm, .select.input-sm { height: 36px; font-size: 13.5px; border-radius: 9px; }
.input-lg { height: 48px; font-size: 15.5px; }
.input-xs { height: 28px; font-size: 13px; padding: 0 6px; border-radius: 7px; }
input[type='date'] { direction: ltr; text-align: right; }
input[type='number'] { -moz-appearance: textfield; }
input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 11px center;
  padding-inline-end: 34px;
  cursor: pointer;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.search { position: relative; min-width: 0; }
.search > .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search .input { padding-inline-start: 38px; }
.search-lg > .ic { inset-inline-start: 14px; }
.search-lg .input { padding-inline-start: 44px; }
.seg { display: inline-flex; background: #eef1f6; padding: 4px; border-radius: 11px; gap: 4px; flex-wrap: wrap; }
.seg button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
}
.seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row b { display: block; font-size: 14px; }
.switch-row small { color: var(--muted); font-size: 12.5px; }
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 46px;
  height: 26px;
  background: #cbd5e1;
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  margin: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: right 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.switch:checked { background: var(--primary); }
.switch:checked::after { right: 23px; }
.switch:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }

/* ---------------- Toolbar / page head ---------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 240px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { font-size: 22px; font-weight: 800; }
.page-head p { color: var(--muted); margin-top: 2px; }
.period-picker { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.period-picker .select { width: auto; min-width: 150px; }
.period-picker .custom-range { display: flex; gap: 6px; align-items: center; }
.period-picker .custom-range .input { width: 150px; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap.scroll { max-height: 70vh; overflow: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: start;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 700;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: #fafbfd; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.table .actions { white-space: nowrap; text-align: end; width: 1%; }
.table tr.clickable { cursor: pointer; }
.table.compact td, .table.compact th { padding: 8px 12px; }
.card > .table-wrap > .table th:first-child { border-start-start-radius: var(--radius); }
.card > .table-wrap > .table th:last-child { border-start-end-radius: var(--radius); }
.cell-main { font-weight: 700; line-height: 1.4; }
.cell-sub { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.t-end { text-align: end !important; }
.t-center { text-align: center !important; }
.qty-pos { color: var(--primary); font-weight: 800; }
.qty-neg { color: var(--danger-text); font-weight: 800; }
.row-muted td { opacity: 0.6; }

/* ---------------- Badges / tabs / chips ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: #f1f5f9;
  color: #475569;
  line-height: 1;
}
.badge-green { background: var(--primary-soft); color: #15803d; }
.badge-red { background: var(--danger-soft); color: var(--danger-text); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }
.badge-blue { background: var(--info-soft); color: var(--info); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-dark { background: #0f172a; color: #fff; }
.badge .ic { width: 13px; height: 13px; }
.swatch { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #e8ebf1;
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  margin-bottom: 18px;
  scrollbar-width: none;
}
.tab {
  border: 0;
  background: transparent;
  padding: 8px 16px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.tab:hover { color: var(--text); }
.tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.chip {
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 999px;
  padding: 5px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover { border-color: #b6bfcd; }
.chip.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.chip small { opacity: 0.7; font-weight: 600; }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.18s;
  overflow-y: auto;
}
.modal-backdrop.show { opacity: 1; }
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.18s;
  display: flex;
  flex-direction: column;
  margin: auto 0;
}
.modal-backdrop.show .modal { transform: none; }
.modal-sm { max-width: 430px; }
.modal-lg { max-width: 840px; }
.modal-xl { max-width: 1180px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; font-weight: 800; }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 16px 16px;
}
body.modal-open { overflow: hidden; }
.confirm-msg { font-size: 15px; line-height: 1.8; }

/* ---------------- Toasts ---------------- */
#toasts { position: fixed; bottom: 20px; left: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 440px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: none; }
.toast-success .ic { color: var(--lime); }
.toast-error { background: #991b1b; }
.toast-warning { background: #92400e; }

/* ---------------- States ---------------- */
.spinner { width: 34px; height: 34px; border: 3px solid #e2e8f0; border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.page-loading { display: grid; place-items: center; min-height: 260px; width: 100%; grid-column: 1 / -1; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); grid-column: 1 / -1; }
.empty .empty-ic { width: 62px; height: 62px; border-radius: 18px; background: #f1f5f9; display: grid; place-items: center; margin: 0 auto 14px; color: #94a3b8; }
.empty h4 { color: var(--text); font-size: 16px; margin-bottom: 4px; font-weight: 800; }
.empty p { max-width: 420px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }
.error-box { background: var(--danger-soft); color: var(--danger-text); border: 1px solid #fecaca; padding: 14px 16px; border-radius: 12px; font-weight: 600; }
.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--info-soft);
  color: #1e3a8a;
  font-size: 13.5px;
  font-weight: 600;
}
.note.amber { background: var(--warning-soft); color: #78350f; }
.note.green { background: var(--primary-soft); color: #14532d; }
.note .ic { margin-top: 2px; }

/* ---------------- Lists ---------------- */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-sub { font-size: 12.5px; color: var(--muted); }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: #fafbfd; }
.li-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: #f1f5f9; color: #475569; }
.rank { width: 26px; height: 26px; border-radius: 8px; background: #f1f5f9; display: grid; place-items: center; font-weight: 800; font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.rank.r1 { background: #fef3c7; color: #92400e; }
.rank.r2 { background: #e2e8f0; color: #334155; }
.rank.r3 { background: #ffedd5; color: #9a3412; }

/* ---------------- Charts ---------------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart text { font-family: var(--font); }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: #0f172a;
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  z-index: 5;
  transform: translate(-50%, calc(-100% - 12px));
  opacity: 0;
  transition: opacity 0.12s;
  line-height: 1.7;
}
.chart-tip b { font-weight: 800; }
.chart-tip .row { display: flex; gap: 14px; justify-content: space-between; align-items: center; }
.chart-tip i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-inline-end: 6px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); font-weight: 600; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-inline-end: 6px; vertical-align: -1px; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; margin-bottom: 5px; }
.hbar-top > span:first-child { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hbar-top > span:last-child { color: var(--muted); font-weight: 700; white-space: nowrap; }
.hbar-track { height: 8px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--primary); border-radius: 99px; min-width: 3px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-legend { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 8px; }
.donut-legend .row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.donut-legend .row span:nth-child(2) { flex: 1; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend .row b { white-space: nowrap; }

/* ---------------- P&L ---------------- */
.pl { display: flex; flex-direction: column; }
.pl-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px dashed var(--border); }
.pl-row > span:first-child { color: var(--text-2); font-weight: 600; }
.pl-row > b { white-space: nowrap; }
.pl-row.minus > span:first-child::before { content: '− '; color: var(--danger-text); font-weight: 800; }
.pl-row.total { font-weight: 800; font-size: 15.5px; border-bottom: 1px solid var(--border-strong); }
.pl-row.total > span:first-child { color: var(--text); font-weight: 800; }
.pl-row.grand {
  font-size: 18px;
  font-weight: 800;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 12px;
  padding: 13px 14px;
  border: 0;
  margin-top: 10px;
}
.pl-row.grand > span:first-child { color: inherit; font-weight: 800; }
.pl-row.grand.neg { background: var(--danger-soft); color: var(--danger-text); }

/* ---------------- Auth ---------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); background: #fff; }
.auth-form-side { display: grid; place-items: center; padding: 32px 24px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .brand-mark { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 18px; }
.auth-card h1 { font-size: 26px; font-weight: 800; }
.auth-card .lead { color: var(--muted); margin: 6px 0 26px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-foot { margin-top: 26px; color: var(--muted-2); font-size: 12.5px; text-align: center; }
.auth-visual {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 48px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(163, 230, 53, 0.22), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(34, 197, 94, 0.16), transparent 60%),
    linear-gradient(160deg, #0b1220 0%, #111b31 55%, #0b1220 100%);
}
.auth-visual .big-mark { position: absolute; left: -60px; bottom: -70px; opacity: 0.06; color: var(--lime); transform: rotate(-12deg); }
.auth-visual .wordmark { font-size: 15px; font-weight: 800; letter-spacing: 3px; color: var(--lime); direction: ltr; text-align: right; }
.auth-visual h2 { font-size: 34px; font-weight: 800; line-height: 1.45; margin-top: 18px; max-width: 520px; }
.auth-visual h2 em { font-style: normal; color: var(--lime); }
.auth-visual .feat { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 560px; position: relative; }
.auth-visual .feat div {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.auth-visual .feat .ic { color: var(--lime); margin-top: 3px; }
.auth-visual .feat b { display: block; font-size: 14.5px; }
.auth-visual .feat small { color: #a7b1c2; font-size: 12.5px; }

/* ---------------- POS ---------------- */
.pos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 32px);
  min-height: 560px;
}
.pos-catalog, .pos-cart {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.pos-catalog-head { padding: 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.pos-grid {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
  align-content: start;
  background: #fbfcfd;
}
.ptile {
  position: relative;
  text-align: start;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 128px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.ptile:hover { border-color: #86c79b; box-shadow: 0 0 0 3px var(--primary-ring); }
.ptile:active { transform: scale(0.98); }
.ptile:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.ptile-bar { height: 4px; background: var(--c, #94a3b8); flex-shrink: 0; }
.ptile-body { padding: 10px 12px 11px; display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.ptile-cat { font-size: 11.5px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptile-name { font-weight: 800; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ptile-variant { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 19px; }
.ptile-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-top: 8px; }
.ptile-price { font-weight: 800; font-size: 15.5px; color: var(--primary); white-space: nowrap; }
.ptile.out { opacity: 0.5; }
.ptile.in-cart { border-color: var(--primary); background: #f6fdf8; }
.ptile-qty {
  position: absolute;
  top: 10px;
  left: 10px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.cart-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.cart-head h3 { font-size: 15.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.cart-customer { padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cust-chip { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border); border-radius: 11px; padding: 7px 10px; }
.cust-chip .li-icon { width: 32px; height: 32px; background: var(--info-soft); color: var(--info); }
.cust-chip .who { flex: 1; min-width: 0; }
.cust-chip b { display: block; font-size: 13.5px; }
.cust-chip small { font-size: 12px; color: var(--muted); margin-inline-end: 8px; }
.cust-pick { justify-content: flex-start; color: var(--muted); border: 1px dashed var(--border-strong) !important; background: #fff !important; }
.cart-items { flex: 1; overflow-y: auto; padding: 4px 12px; }
.citem { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 10px 2px; border-bottom: 1px dashed var(--border); }
.citem:last-child { border-bottom: 0; }
.citem-name { font-weight: 700; font-size: 13.5px; line-height: 1.4; }
.citem-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.citem-meta .price-input { width: 76px; }
.citem-total { font-weight: 800; min-width: 64px; text-align: end; font-size: 14px; }
.citem .icon-btn { width: 28px; height: 28px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: #fff; }
.qty button { width: 28px; height: 30px; border: 0; background: #f4f6f9; cursor: pointer; font-size: 17px; font-weight: 800; line-height: 1; color: var(--text-2); }
.qty button:hover { background: #e9edf3; }
.qty input { width: 38px; height: 30px; border: 0; text-align: center; font-weight: 800; font-size: 14px; padding: 0; }
.qty input:focus { outline: none; background: var(--primary-soft); }
.cart-empty { text-align: center; color: var(--muted); padding: 46px 10px; }
.cart-empty .ic { color: #cbd5e1; margin-bottom: 8px; }
.cart-empty p { font-weight: 700; color: var(--text-2); }
.cart-foot { border-top: 1px solid var(--border); padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 9px; background: #fff; }
.sum-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.sum-row > span { color: var(--text-2); font-weight: 600; }
.sum-row.total { font-size: 21px; font-weight: 800; padding-top: 8px; border-top: 1px dashed var(--border-strong); }
.sum-row.total > span { color: var(--text); font-weight: 800; }
.sum-row.total .cur { font-size: 14px; }
.discount-box { display: flex; gap: 6px; width: 190px; }
.discount-box .input { flex: 1; }
.discount-box .select { width: 76px; flex-shrink: 0; padding-inline-end: 26px; background-position: left 7px center; }
.paid-input { width: 190px; font-weight: 800; }
.change-row { padding: 8px 12px; border-radius: 10px; font-weight: 700; }
.change-row.change { background: var(--primary-soft); color: #14532d; }
.change-row.due { background: var(--warning-soft); color: #78350f; }
.change-row > span { color: inherit; }
.pay-methods { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.pay-btn {
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 10px;
  padding: 7px 2px 6px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-2);
  transition: all 0.15s;
  white-space: nowrap;
}
.pay-btn:hover { border-color: #9fb0c5; }
.pay-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 2px var(--primary-ring); }
.cart-fab { display: none; }
.success-box { text-align: center; padding: 6px 0; }
.success-box .ok-ic { width: 70px; height: 70px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 12px; }
.success-box h3 { font-size: 18px; font-weight: 800; }
.success-total { font-size: 32px; font-weight: 800; margin: 6px 0; }
.success-box p { margin-top: 6px; font-size: 15px; }

/* customer picker */
.cust-list { max-height: 330px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }
.cust-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; width: 100%; background: #fff; border-inline: 0; border-top: 0; text-align: start; }
.cust-row:last-child { border-bottom: 0; }
.cust-row:hover { background: var(--primary-soft); }
.cust-row .who { flex: 1; min-width: 0; }
.cust-row b { display: block; }
.cust-row small { color: var(--muted); }
details.new-cust { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
details.new-cust summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--primary); list-style: none; }
details.new-cust summary::-webkit-details-marker { display: none; }

/* sale details */
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.meta-grid > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 9px 12px; min-width: 0; }
.meta-grid > div > span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.meta-grid > div > b { font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.totals-box { margin-top: 14px; margin-inline-start: auto; max-width: 360px; display: flex; flex-direction: column; gap: 4px; }
.totals-box .sum-row { padding: 4px 0; }
.totals-box .sum-row.total { font-size: 17px; }
.sub-title { font-size: 14.5px; font-weight: 800; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }

/* autocomplete */
.ac { position: relative; min-width: 0; }
.ac-list {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline: 0;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 20;
  padding: 4px;
}
.ac-item { padding: 9px 12px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ac-item:hover, .ac-item.active { background: var(--primary-soft); }
.ac-item small { color: var(--muted); }
.ac-empty { padding: 12px; color: var(--muted); text-align: center; }

/* purchase form */
.purchase-add { display: flex; gap: 10px; margin: 18px 0 12px; flex-wrap: wrap; }
.purchase-add .ac { flex: 1 1 320px; }
.purchase-table .input { min-width: 84px; }
.purchase-table td { padding: 8px 10px; }
.purchase-foot { display: flex; gap: 16px; align-items: flex-end; margin-top: 16px; flex-wrap: wrap; }
.purchase-total { background: #0f172a; color: #fff; border-radius: 13px; padding: 10px 18px; min-width: 220px; }
.purchase-total > span:first-child { display: block; font-size: 12.5px; color: #b8c2d3; font-weight: 600; }
.purchase-total b { font-size: 22px; font-weight: 800; }
.purchase-total .cur { color: #b8c2d3; font-size: 13px; }

/* stock count */
.count-input { width: 110px; font-weight: 800; }
.count-input.changed { border-color: var(--warning); background: var(--warning-soft); }
.sticky-foot {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 12px 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 2;
}

/* closing */
.drawer-big { text-align: center; padding: 22px 16px; border-radius: 14px; background: linear-gradient(140deg, #0b1220, #16213a); color: #fff; }
.drawer-big span { color: #b8c2d3; font-weight: 600; font-size: 13.5px; }
.drawer-big b { display: block; font-size: 34px; font-weight: 800; color: var(--lime); margin-top: 2px; }
.drawer-big .cur { color: #b8c2d3; font-size: 15px; }
.diff-box { padding: 12px 14px; border-radius: 12px; font-weight: 800; text-align: center; font-size: 15px; }
.diff-box.ok { background: var(--primary-soft); color: #14532d; }
.diff-box.short { background: var(--danger-soft); color: var(--danger-text); }
.diff-box.over { background: var(--info-soft); color: #1e3a8a; }

/* onboarding */
.onboard { padding: 22px; background: linear-gradient(140deg, #0b1220, #16213a); color: #fff; border-radius: var(--radius); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.onboard h3 { font-size: 19px; font-weight: 800; }
.onboard p { color: #b8c2d3; margin-top: 4px; }
.onboard ol { margin: 14px 0 0; padding-inline-start: 20px; color: #dbe3ee; display: flex; flex-direction: column; gap: 4px; }
.onboard ol b { color: var(--lime); }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* backups */
.file-drop { border: 2px dashed var(--border-strong); border-radius: 14px; padding: 22px; text-align: center; color: var(--muted); }
.file-drop input { display: none; }
.danger-zone { border-color: #fecaca; }
.danger-zone .card-head { background: var(--danger-soft); border-radius: var(--radius) var(--radius) 0 0; }
.danger-zone .card-head h3, .danger-zone .card-head h3 .ic { color: var(--danger-text); }
.color-input { width: 46px; height: 42px; padding: 3px; border-radius: 10px; border: 1px solid var(--border-strong); background: #fff; cursor: pointer; }

/* شاشات قصيرة (لابتوب 768px) — نخلي الفاتورة مضغوطة عشان الأصناف تبان */
@media (min-width: 961px) and (max-height: 860px) {
  .pos { gap: 12px; height: calc(100vh - var(--topbar-h) - 24px); min-height: 500px; }
  .content.wide { padding: 12px; }
  .pos-catalog-head { padding: 10px 12px; gap: 8px; }
  .search-lg .input { height: 42px; }
  .cart-head { padding: 8px 14px; }
  .cart-customer { padding: 6px 12px; }
  .cust-chip { padding: 4px 8px; }
  .cart-foot { gap: 6px; padding: 8px 14px 10px; }
  .sum-row { font-size: 13.5px; }
  .sum-row.total { font-size: 18px; padding-top: 4px; }
  .discount-box .input, .discount-box .select, .paid-input { height: 32px; }
  .pay-btn { padding: 4px 2px 3px; font-size: 11.5px; gap: 1px; }
  .pay-btn .ic { width: 15px; height: 15px; }
  .change-row { padding: 5px 10px; }
  .pos-cart .btn-xl { height: 48px; font-size: 16.5px; }
  .citem { padding: 7px 2px; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1280px) {
  .pos { grid-template-columns: minmax(0, 1fr) 380px; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: 280px;
    transform: translateX(105%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 35; }
  .sidebar-overlay.show { display: block; }
  .menu-btn { display: inline-grid !important; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title p { display: none; }
  .clock { display: none; }
  .content { padding: 16px; }
  .content.wide { padding: 12px; }
  .pos { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; padding-bottom: 70px; }
  .pos-grid { max-height: 52vh; }
  .cart-fab:not([hidden]) {
    display: flex;
    position: fixed;
    bottom: 14px;
    left: 14px;
    right: 14px;
    z-index: 25;
    height: 52px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    border: 0;
    font-weight: 800;
    font-size: 15px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(21, 128, 61, 0.35);
    cursor: pointer;
  }
  .pos-cart { max-height: none; }
  .cart-items { max-height: 40vh; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
  .onboard { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; gap: 10px; flex-direction: column; }
  .kpi-icon { width: 36px; height: 36px; border-radius: 10px; }
  .kpi-value { font-size: 18px; }
  .content { padding: 12px; }
  .toolbar > * { flex: 1 1 auto; }
  .toolbar .btn { flex: 1 1 auto; }
  .period-picker, .period-picker .select { width: 100%; }
  .period-picker .custom-range { width: 100%; }
  .period-picker .custom-range .input { flex: 1; width: auto; }
  .modal-backdrop { padding: 10px; }
  .modal-body { padding: 16px; }
  .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
  .pay-methods { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .discount-box, .paid-input { width: 160px; }
  .meta-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #toasts { left: 10px; right: 10px; }
  .toast { min-width: 0; max-width: none; }
  .topbar-actions .btn span.lbl { display: none; }
}

/* ---------------- Print ---------------- */
.print-only { display: none; }
@media print {
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .no-print, .toolbar, .tabs, #toasts, .modal-backdrop, .sidebar-overlay { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .grid-2, .grid-main { grid-template-columns: 1fr 1fr; }
  .print-only { display: block !important; }
  .table-wrap { overflow: visible; }
}
