/* ============================================================
   القالب العام — مستوحى من DreamsPOS، من اليمين لليسار
   ============================================================ */

@font-face { font-family: 'Cairo'; font-weight: 400; font-display: swap; src: url('../fonts/cairo-arabic-400-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Cairo'; font-weight: 600; font-display: swap; src: url('../fonts/cairo-arabic-600-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Cairo'; font-weight: 700; font-display: swap; src: url('../fonts/cairo-arabic-700-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-089F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Cairo'; font-weight: 400; font-display: swap; src: url('../fonts/cairo-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20AA, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Cairo'; font-weight: 600; font-display: swap; src: url('../fonts/cairo-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20AA, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Cairo'; font-weight: 700; font-display: swap; src: url('../fonts/cairo-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20AA, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Rubik'; font-weight: 400; font-display: swap; src: url('../fonts/rubik-hebrew-400-normal.woff2') format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Rubik'; font-weight: 500; font-display: swap; src: url('../fonts/rubik-hebrew-500-normal.woff2') format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Rubik'; font-weight: 700; font-display: swap; src: url('../fonts/rubik-hebrew-700-normal.woff2') format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Rubik'; font-weight: 400; font-display: swap; src: url('../fonts/rubik-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Rubik'; font-weight: 500; font-display: swap; src: url('../fonts/rubik-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Rubik'; font-weight: 700; font-display: swap; src: url('../fonts/rubik-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --primary: #FE9F43;
  --primary-dark: #E88A2D;
  --primary-soft: #FFF3E8;
  --secondary: #092C4C;
  --secondary-soft: #E6EAED;
  --success: #3EB780;
  --success-soft: #EAF8F2;
  --info: #155EEF;
  --info-soft: #EAF0FE;
  --teal: #0E9384;
  --danger: #E70D0D;
  --danger-soft: #FDECEC;
  --warning: #F5A623;
  --purple: #6938EF;
  --body-bg: #F7F7F7;
  --card-bg: #FFFFFF;
  --border: #E6EAED;
  --text: #646B72;
  --heading: #212B36;
  --muted: #9AA2AB;
  --sidebar-w: 252px;
  --header-h: 64px;
  --radius: 8px;
  --shadow: 0 4px 60px 0 rgba(190, 190, 190, 0.27);
  --font: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;

  --bs-primary: var(--primary);
  --bs-primary-rgb: 254, 159, 67;
  --bs-link-color: var(--primary-dark);
  --bs-link-hover-color: var(--primary-dark);
  --bs-border-color: var(--border);
  --bs-body-color: var(--text);
  --bs-body-font-family: var(--font);
}
html[lang="he"] { --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; }

body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--heading); font-weight: 700; }
a { text-decoration: none; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: embed; display: inline-block; }

/* ---------- الأزرار ---------- */
.btn { border-radius: 6px; font-weight: 600; font-size: 14px; padding: .45rem .95rem; }
.btn-sm { font-size: 13px; padding: .3rem .7rem; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); --bs-btn-color:#fff; --bs-btn-hover-color:#fff; --bs-btn-active-color:#fff; }
.btn-secondary { --bs-btn-bg: var(--secondary); --bs-btn-border-color: var(--secondary); --bs-btn-hover-bg: #0b3a63; --bs-btn-hover-border-color: #0b3a63; --bs-btn-active-bg: #0b3a63; }
.btn-outline-primary { --bs-btn-color: var(--primary-dark); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--primary); --bs-btn-active-border-color: var(--primary); }
.btn-light { --bs-btn-bg: #F2F4F7; --bs-btn-border-color: #F2F4F7; --bs-btn-color: var(--heading); }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.form-control, .form-select { border-radius: 6px; border-color: var(--border); font-size: 14px; padding: .5rem .8rem; color: var(--heading); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(254, 159, 67, .15); }
.form-label { font-weight: 600; color: var(--heading); font-size: 14px; margin-bottom: .35rem; }
.form-text { color: var(--muted); font-size: 12.5px; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(254, 159, 67, .15); }
.required::after { content: ' *'; color: var(--danger); }

/* ---------- الشريط الجانبي ---------- */
.sidebar {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--sidebar-w);
  background: #fff; border-left: 1px solid var(--border); z-index: 1040;
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-logo {
  height: var(--header-h); display: flex; align-items: center; gap: 10px;
  padding: 0 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-logo img { max-height: 38px; max-width: 150px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.logo-text { font-weight: 700; color: var(--secondary); font-size: 16px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-menu { overflow-y: auto; padding: 12px 14px 24px; flex: 1; }
.sidebar-menu .menu-title {
  font-size: 12px; font-weight: 700; color: var(--secondary); text-transform: uppercase;
  margin: 16px 8px 6px; letter-spacing: .3px; opacity: .85;
}
.sidebar-menu .menu-title:first-child { margin-top: 4px; }
.sidebar-menu a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px;
  color: var(--text); font-weight: 600; font-size: 14px; margin-bottom: 2px; transition: background .15s, color .15s;
}
.sidebar-menu a i { font-size: 17px; width: 20px; text-align: center; color: var(--muted); }
.sidebar-menu a:hover { background: var(--primary-soft); color: var(--primary-dark); }
.sidebar-menu a:hover i { color: var(--primary); }
.sidebar-menu a.active { background: var(--primary-soft); color: var(--primary-dark); }
.sidebar-menu a.active i { color: var(--primary); }
.sidebar-menu .soon { margin-inline-start: auto; font-size: 10.5px; font-weight: 600; color: var(--muted); background: #F2F4F7; border-radius: 10px; padding: 1px 7px; }
.sidebar-footer { border-top: 1px solid var(--border); padding: 10px 20px; font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* ---------- الهيدر ---------- */
.header {
  position: fixed; top: 0; left: 0; right: var(--sidebar-w); height: var(--header-h);
  background: #fff; border-bottom: 1px solid var(--border); z-index: 1030;
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
}
.header .toggle-btn { display: none; }
.header-search { position: relative; width: 280px; max-width: 32vw; }
.header-search input { padding-inline-start: 36px; background: #F9FAFB; height: 38px; }
.header-search i { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.header-icon {
  width: 38px; height: 38px; border-radius: 8px; background: #F9FAFB; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; color: var(--heading); position: relative; font-size: 17px;
}
.header-icon:hover { border-color: var(--primary); color: var(--primary-dark); }
.header-icon .badge-dot {
  position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.btn-pos { background: var(--secondary); color: #fff; height: 38px; display: inline-flex; align-items: center; gap: 6px; }
.btn-pos:hover { background: #0b3a63; color: #fff; }

/* ربح اليوم — لمدير الشركة فقط */
.profit-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 12px;
  border-radius: 8px; background: var(--success-soft); border: 1px solid #C6EBDA; color: #1F7A52; font-weight: 700; white-space: nowrap;
}
html[dir="rtl"] .profit-pill { padding: 0 12px 0 6px; }
.profit-pill .label { font-size: 12px; font-weight: 600; color: #2E8B60; }
.profit-pill .value { font-size: 15px; direction: ltr; unicode-bidi: embed; }
.profit-pill.negative { background: var(--danger-soft); border-color: #F6C6C6; color: #B42318; }
.profit-pill.negative .label { color: #B42318; }
.profit-pill .eye { border: 0; background: transparent; color: inherit; width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.profit-pill .eye:hover { background: rgba(0, 0, 0, .06); }
.profit-pill.masked .value { filter: blur(6px); user-select: none; }

.user-menu { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 3px; border-radius: 8px; }
.user-menu:hover { background: #F9FAFB; }
.avatar {
  width: 38px; height: 38px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.user-menu .u-name { color: var(--heading); font-weight: 700; font-size: 14px; line-height: 1.2; }
.user-menu .u-role { color: var(--muted); font-size: 12px; }
.dropdown-menu { border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 8px; padding: 6px; font-size: 14px; }
.dropdown-item { border-radius: 6px; padding: 7px 12px; display: flex; align-items: center; gap: 8px; color: var(--heading); }
.dropdown-item:active, .dropdown-item.active { background: var(--primary); color: #fff; }
.dropdown-item:hover { background: var(--primary-soft); color: var(--primary-dark); }
.dropdown-header { color: var(--heading); font-weight: 700; }

/* ---------- المحتوى ---------- */
.page-wrapper { margin-right: var(--sidebar-w); padding-top: var(--header-h); min-height: 100vh; }
.content { padding: 24px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h4 { margin: 0; font-size: 18px; }
.page-header .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16, 24, 40, .03); margin-bottom: 24px; background: var(--card-bg); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-header h5, .card-title { font-size: 16px; margin: 0; font-weight: 700; color: var(--heading); }
.card-body { padding: 20px; }

/* بطاقات الإحصاءات الملوّنة */
.stat-card { border-radius: var(--radius); padding: 18px; display: flex; align-items: center; gap: 14px; color: #fff; margin-bottom: 24px; position: relative; overflow: hidden; min-height: 96px; }
.stat-card::after { content: ''; position: absolute; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .08); inset-inline-end: -40px; top: -50px; }
.stat-card .ic { width: 50px; height: 50px; border-radius: 8px; background: rgba(255, 255, 255, .18); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.stat-card .lbl { font-size: 13.5px; opacity: .92; }
.stat-card .val { font-size: 21px; font-weight: 700; color: #fff; margin: 2px 0 0; direction: ltr; unicode-bidi: embed; display: inline-block; }
.stat-card .sub { font-size: 12px; opacity: .85; }
.bg-c-orange { background: var(--primary); }
.bg-c-navy { background: var(--secondary); }
.bg-c-teal { background: var(--teal); }
.bg-c-blue { background: var(--info); }

/* بطاقات بيضاء */
.info-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 24px; }
.info-card .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.info-card .val { font-size: 20px; font-weight: 700; color: var(--heading); margin: 0; }
.info-card .lbl { font-size: 13.5px; color: var(--text); }
.info-card .ic { width: 46px; height: 46px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.info-card .foot { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
.ic-orange { background: var(--primary-soft); color: var(--primary); }
.ic-green { background: var(--success-soft); color: var(--success); }
.ic-blue { background: var(--info-soft); color: var(--info); }
.ic-red { background: var(--danger-soft); color: var(--danger); }
.ic-navy { background: var(--secondary-soft); color: var(--secondary); }
.ic-purple { background: #F0EBFF; color: var(--purple); }

.welcome { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.welcome h1 { font-size: 22px; margin: 0 0 2px; }
.welcome p { margin: 0; }
.welcome .hl { color: var(--primary-dark); font-weight: 700; }
.date-chip { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; font-weight: 600; color: var(--heading); display: inline-flex; align-items: center; gap: 8px; }

/* ---------- الجداول ---------- */
.table { --bs-table-color: var(--text); margin-bottom: 0; font-size: 14px; }
.table > thead th { background: #F9FAFB; color: var(--heading); font-weight: 700; border-bottom: 1px solid var(--border); white-space: nowrap; padding: 12px 16px; font-size: 13.5px; }
.table > tbody td { padding: 12px 16px; vertical-align: middle; border-color: var(--border); }
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: #FCFCFD; }
.table .t-title { color: var(--heading); font-weight: 600; }
.empty-state { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-state i { font-size: 34px; display: block; margin-bottom: 8px; color: #C5CBD3; }

/* الشارات */
.badge { font-weight: 600; font-size: 12px; padding: .38em .7em; border-radius: 6px; }
.badge-soft-success { background: var(--success-soft); color: #1F7A52; }
.badge-soft-danger { background: var(--danger-soft); color: #B42318; }
.badge-soft-warning { background: #FEF6E7; color: #B54708; }
.badge-soft-info { background: var(--info-soft); color: var(--info); }
.badge-soft-secondary { background: #F2F4F7; color: #475467; }
.badge-soft-primary { background: var(--primary-soft); color: #C4610E; }
.badge-soft-navy { background: var(--secondary-soft); color: var(--secondary); }

.alert { border-radius: var(--radius); border: 0; font-weight: 500; }
.alert-success { background: var(--success-soft); color: #1F7A52; }
.alert-danger { background: var(--danger-soft); color: #B42318; }
.alert-warning { background: #FEF6E7; color: #93370D; }
.alert-info { background: var(--info-soft); color: #1849A9; }

.pagination { --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); --bs-pagination-color: var(--heading); --bs-pagination-hover-color: var(--primary-dark); }

/* صفحة "قريباً" */
.soon-box { text-align: center; padding: 56px 20px; }
.soon-box .ic { width: 80px; height: 80px; border-radius: 20px; margin: 0 auto 18px; font-size: 36px; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); }
.soon-box h3 { font-size: 22px; }
.soon-box p { max-width: 560px; margin: 8px auto 0; }

/* سجل الرقابة */
.json-box { background: #F9FAFB; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-all; margin: 0; max-height: 220px; overflow: auto; }
.diff-row { display: flex; gap: 6px; font-size: 13px; flex-wrap: wrap; align-items: baseline; }
.diff-row .k { color: var(--heading); font-weight: 600; }
.diff-row .old { color: #B42318; text-decoration: line-through; }
.diff-row .new { color: #1F7A52; }

/* ---------- صفحات بدون قالب (الدخول، التثبيت) ---------- */
.auth-page { min-height: 100vh; display: flex; }
.auth-side { flex: 1; background: linear-gradient(160deg, var(--secondary) 0%, #0F3D66 100%); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 48px; position: relative; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: rgba(254, 159, 67, .16); top: -120px; inset-inline-start: -140px; }
.auth-side::after { content: ''; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: rgba(255, 255, 255, .05); bottom: -100px; inset-inline-end: -60px; }
.auth-side h2 { color: #fff; font-size: 30px; position: relative; }
.auth-side p { color: rgba(255, 255, 255, .78); font-size: 16px; max-width: 420px; position: relative; }
.auth-side .feat { display: flex; gap: 10px; align-items: center; margin-top: 14px; position: relative; color: rgba(255, 255, 255, .9); }
.auth-side .feat i { width: 34px; height: 34px; border-radius: 8px; background: rgba(254, 159, 67, .22); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.auth-form { width: 520px; max-width: 100%; background: #fff; display: flex; flex-direction: column; justify-content: center; padding: 48px 56px; }
.auth-form h3 { font-size: 24px; margin-bottom: 4px; }
.auth-form .lead-sm { color: var(--text); margin-bottom: 28px; }
.auth-form .form-control { height: 46px; }
.auth-form .btn-lg { height: 48px; font-size: 15px; }
.pass-wrap { position: relative; }
.pass-wrap .toggle-pass { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; }
.lang-switch { display: flex; gap: 6px; }
.lang-switch a { padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border); color: var(--heading); font-weight: 600; font-size: 13px; }
.lang-switch a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.install-wrap { max-width: 860px; margin: 32px auto; padding: 0 16px; }
.install-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.req-list { list-style: none; padding: 0; margin: 0; }
.req-list li { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--border); gap: 10px; }
.req-list li:last-child { border-bottom: 0; }
.req-list .val { color: var(--muted); font-size: 12.5px; direction: ltr; unicode-bidi: embed; word-break: break-all; }
.section-title { font-size: 15px; font-weight: 700; color: var(--heading); display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.section-title i { color: var(--primary); }

.center-box { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.center-box .card { max-width: 560px; width: 100%; }

/* ---------- الجوال ---------- */
.sidebar-overlay { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(100%); box-shadow: none; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: -8px 0 32px rgba(0, 0, 0, .12); }
  body.sidebar-open .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(9, 44, 76, .35); z-index: 1035; }
  .header { right: 0; padding: 0 14px; gap: 8px; }
  .header .toggle-btn { display: inline-flex; }
  .page-wrapper { margin-right: 0; }
  .header-search { display: none; }
  .content { padding: 16px; }
  .auth-side { display: none; }
  .auth-form { width: 100%; padding: 32px 22px; }
}
@media (max-width: 575.98px) {
  .user-menu .u-text, .btn-pos .txt, .profit-pill .label { display: none; }
  .header-actions { gap: 6px; }
  .profit-pill .value { font-size: 13.5px; }
}

@media print {
  .sidebar, .header, .no-print { display: none !important; }
  .page-wrapper { margin: 0; padding: 0; }
}
.info-card .val.num { display: block; }
@media (max-width: 575.98px) {
  .stat-card { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; min-height: 0; }
  .stat-card .ic { width: 40px; height: 40px; font-size: 19px; }
  .stat-card .val { font-size: 17px; }
}

/* ============================================================
   المرحلة 2: المنتجات والمخزون
   ============================================================ */
.input-icon { position: relative; }
.input-icon > i { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .form-control { padding-inline-start: 36px; }
.sidebar-menu .count { margin-inline-start: auto; background: var(--primary); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; }

.defs-tabs { gap: 6px; flex-wrap: wrap; }
.defs-tabs .nav-link { background: #fff; border: 1px solid var(--border); color: var(--heading); font-weight: 600; border-radius: 8px; padding: 7px 14px; }
.defs-tabs .nav-link:hover { border-color: var(--primary); color: var(--primary-dark); }
.defs-tabs .nav-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.defs-tabs .nav-link.active .badge { background: rgba(255, 255, 255, .25) !important; color: #fff !important; }

.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); vertical-align: -2px; margin-inline-end: 6px; flex-shrink: 0; }

.color-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.color-chip input { display: none; }
.color-chip span { display: inline-flex; align-items: center; gap: 2px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--heading); background: #fff; user-select: none; transition: all .12s; }
.color-chip span:hover { border-color: var(--primary); }
.color-chip input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: #C4610E; box-shadow: 0 0 0 1px var(--primary) inset; }

.matrix-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.matrix-table th, .matrix-table td { text-align: center; vertical-align: middle; padding: 6px !important; }
.matrix-table thead th { background: #F9FAFB; font-weight: 700; }
.matrix-table .col-toggle, .matrix-table .row-toggle { cursor: pointer; user-select: none; }
.matrix-table .col-toggle:hover, .matrix-table .row-toggle:hover { color: var(--primary-dark); background: var(--primary-soft); }
.matrix-table .row-toggle { text-align: start; white-space: nowrap; background: #FCFCFD; font-weight: 600; }
.matrix-table td { min-width: 76px; }
.matrix-table td .form-check-input { margin: 0 0 4px; display: block; margin-inline: auto; }
.matrix-table td .form-control { width: 64px; margin: 0 auto; text-align: center; padding: 3px 4px; }
.matrix-table td.off { background: #FAFAFA; }
.matrix-table td.off .form-control { opacity: .35; }
.matrix-table td.exists { background: #F6F7F9; }
.matrix-table .row-total { font-weight: 700; color: var(--heading); }

.variants-table td, .variants-table th { white-space: nowrap; }

.p-thumb { width: 44px; height: 44px; border-radius: 8px; background: #F2F4F7; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; color: #C5CBD3; font-size: 18px; }
.p-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-hero { aspect-ratio: 1 / 1; background: #F7F8FA; display: flex; align-items: center; justify-content: center; border-radius: 8px 8px 0 0; overflow: hidden; color: #C5CBD3; font-size: 64px; }
.product-hero img { width: 100%; height: 100%; object-fit: contain; }
.stock-grid th, .stock-grid td { padding: 8px !important; }
.stock-grid .badge { min-width: 34px; font-size: 13px; }

.upload-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px dashed #D0D5DD; border-radius: 10px; padding: 26px 16px; text-align: center; cursor: pointer; color: var(--muted); background: #FCFCFD; transition: border-color .15s, background .15s; }
.upload-drop:hover { border-color: var(--primary); background: var(--primary-soft); }
.upload-drop i { font-size: 34px; color: var(--primary); }
.upload-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.img-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; position: relative; background: #fff; }
.img-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: #F7F8FA; }
.img-card.main { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.img-card .main-badge { position: absolute; top: 8px; inset-inline-start: 8px; }

.picker-results { max-height: 340px; overflow-y: auto; }
.picker-results .list-group-item { border-color: var(--border); }

.scan-bar { position: sticky; top: calc(var(--header-h) + 8px); z-index: 20; }
.count-table .count-input { width: 100px; text-align: center; }
.count-table tr.flash td { animation: flashRow 1.2s ease; }
@keyframes flashRow { 0% { background: #FFE2C4; } 100% { background: transparent; } }

.approval-card .old { color: #B42318; text-decoration: line-through; }
.approval-card .new { color: #1F7A52; }
.new-row td { background: #FFFBF6; }
/* الخلايا الرقمية تبقى خلايا جدول */
td.num, th.num { display: table-cell; }

/* باركود الصنف الأساسي في صفحة المنتج */
.base-barcode { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; background: #fff; }
.base-barcode svg { width: 100%; height: auto; max-height: 70px; }

/* طباعة الملصقات */
.lbl-results { max-height: 380px; overflow-y: auto; margin-top: 8px; }
.lbl-prod { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.lbl-vars { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lbl-var { border: 1px solid var(--border); background: #F9FAFB; border-radius: 6px; padding: 3px 9px; font-size: 12.5px; font-weight: 600; color: var(--heading); }
.lbl-var span { color: #1F7A52; margin-inline-start: 4px; font-weight: 700; }
.lbl-var.out span { color: #B42318; }
.lbl-var:hover { border-color: var(--primary); background: #FFF6EE; }
.lbl-preview { width: 100%; height: 230px; border: 0; background: #F4F5F7; border-radius: 6px; display: block; }

/* المشتريات */
.purchase-table input.form-control-sm { min-width: 80px; }
.purchase-summary { position: sticky; top: 84px; }
.purchase-summary .row-line, .card .row-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; }
.purchase-summary .row-line.total, .card .row-line.total { border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 10px; font-weight: 800; font-size: 17px; color: var(--heading); }
.purchase-summary .row-line.muted { color: var(--muted); font-size: 13px; }
.mx-table input { max-width: 80px; margin: 0 auto; }
@media print { .card { break-inside: avoid; } .badge { border: 1px solid #999; } }

/* الطلبات */
.order-log { list-style: none; padding: 0; margin: 0; }
.order-log li { padding: 6px 0; border-bottom: 1px dashed var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.order-log li:last-child { border-bottom: 0; }

/* ===== المرحلة 7: المحاسب والتقارير والشركاء ===== */
.period-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.period-bar input[type=date] { width: 150px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--heading); }
.bar-row .bar { height: 8px; background: var(--secondary-soft); border-radius: 6px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.day-chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; direction: ltr; }
.day-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.day-chart .col i { display: block; width: 100%; max-width: 26px; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); border-radius: 4px 4px 0 0; }
.day-chart .col span { font-size: 10px; color: var(--muted); margin-top: 3px; }
.pnl .pl-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.pnl .pl-row.sub { color: var(--text); padding-inline-start: 14px; font-size: 13px; }
.pnl .pl-row.total { color: var(--heading); font-weight: 600; border-bottom-style: solid; }
.pnl .pl-row.grand { font-size: 17px; color: var(--heading); border-bottom: 0; border-top: 2px solid var(--heading); margin-top: 4px; padding-top: 10px; }
.share-ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--secondary-soft) 0); position: relative; }
.share-ring::before { content: ''; position: absolute; inset: 7px; background: #fff; border-radius: 50%; }
.share-ring span { position: relative; font-weight: 700; font-size: 13px; color: var(--heading); }
.partner-card .card-footer { border-top: 1px solid var(--border); }
.acc-card .lbl.t-title { display: inline-block; margin-top: 2px; }
@media print {
  .period-bar, .defs-tabs { display: none !important; }
  .day-chart .col i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* إعداد الإشعارات */
.push-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-top: 1px dashed var(--border, #e5e7eb); }
.push-row:first-of-type { border-top: 0; }
.push-step { flex: 0 0 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: #eef2ff; color: #4338ca; }
.push-step.done { background: #dcfce7; color: #15803d; }

/* تبويب الصور: اعتماد صورة لكل لون */
.step-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; margin-inline-end: 6px; }
.color-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); flex: none; }
.color-dot.sm { width: 11px; height: 11px; min-width: 11px; max-width: 11px; padding: 0; margin-inline-end: 4px; vertical-align: -1px; }
.color-img-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.color-img-row:last-child { border-bottom: 0; }
.color-img-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.img-card .color-badge { position: absolute; top: 8px; inset-inline-end: 8px; font-weight: 500; }
.color-pick { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.color-chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; line-height: 20px; cursor: pointer; }
.color-chip:hover { border-color: var(--primary); }
.color-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* نسخ صف لون في مصفوفة المتغيرات */
.matrix-table .row-copy { padding: 0 6px; margin-inline-start: 4px; font-size: 12px; line-height: 20px; }
.matrix-table tr.flash > * { animation: rowflash 1.2s ease; }
@keyframes rowflash { 0% { background: var(--primary-soft); } 100% { background: transparent; } }
.copy-menu { z-index: 1080; max-height: 320px; overflow: auto; }
.copy-menu .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); margin-inline-end: 6px; vertical-align: -1px; }

/* جدول المتغيرات: صف عنوان لكل لون مع زر حذف اللون */
.variants-table tr.color-group-row td { background: #F9FAFB; border-top: 2px solid var(--border); padding-top: 6px; padding-bottom: 6px; }

/* تعديل التوزيعة: خلايا المقاسات الموجودة */
.matrix-table td.ex .form-control { font-weight: 600; }
.matrix-table td.ex.changed { background: #FFF8EB; }
.matrix-table td.ex.changed .form-control { border-color: #F79009; }
.matrix-table td.ex.removed { background: #FEF3F2; }
.matrix-table td.ex.removed .form-control { text-decoration: line-through; }
.matrix-table td.ex .was { display: block; font-size: 10px; color: var(--muted, #667085); margin-top: 2px; }
.matrix-table td.ex.removed .was { color: #D92D20; }
.color-chips .color-chip.locked { opacity: .85; }
.color-chips .color-chip.locked span { cursor: not-allowed; }
