/* ===================== JoyLand — نظام التصميم (مأخوذ من ملف التصميم) ===================== */
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 300; font-display: swap; src: url(../fonts/ibm-plex-sans-arabic-300.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-sans-arabic-500.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url(../fonts/ibm-plex-sans-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 300; font-display: swap; src: url(../fonts/ibm-plex-sans-arabic-latin-300.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-arabic-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-sans-arabic-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-arabic-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url(../fonts/ibm-plex-sans-arabic-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

:root {
  --bg: #0b0e12;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, #16202b 0%, #0b0e12 60%);
  --app: #0f141a;
  --side: #12171e;
  --surface: #151a21;
  --surface-2: #121820;
  --input: #0f141a;
  --line: rgba(255,255,255,.07);
  --line-2: rgba(255,255,255,.09);
  --text: #e8edf3;
  --text-strong: #eef3f8;
  --text-2: #c7d0da;
  --muted: #8b97a6;
  --faint: #6b7684;
  --gold: #e0a52e;
  --gold-hover: #f2bf55;
  --gold-dark: #c07d15;
  --on-gold: #1a1205;
  --gold-text: #f3d18a;
  --money: #f3e3c4;
  --gold-soft: rgba(224,165,46,.14);
  --gold-line: rgba(224,165,46,.45);
  --success: #3ecf9e;
  --success-2: #2fb389;
  --success-text: #9fe0c4;
  --success-soft: rgba(47,179,137,.13);
  --danger: #e0705f;
  --danger-2: #e0553f;
  --danger-text: #e0958a;
  --danger-soft: rgba(224,85,63,.14);
  --info: #2f7fb3;
  --info-soft: rgba(47,127,179,.15);
  --radius: 14px;
  --radius-sm: 11px;
  --shadow: 0 30px 70px rgba(0,0,0,.55);
  --shadow-sm: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 24px -14px rgba(0,0,0,.6);
  --ring: 0 0 0 3px rgba(224,165,46,.22);
  --surface-hi: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0) 45%);
  --font: "IBM Plex Sans Arabic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-text); text-decoration: none; }
a:hover { color: var(--gold-hover); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
h1, h2, h3 { letter-spacing: -.2px; }
.num, .money, td.n, .kpi-value { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: embed; }
.muted { color: var(--muted) !important; }
.faint { color: var(--faint) !important; }
.text-gold { color: var(--gold-text) !important; }
.text-money { color: var(--money) !important; }
.text-ok { color: var(--success) !important; }
.text-bad { color: var(--danger) !important; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.13); border-radius: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: var(--gold-soft); }

/* ===================== التخطيط ===================== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: 0 0 248px; background: var(--side); border-inline-start: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px; border-bottom: 1px solid var(--line); margin-bottom: 6px;
  background: radial-gradient(260px 90px at 100% 0%, rgba(224,165,46,.10), transparent 70%); }
.brand-logo.has-img { background: #fff; box-shadow: 0 8px 22px rgba(0,0,0,.35); border: 1px solid var(--line-2); overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; display: block; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #f2bf55, #c07d15); color: var(--on-gold); font-weight: 700; font-size: 20px;
  box-shadow: 0 8px 22px rgba(224,165,46,.25);
}
.brand-name { font-weight: 700; font-size: 15px; color: var(--text-strong); }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav-group { padding: 6px 10px; }
.nav-title { font-size: 10.5px; color: var(--faint); padding: 12px 10px 6px; letter-spacing: .4px; font-weight: 600; }
.nav-link-x {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px; color: var(--text-2); position: relative;
  font-size: 13.5px; transition: background .15s, color .15s, transform .15s; margin-bottom: 2px;
}
.nav-link-x.active::before { content: ""; position: absolute; inset-inline-start: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--gold); box-shadow: 0 0 10px rgba(224,165,46,.6); }
.nav-link-x svg { width: 18px; height: 18px; opacity: .8; flex: 0 0 18px; }
.nav-link-x:hover { background: rgba(255,255,255,.045); color: var(--text); }
.nav-link-x:hover svg { opacity: 1; }
.nav-link-x.active { background: var(--gold-soft); color: var(--gold-text); box-shadow: inset 0 0 0 1px var(--gold-line); }
.nav-link-x.active svg { opacity: 1; }
.nav-link-x .count { margin-inline-start: auto; font-size: 11px; background: rgba(255,255,255,.07); padding: 1px 7px; border-radius: 7px; color: var(--muted); }
.side-foot { margin-top: auto; padding: 14px; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; font-size: 12px; color: var(--muted); }
.side-card b { color: var(--text); font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 15px 28px; border-bottom: 1px solid var(--line);
  background: rgba(11,14,18,.78); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 19px; font-weight: 700; color: var(--text-strong); margin: 0; }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar .spacer { flex: 1; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px;
  background: linear-gradient(135deg, #2a3442, #1b222a); color: var(--gold-text); border: 1px solid var(--line-2);
  box-shadow: 0 0 0 2px var(--app), 0 0 0 3px rgba(224,165,46,.35);
}
.user-box { display: flex; align-items: center; gap: 10px; }
.user-box .u-name { font-size: 13px; font-weight: 600; }
.user-box .u-role { font-size: 11px; color: var(--muted); }
.content { padding: 24px 28px 48px; max-width: 1500px; width: 100%; }
.menu-toggle { display: none; }

/* ===================== الموبايل والتابلت ===================== */
.backdrop { position: fixed; inset: 0; background: rgba(5,7,10,.6); z-index: 49; display: none; }
.bottom-nav { display: none; }
@media (max-width: 992px) {
  /* القائمة الجانبية درج ينزلق من اليمين (inline-start في RTL) */
  .sidebar { position: fixed; top: 0; inset-inline-start: 0; height: 100dvh; width: min(300px, 86vw); z-index: 50;
    transform: translateX(100%); transition: transform .25s ease; box-shadow: var(--shadow); border-inline-start: 0; border-inline-end: 1px solid var(--line); }
  .sidebar.open { transform: none; visibility: visible; }
  /* الدرج المغلق لا يوسّع الصفحة أفقياً */
  .sidebar:not(.open) { visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
  html, body { overflow-x: hidden; }
  .shell { max-width: 100vw; }
  body.nav-open .backdrop { display: block; }
  body.nav-open { overflow: hidden; }
  .menu-toggle { display: inline-grid; }
  .content { padding: 14px 14px calc(78px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .topbar .page-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48vw; }
  .topbar .page-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48vw; }
  /* أزرار الصفحة تنزل لسطر خاص قابل للتمرير أفقياً */
  .top-actions { order: 10; flex-basis: 100%; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .top-actions::-webkit-scrollbar { display: none; }
  .top-actions > * { flex: 0 0 auto; }
  .user-box .text-end { display: none; }
  /* شريط سفلي بالشاشات الأساسية كما في تصميم الهاتف */
  .bottom-nav { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 40; background: rgba(18,23,29,.96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line-2); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 10px;
    color: var(--muted); font: 500 10.5px var(--font); background: none; border: 0; text-decoration: none; min-width: 0; }
  .bottom-nav a span, .bottom-nav button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav svg { width: 22px; height: 22px; }
  .bottom-nav .active { color: var(--gold-text); background: var(--gold-soft); }
  /* الشبكات والأرقام */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .kpi { padding: 11px 12px; }
  .kpi-value { font-size: 19px; }
  .hero { padding: 16px; }
  .hero .big { font-size: 27px; }
  .grid-main, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .panel { padding: 13px; }
  .panel-head { flex-wrap: wrap; }
  .panel-head .actions { width: 100%; margin-inline-start: 0; }
  /* الجداول: تمرير أفقي سلس مع إيحاء بالظل */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .tbl { font-size: 12.5px; }
  .tbl th, .tbl td { padding: 9px 10px; }
  /* النماذج: كل الحقول بعرض الشاشة، وخط 16px يمنع تكبير iOS */
  .inp, .form-x input:not([type=checkbox]):not([type=radio]):not([type=color]), .form-x select, .form-x textarea { font-size: 16px; }
  .seg { display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg a, .seg button, .seg label span { white-space: nowrap; }
  .amount-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .amount-btn { padding: 10px 4px; font-size: 14px; }
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
  .btn-x { min-height: 42px; }
  .btn-sm-x { min-height: 34px; }
  /* النوافذ المنبثقة تملأ الشاشة من الأسفل */
  .modal-x { padding: 0; align-items: flex-end; }
  .modal-box { max-width: none; border-radius: 18px 18px 0 0; max-height: 94dvh; }
  .modal-foot { position: sticky; bottom: 0; background: var(--app); border-top: 1px solid var(--line); }
  .card-visual .cv-num { font-size: 17px; letter-spacing: 1px; }
  .card-visual .cv-bal { font-size: 22px; }
  .toast-wrap { bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100% - 24px); }
  .pager a, .pager span { min-width: 38px; height: 38px; }
  .receipt { padding: 16px; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .amount-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar .page-title, .topbar .page-sub { max-width: 44vw; }
}
/* التابلت: عمودان للشبكات الكبيرة */
@media (min-width: 993px) and (max-width: 1200px) {
  .sidebar { width: 220px; flex-basis: 220px; }
  .content { padding: 18px 18px 36px; }
}

/* ===================== شريط الفلاتر ===================== */
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.filters-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filters-row .field { margin: 0; flex: 1 1 160px; min-width: 0; }
.filters-row .field.wide { flex: 2 1 260px; }
.filters-row .field.narrow { flex: 0 1 130px; }
.filters-row .field label { font-size: 11.5px; margin-bottom: 4px; }
.filters-row .actions { display: flex; gap: 6px; flex: 0 0 auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip-x { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; color: var(--text-2);
  background: var(--input); border: 1px solid var(--line-2); cursor: pointer; white-space: nowrap; text-decoration: none; transition: all .15s; }
.chip-x:hover { border-color: var(--gold-line); color: var(--text); }
.chip-x.active { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-text); }
.chip-x.remove { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-text); }
.chip-x.remove::after { content: "×"; font-size: 15px; line-height: 1; opacity: .8; }
.chips-label { font-size: 11.5px; color: var(--faint); align-self: center; }
.filters-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.filters-summary b { color: var(--text); font-weight: 600; }
@media (max-width: 992px) {
  .filters { padding: 10px 12px; }
  .filters-row { gap: 8px; }
  .filters-row .field, .filters-row .field.wide, .filters-row .field.narrow { flex: 1 1 calc(50% - 8px); }
  .filters-row .field.wide { flex-basis: 100%; }
  .filters-row .actions { width: 100%; }
  .filters-row .actions .btn-x { flex: 1; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chips::-webkit-scrollbar { display: none; }
}

/* ===================== البطاقات والعناصر ===================== */
.panel { background: var(--surface-hi), var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.panel.report-card { display: block; color: inherit; height: 100%; transition: transform .18s, border-color .18s, box-shadow .18s; }
.panel.report-card:hover { transform: translateY(-2px); border-color: var(--gold-line); box-shadow: 0 16px 34px -16px rgba(0,0,0,.7), 0 0 0 1px rgba(224,165,46,.15); }
.panel.report-card .rc-arrow { margin-inline-start: auto; color: var(--faint); transition: transform .18s, color .18s; }
.panel.report-card:hover .rc-arrow { color: var(--gold-text); transform: translateX(-4px); }
.panel + .panel { margin-top: 14px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-title { font-size: 14.5px; font-weight: 600; color: var(--text-strong); margin: 0; }
.panel-head .panel-title::before { content: ""; display: inline-block; width: 3px; height: 14px; border-radius: 3px; background: var(--gold); margin-inline-end: 8px; vertical-align: -2px; opacity: .9; }
.panel-sub { font-size: 12px; color: var(--muted); }
.panel-head .actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-hi), var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .18s, border-color .18s; }
.kpi:hover { transform: translateY(-1px); border-color: var(--line-2); }
.kpi-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 24px; font-weight: 700; color: var(--text-strong); margin-top: 6px; letter-spacing: -.4px; line-height: 1.2; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-inline-start: 3px; }
.kpi-foot { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.kpi.gold { background: linear-gradient(160deg, rgba(224,165,46,.16), rgba(224,165,46,.03) 60%), var(--surface); border-color: var(--gold-line); }
.kpi.gold .kpi-value { color: var(--money); }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.hero {
  border-radius: 18px; padding: 20px 22px; border: 1px solid var(--gold-line); position: relative; overflow: hidden;
  background: radial-gradient(520px 220px at 10% 0%, rgba(242,191,85,.24), transparent 70%), linear-gradient(160deg, #251b0b, #151a21 70%);
  box-shadow: 0 20px 40px -22px rgba(224,165,46,.35), var(--shadow-sm);
}
.hero::after { content: ""; position: absolute; inset-inline-end: -60px; top: -80px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(224,165,46,.12), transparent 65%); pointer-events: none; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; margin-inline-start: 6px; vertical-align: middle; font-variant-numeric: tabular-nums; }
.delta.up { background: var(--success-soft); color: var(--success-text); }
.delta.down { background: var(--danger-soft); color: var(--danger-text); }
.delta.flat { background: rgba(255,255,255,.06); color: var(--muted); }
.lost-sales { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: rgba(224,85,63,.10); border: 1px solid rgba(224,85,63,.25); font-size: 12.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lost-sales .ls-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px rgba(224,85,63,.2); }
.lost-sales b { color: #f3b3aa; }
.hero .big { font-size: 34px; font-weight: 700; color: var(--money); letter-spacing: -.8px; }

.btn-x {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: var(--radius-sm);
  padding: 9px 16px; font: 600 13.5px var(--font); border: 1px solid transparent; cursor: pointer; transition: all .15s;
  background: #1c242e; color: var(--text); white-space: nowrap; text-decoration: none;
}
.btn-x:hover { background: #232d39; color: var(--text-strong); }
.btn-x:disabled, .btn-x.disabled { background: #1b222a; color: var(--faint); cursor: not-allowed; }
.btn-x:hover { transform: translateY(-1px); }
.btn-x:active { transform: translateY(0); }
.btn-gold { background: linear-gradient(180deg, #f0ba4e, #dc9f27); color: var(--on-gold); box-shadow: 0 6px 16px -6px rgba(224,165,46,.6), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-gold:hover { background: linear-gradient(180deg, #f6c65c, #e6a92e); color: var(--on-gold); box-shadow: 0 10px 22px -8px rgba(224,165,46,.7), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-x:disabled:hover, .btn-x.disabled:hover { transform: none; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--text-2); }
.btn-ghost:hover { background: rgba(255,255,255,.04); }
.btn-danger { background: var(--danger-soft); color: var(--danger-text); border-color: rgba(224,85,63,.35); }
.btn-danger:hover { background: rgba(224,85,63,.24); color: #f3b3aa; }
.btn-ok { background: var(--success-soft); color: var(--success-text); border-color: rgba(47,179,137,.35); }
.btn-sm-x { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-lg-x { padding: 13px 20px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }
.icon-btn { width: 34px; height: 34px; padding: 0; border-radius: 9px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.pill-ok { background: var(--success-soft); color: var(--success-text); }
.pill-bad { background: var(--danger-soft); color: var(--danger-text); }
.pill-warn { background: var(--gold-soft); color: var(--gold-text); }
.pill-info { background: var(--info-soft); color: #8cc4e8; }
.pill-muted { background: rgba(255,255,255,.06); color: var(--muted); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(62,207,158,.18); display: inline-block; }
.live-dot.off { background: var(--danger-2); box-shadow: 0 0 0 3px rgba(224,85,63,.18); }

/* ===================== النماذج ===================== */
.form-x label, .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.inp, .form-x input:not([type=checkbox]):not([type=radio]):not([type=color]), .form-x select, .form-x textarea {
  width: 100%; background: var(--input); border: 1px solid var(--line-2); border-radius: var(--radius-sm); color: var(--text);
  padding: 9px 12px; min-height: 40px; font: 400 14px var(--font); outline: none; transition: border .15s, box-shadow .15s, background .15s;
}
.inp:hover, .form-x input:hover, .form-x select:hover, .form-x textarea:hover { border-color: rgba(255,255,255,.16); }
.inp:focus, .form-x input:focus, .form-x select:focus, .form-x textarea:focus { border-color: var(--gold-line); box-shadow: var(--ring); background: #11171e; }
.inp::placeholder, .form-x input::placeholder, .form-x textarea::placeholder { color: var(--faint); }
select.inp, .form-x select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: 14px 55%, 19px 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-left: 30px; }
.inp-lg { font-size: 18px !important; padding: 12px 14px !important; font-weight: 600 !important; }
.field { margin-bottom: 12px; }
.hint { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.check input { accent-color: var(--gold); width: 16px; height: 16px; }
.search-box { position: relative; }
.search-box svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--faint); }
.search-box .inp { padding-inline-start: 38px; }

.seg { display: inline-flex; background: var(--side); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button, .seg label { padding: 6px 13px; border-radius: 8px; font-size: 12.5px; color: var(--muted); background: none; border: 0; cursor: pointer; font-family: var(--font); }
.seg .active, .seg input:checked + span { background: var(--gold-soft); color: var(--gold-text); box-shadow: inset 0 0 0 1px var(--gold-line); }
.seg label { padding: 0; }
.seg label span { display: block; padding: 6px 13px; border-radius: 8px; }
.seg input { display: none; }

.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.amount-btn {
  background: var(--input); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 6px; text-align: center; cursor: pointer;
  font: 600 15px var(--font); color: var(--text); transition: all .15s; font-variant-numeric: tabular-nums;
}
.amount-btn small { display: block; font-size: 10.5px; color: var(--faint); font-weight: 400; }
.amount-btn:hover { border-color: var(--gold-line); }
.amount-btn.active { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-text); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
.choice { background: var(--input); border: 1px solid var(--line-2); border-radius: 13px; padding: 12px; cursor: pointer; transition: all .15s; position: relative; }
.choice:hover { border-color: var(--gold-line); }
.choice.active { background: var(--gold-soft); border-color: var(--gold-line); }
.choice .t { font-weight: 600; font-size: 13.5px; }
.choice .s { font-size: 11.5px; color: var(--muted); }
.choice.disabled { opacity: .4; pointer-events: none; }
.choice .badge-x { position: absolute; top: 8px; inset-inline-end: 8px; }

/* ===================== الجداول ===================== */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { background: #121921; color: var(--muted); font-weight: 600; font-size: 11.5px; letter-spacing: .2px; text-align: right; padding: 11px 12px; white-space: nowrap; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:nth-child(even) td { background: rgba(255,255,255,.012); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover td { background: rgba(224,165,46,.055); }
.tbl td:first-child { font-weight: 500; }
.tbl td.n, .tbl th.n { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { background: var(--surface-2); font-weight: 600; }
.tbl .pos { color: var(--success); }
.tbl .neg { color: var(--danger); }
.tbl-compact td, .tbl-compact th { padding: 7px 10px; }
.empty { text-align: center; padding: 30px 12px; color: var(--faint); border: 1px dashed var(--line-2); border-radius: 12px; font-size: 13px; }

/* ===================== البطاقة المرئية ===================== */
.card-visual {
  border-radius: 17px; padding: 18px 20px; min-height: 150px; color: #fff; position: relative; overflow: hidden;
  box-shadow: 0 18px 40px rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.08);
}
.card-visual::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.06); top: -90px; left: -60px; }
.card-visual .cv-brand { font-size: 11px; letter-spacing: 2px; opacity: .8; }
.card-visual .cv-num { font-size: 20px; font-weight: 600; letter-spacing: 2px; margin-top: 18px; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.card-visual .cv-name { font-size: 13px; opacity: .9; }
.card-visual .cv-bal { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.chip { width: 22px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: middle; }

/* ===================== أخرى ===================== */
.feed-item { display: flex; align-items: center; gap: 11px; padding: 9px 6px; margin: 0 -6px; border-bottom: 1px solid var(--line); border-radius: 10px; transition: background .12s; }
.feed-item:hover { background: rgba(255,255,255,.03); }
.feed-item:last-child { border-bottom: 0; }
.feed-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; flex: 0 0 34px; }
.feed-icon.ok { background: var(--success-soft); color: var(--success); }
.feed-icon.bad { background: var(--danger-soft); color: var(--danger); }
.feed-icon.gold { background: var(--gold-soft); color: var(--gold); }
.feed-main { flex: 1; min-width: 0; }
.feed-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-meta { font-size: 11.5px; color: var(--faint); }
.feed-amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.feed-new { animation: riseIn .35s ease-out; }

.alert-x { border-radius: 12px; padding: 11px 14px; font-size: 13px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; }
.alert-ok { background: var(--success-soft); color: var(--success-text); border: 1px solid rgba(47,179,137,.3); }
.alert-bad { background: var(--danger-soft); color: var(--danger-text); border: 1px solid rgba(224,85,63,.3); }
.alert-warn { background: var(--gold-soft); color: var(--gold-text); border: 1px solid var(--gold-line); }
.alert-info { background: var(--info-soft); color: #9fd0f0; border: 1px solid rgba(47,127,179,.35); }

.summary-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line-2); }
.summary-row:last-child { border-bottom: 0; }
.summary-row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-row.total { font-size: 15.5px; padding-top: 11px; }
.summary-row.total .v { color: var(--money); }

.receipt { background: #131c19; border: 1px solid rgba(47,179,137,.3); border-radius: 16px; padding: 20px; }
.receipt-box { border: 1px dashed rgba(255,255,255,.15); border-radius: 12px; padding: 12px 14px; margin: 14px 0; }
.receipt-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 10px; color: var(--text-2); font-size: 13px; }
.receipt-brand img { height: 34px; max-width: 120px; object-fit: contain; }
.success-mark { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--success-soft); color: var(--success); margin: 0 auto 10px; font-size: 28px; }

.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.step { flex: 1; }
.step .bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); }
.step.done .bar, .step.cur .bar { background: var(--gold); }
.step .t { font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.step.cur .t { color: var(--gold-text); }

.scan-zone {
  border: 1.5px dashed var(--gold-line); border-radius: 16px; padding: 26px; text-align: center;
  background: radial-gradient(300px 120px at 50% 0%, rgba(224,165,46,.12), transparent 70%);
}
.scan-icon { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 10px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); animation: scanpulse 1.8s infinite; }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast-x { background: #1c2530; color: var(--text); border-radius: 12px; padding: 11px 18px; box-shadow: 0 14px 34px rgba(0,0,0,.5); font-size: 13.5px; animation: riseIn .25s ease-out; border: 1px solid var(--line-2); max-width: 90vw; }
.toast-x.ok { border-color: rgba(47,179,137,.45); }
.toast-x.bad { border-color: rgba(224,85,63,.5); color: #f3b3aa; }

.modal-x { position: fixed; inset: 0; background: rgba(5,7,10,.7); backdrop-filter: blur(3px); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-x.open { display: flex; }
.modal-box { background: var(--app); border: 1px solid var(--line-2); border-radius: 18px; width: 100%; max-width: 520px; box-shadow: var(--shadow); max-height: 92vh; overflow-y: auto; animation: riseIn .2s ease-out; }
.modal-head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15.5px; margin: 0; font-weight: 600; }
.modal-head .x { margin-inline-start: auto; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-start; }

.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 34px; height: 32px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 12.5px; }
.pager .cur { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-text); }

.progress-x { height: 7px; border-radius: 7px; background: rgba(255,255,255,.07); overflow: hidden; }
.progress-x > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dark), var(--gold)); border-radius: 7px; }

.heat { display: grid; grid-template-columns: 52px repeat(24, 1fr); gap: 2px; font-size: 10px; }
.heat div { height: 22px; border-radius: 4px; display: grid; place-items: center; color: var(--faint); }
.heat .c { background: rgba(224,165,46,var(--a)); color: transparent; }
.heat .c:hover { outline: 1px solid var(--gold); color: var(--on-gold); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 920px; display: grid; grid-template-columns: 1.1fr 1fr; border-radius: 24px; overflow: hidden; border: 1px solid var(--line-2); box-shadow: var(--shadow); background: var(--app); animation: riseIn .35s ease-out; }
.login-side { padding: 40px 36px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; min-height: 520px;
  background: radial-gradient(560px 300px at 15% 0%, rgba(242,191,85,.28), transparent 65%), linear-gradient(160deg, #2a1f0c, #121820 65%); border-inline-end: 1px solid var(--line); }
.login-side::after { content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%; inset-inline-end: -160px; bottom: -200px; background: radial-gradient(circle, rgba(224,165,46,.16), transparent 65%); }
.login-side .ls-brand { display: flex; align-items: center; gap: 14px; }
.login-side h1 { font-size: 24px; margin: 26px 0 8px; font-weight: 700; color: var(--text-strong); }
.login-side p { color: var(--text-2); font-size: 13.5px; line-height: 1.8; margin: 0; }
.login-feats { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; }
.login-feats li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.login-feats .fi { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); flex: 0 0 30px; }
.login-side .ls-foot { font-size: 11.5px; color: var(--faint); position: relative; }
.login-form { padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }
.login-form h2 { font-size: 20px; margin: 0 0 4px; font-weight: 700; }
.login-form .lf-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 22px; }
.login-box { width: 100%; max-width: 400px; }
@media (max-width: 860px) { .login-card { grid-template-columns: 1fr; max-width: 440px; } .login-side { min-height: 0; padding: 26px 22px; } .login-feats { display: none; } .login-side h1 { font-size: 19px; margin-top: 14px; } .login-form { padding: 24px 22px 28px; } }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 1100px) { .grid-main, .grid-3 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-x { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mt-14 { margin-top: 14px; }

@keyframes scanpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224,165,46,.35); } 50% { box-shadow: 0 0 0 14px rgba(224,165,46,0); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .no-print, .toast-wrap { display: none !important; }
  .content { padding: 0; }
  .panel, .kpi, .table-wrap { border-color: #ccc; background: #fff; color: #000; }
  .tbl th { background: #eee; color: #000; }
  .tbl td, .kpi-value, .panel-title { color: #000; }
  .panel, .kpi { box-shadow: none; }
  .delta, .lost-sales { display: none; }
}


/* ===== عرض الهدية على شاشة الكاشير ===== */
.offer-banner{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:12px;border:1px solid rgba(224,165,46,.45);background:linear-gradient(120deg,rgba(224,165,46,.16),rgba(224,165,46,.04))}
.offer-banner .ob-icon{font-size:26px;line-height:1}
.offer-banner .ob-main{flex:1;min-width:0}
.offer-banner .ob-title{font-weight:700;color:var(--gold-text,#f3c767);font-size:14px}
.offer-banner .ob-sub{font-size:12.5px;color:var(--muted);margin-top:2px}
.text-warn{color:#f0b35a!important}
.text-gold{color:var(--gold-text,#f3c767)}

/* ===== الرصيد المتبقي على الإيصال (كبير ليقرأه الزبون) ===== */
.receipt-balance{margin:14px 0;padding:16px;border-radius:14px;text-align:center;border:1px solid rgba(224,165,46,.4);background:linear-gradient(160deg,rgba(224,165,46,.14),rgba(224,165,46,.03))}
.receipt-balance .rb-label{font-size:12.5px;color:var(--muted)}
.receipt-balance .rb-value{font-size:40px;font-weight:800;line-height:1.15;color:var(--gold-text,#f3c767);letter-spacing:.5px}
.receipt-balance .rb-value small{font-size:15px;font-weight:600;color:var(--muted)}
.receipt-balance .rb-offer{margin-top:8px;font-size:13px;font-weight:600;color:var(--text)}
.receipt-balance .rb-foot{margin-top:6px;font-size:11.5px;color:var(--faint)}
@media print{.receipt-balance{border-color:#000;background:none}.receipt-balance .rb-value{color:#000}.receipt-balance .rb-label,.receipt-balance .rb-foot{color:#333}}

/* ===== لوحة الكاشير ===== */
.cashier-hero{display:flex;flex-wrap:wrap;gap:14px;align-items:stretch}
.cashier-hero .hero{flex:2 1 320px}
.cashier-hero .kpi{flex:1 1 220px}
.quick-actions{display:flex;flex-wrap:wrap;gap:10px}
.quick-actions .btn-x{flex:1 1 160px;justify-content:center;padding:14px 16px;font-size:15px}
.low-row{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--line)}
.low-row:last-child{border-bottom:0}
.low-row .lr-bal{font-weight:700;color:#f0b35a}
