/* لوحة تحكم سلّة ظلال — يعتمد على ../assets/css/brand.css */
:root {
  --sb-w: 272px;
  --tb-h: 72px;
  --bg: #FAF9FC;
}
html, body { height: 100%; }
body { background: var(--bg); font-size: 14.5px; overflow-x: hidden; }
[hidden] { display: none !important; }
svg.lucide { width: 20px; height: 20px; stroke-width: 1.8; flex: none; }

/* ===== الهيكل ===== */
.shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 28px 32px 48px; max-width: 1480px; width: 100%; margin-inline: auto; outline: none; }

/* ===== الشريط الجانبي ===== */
.sidebar {
  width: var(--sb-w); flex: none; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 14px; padding: 22px 16px 16px;
  background: radial-gradient(120% 60% at 100% 0%, rgba(150,120,180,.35) 0%, transparent 60%),
              radial-gradient(90% 50% at 0% 100%, rgba(31,163,189,.22) 0%, transparent 60%),
              var(--navy-900);
  color: #E6E7F2; overflow-y: auto; z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sb-brand img { width: 40px; height: auto; }
.sb-brand strong { display: block; font-family: var(--font-display); font-size: 1.2rem; color: #fff; line-height: 1.2; }
.sb-brand span { font-size: .75rem; color: #A7ABCB; }
.icon-btn.sb-close { display: none; margin-inline-start: auto; color: #fff; background: rgba(255,255,255,.08); border: 0; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sb-group { font-size: .7rem; font-weight: 600; letter-spacing: .02em; color: #7F84A8; padding: 14px 12px 6px; }
.sb-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: #C9CCE2; font-weight: 500; transition: background .15s, color .15s; position: relative;
}
.sb-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-nav a.active { background: linear-gradient(90deg, rgba(31,163,189,.18), rgba(150,120,180,.32)); color: #fff; }
.sb-nav a.active::before {
  content: ""; position: absolute; inset-inline-start: -16px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--teal);
}
.sb-nav a.active svg { color: var(--teal); }
.sb-count {
  margin-inline-start: auto; font-style: normal; font-size: .72rem; font-weight: 700;
  background: rgba(60,192,216,.18); color: #8FE3F2; padding: 1px 8px; border-radius: 999px;
}
.sb-count.warn { background: rgba(224,160,48,.2); color: #F5C76E; }
.sb-help {
  display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
}
.sb-help svg { color: var(--teal); }
.sb-help strong { display: block; color: #fff; font-size: .85rem; }
.sb-help span { font-size: .75rem; color: #A7ABCB; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-info strong { display: block; color: #fff; font-size: .88rem; }
.sb-user-info span { font-size: .75rem; color: #A7ABCB; }
.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--grad); color: #fff; font-weight: 700; font-family: var(--font-display); font-size: 1.05rem;
}
.avatar.sm { width: 38px; height: 38px; border-radius: 50%; }
.avatar.soft { background: var(--purple-50); color: var(--purple-700); }
.avatar.teal { background: var(--teal-50); color: var(--teal-700); }
.sb-backdrop { display: none; }

/* ===== الشريط العلوي ===== */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--tb-h);
  display: flex; align-items: center; gap: 18px; padding: 0 32px;
  background: rgba(250,249,252,.86); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.icon-btn.menu-btn { display: none; }
.tb-title { min-width: 0; }
.tb-title .crumb { font-size: .75rem; color: var(--ink-3); }
.tb-title h1 { font-size: 1.3rem; margin: 0; white-space: nowrap; }
.tb-search {
  flex: 1; max-width: 420px; margin-inline-start: auto; display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
.tb-search:focus-within { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(150,120,180,.14); }
.tb-search svg { color: var(--ink-3); width: 18px; }
.tb-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: .9rem; }
.tb-search kbd {
  font-family: var(--font); font-size: .72rem; color: var(--ink-3); border: 1px solid var(--line);
  border-radius: 6px; padding: 0 6px; background: var(--bg);
}
.tb-actions { display: flex; align-items: center; gap: 10px; }
.date-range {
  display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2);
}
.date-range svg { width: 18px; color: var(--purple-600); }
.date-range select { border: 0; outline: 0; background: transparent; font-size: .85rem; font-weight: 500; cursor: pointer; }
.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2); cursor: pointer; position: relative;
  transition: border-color .15s, color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--purple); color: var(--purple-700); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.icon-btn.ghost-dark { background: transparent; border-color: rgba(255,255,255,.12); color: #C9CCE2; width: 36px; height: 36px; }
.icon-btn.ghost-dark:hover { color: #fff; border-color: rgba(255,255,255,.3); }
.bell .dot { position: absolute; top: 9px; inset-inline-end: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid #fff; }
.notif-wrap { position: relative; }
.notif-pop {
  position: absolute; top: 52px; inset-inline-end: 0; width: 340px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 50;
}
.notif-pop header { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; }
.notif-pop header strong { font-family: var(--font-display); color: var(--navy); }
.notif-item { display: flex; gap: 10px; padding: 10px; border-radius: 12px; }
.notif-item:hover { background: var(--bg); }
.notif-item p { margin: 0; font-size: .85rem; line-height: 1.5; }
.notif-item small { color: var(--ink-3); font-size: .75rem; }

/* ===== رأس الصفحة ===== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h2 { font-size: 1.55rem; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--ink-2); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== الشبكات ===== */
.grid { display: grid; gap: 20px; }
.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 20px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mb { margin-bottom: 20px; }
.span-2 { grid-column: span 2; }

/* ===== البطاقات ===== */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 22px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { font-size: 1.08rem; margin: 0; }
.panel-head p { margin: 2px 0 0; font-size: .82rem; color: var(--ink-3); }
.panel.flush { padding: 0; }
.panel.flush .panel-head { padding: 20px 22px 0; }

.kpi { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--purple-50); color: var(--purple-600); }
.kpi-ico.teal { background: var(--teal-50); color: var(--teal-600); }
.kpi-ico.gold { background: #FCF3E1; color: #B07A12; }
.kpi-ico.navy { background: #E8E9F2; color: var(--navy); }
.kpi-label { font-size: .82rem; color: var(--ink-2); font-weight: 500; }
.kpi-val { font-family: var(--font-display); font-size: 1.65rem; font-weight: 800; color: var(--navy); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-val small { font-size: .85rem; font-weight: 700; color: var(--ink-3); margin-inline-start: 4px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.delta.up { background: var(--ok-50); color: var(--ok); }
.delta.down { background: var(--bad-50); color: var(--bad); }
.delta.flat { background: #EEF0F6; color: var(--ink-2); }
.delta svg { width: 13px; height: 13px; }
.kpi-sub { font-size: .75rem; color: var(--ink-3); }

.hero-panel {
  background: var(--grad); color: #fff; border: 0; position: relative; overflow: hidden;
}
.hero-panel::after {
  content: ""; position: absolute; inset-inline-end: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%;
  border: 40px solid rgba(255,255,255,.08);
}
.hero-panel h3, .hero-panel strong { color: #fff; }

/* ===== المخططات ===== */
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 230px; }
.chart-box.xs { height: 190px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: .88rem; }
.legend-row i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.legend-row b { margin-inline-start: auto; color: var(--navy); font-variant-numeric: tabular-nums; }
.legend-row small { color: var(--ink-3); min-width: 42px; text-align: left; }
.donut-wrap { position: relative; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center strong { display: block; font-family: var(--font-display); font-size: 1.6rem; color: var(--navy); line-height: 1; }
.donut-center span { font-size: .78rem; color: var(--ink-3); }
.seg-btns { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg-btns button { border: 0; background: transparent; padding: 5px 12px; border-radius: 999px; font-size: .8rem; color: var(--ink-2); cursor: pointer; font-weight: 500; }
.seg-btns button.on { background: #fff; color: var(--purple-700); box-shadow: var(--shadow-sm); font-weight: 600; }

/* ===== الجداول ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; min-width: 640px; }
.tbl th {
  text-align: right; font-weight: 600; color: var(--ink-3); font-size: .78rem; padding: 11px 14px;
  background: var(--bg); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl th:first-child { border-start-start-radius: 12px; }
.tbl th:last-child { border-start-end-radius: 12px; }
.tbl td { padding: 13px 14px; border-bottom: 1px solid #F0EEF5; vertical-align: middle; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #FBFAFD; }
.tbl tbody tr.click { cursor: pointer; }
.tbl .num, .tbl td.num { font-variant-numeric: tabular-nums; }
.panel.flush .table-wrap { padding: 0 10px 10px; }
.who { display: flex; align-items: center; gap: 10px; }
.who .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: .9rem; }
.who strong { display: block; color: var(--navy); font-weight: 600; }
.who small { color: var(--ink-3); font-size: .75rem; }
.amt { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.amt.plus { color: var(--ok); }
.muted { color: var(--ink-3); }
.mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: .82rem; direction: ltr; unicode-bidi: isolate; }
.tier { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font-weight: 800; font-family: var(--font-display); font-size: .9rem; }
.tier.a { background: #EFE9F6; color: #6A4D92; }
.tier.b { background: #E4F5F9; color: #157C91; }
.tier.c { background: #FBF0DC; color: #9A6A10; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ===== أدوات التصفية ===== */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.field-search {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 0 12px; height: 40px; min-width: 240px; flex: 1; max-width: 360px;
}
.field-search svg { width: 17px; color: var(--ink-3); }
.field-search input { border: 0; outline: 0; flex: 1; min-width: 0; background: transparent; font-size: .88rem; }
.select, .input {
  height: 40px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 0 12px;
  font-size: .88rem; color: var(--ink); outline: none;
}
.select:focus, .input:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(150,120,180,.14); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); padding: 6px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 500; cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.chip b { font-weight: 700; color: var(--ink-3); font-size: .75rem; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.on b { color: #B9BDE0; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.view-toggle button { border: 0; background: transparent; width: 40px; height: 38px; display: grid; place-items: center; cursor: pointer; color: var(--ink-3); }
.view-toggle button.on { background: var(--purple-50); color: var(--purple-700); }
.btn-sm svg { width: 16px; height: 16px; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #B83748; }
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 8px 20px rgba(30,158,106,.25); }
.btn-ok:hover { background: #178556; }
.btn-soft { background: var(--purple-50); color: var(--purple-700); }
.btn-soft:hover { background: var(--purple-100); }
.link { color: var(--purple-600); font-weight: 600; font-size: .85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; }
.link svg { width: 16px; height: 16px; }

/* ===== كانبان ===== */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #F3F1F8; border-radius: 18px; padding: 12px; min-height: 300px; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; font-weight: 700; color: var(--navy); font-size: .9rem; }
.kcol-head .n { margin-inline-start: auto; background: #fff; border-radius: 999px; padding: 0 10px; font-size: .75rem; color: var(--ink-2); }
.kcol-head .bar { width: 8px; height: 8px; border-radius: 50%; }
.kcard {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px;
  cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; display: block; width: 100%; text-align: right;
}
.kcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--purple-100); }
.kcard .k-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.kcard strong { color: var(--navy); font-size: .92rem; }
.kcard .meta { display: flex; gap: 12px; color: var(--ink-3); font-size: .76rem; flex-wrap: wrap; }
.kcard .meta span { display: inline-flex; align-items: center; gap: 4px; }
.kcard .meta svg { width: 14px; height: 14px; }
.kcard .k-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .76rem; color: var(--ink-3); }
.score-pill { font-weight: 700; color: var(--purple-700); background: var(--purple-50); border-radius: 999px; padding: 1px 8px; font-size: .74rem; }
.kmore { text-align: center; font-size: .78rem; color: var(--ink-3); padding: 6px; }

/* ===== الدرج الجانبي ===== */
.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(25,29,58,.42); backdrop-filter: blur(2px); z-index: 80; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: min(520px, 100vw); background: #fff; z-index: 90;
  box-shadow: var(--shadow-lg); transform: translateX(-102%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer-head h3 { margin: 0; font-size: 1.2rem; }
.drawer-head p { margin: 2px 0 0; color: var(--ink-3); font-size: .82rem; }
.drawer-head .icon-btn { margin-inline-start: auto; }
.drawer-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; background: #FCFBFE; flex-wrap: wrap; }
.drawer-foot .btn { flex: 1; }
.dl { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 16px; margin: 0 0 20px; }
.dl div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.dl dt { font-size: .74rem; color: var(--ink-3); }
.dl dd { margin: 2px 0 0; font-weight: 600; color: var(--navy); font-size: .9rem; }
.sec-title { font-family: var(--font-display); font-weight: 700; color: var(--navy); font-size: 1rem; margin: 6px 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-title svg { color: var(--purple-600); width: 18px; }
.score-row { display: grid; grid-template-columns: 1fr 120px 52px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .86rem; }
.score-row small { display: block; color: var(--ink-3); font-size: .74rem; }
.score-row .pts { text-align: left; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 999px; background: #EEEBF4; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--purple-600); }
.meter.teal > i { background: var(--teal-600); }
.meter.gold > i { background: var(--gold); }
.meter.lg { height: 10px; }
.score-total {
  margin-top: 16px; border-radius: 16px; padding: 16px; display: flex; align-items: center; gap: 14px;
  background: var(--grad-soft); border: 1px solid var(--purple-100);
}
.score-total .big { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1; }
.score-total .tier { width: 46px; height: 46px; font-size: 1.3rem; border-radius: 14px; }
.scale { display: flex; margin-top: 10px; font-size: .72rem; color: var(--ink-3); gap: 4px; }
.scale span { flex: 1; text-align: center; padding: 4px; border-radius: 8px; background: var(--bg); }
.scale span.on { background: var(--navy); color: #fff; font-weight: 700; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 22px 16px 0; font-size: .86rem; }
.timeline li::before { content: ""; position: absolute; right: 4px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--purple-100); border: 2px solid var(--purple-600); }
.timeline li::after { content: ""; position: absolute; right: 8.5px; top: 22px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline small { display: block; color: var(--ink-3); }
.docs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.doc { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: .8rem; }
.doc svg { width: 16px; color: var(--ok); }
.doc.miss svg { color: var(--warn); }
.note-box { width: 100%; min-height: 80px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; outline: none; font-size: .88rem; }
.note-box:focus { border-color: var(--purple); }

/* ===== النوافذ ===== */
.modal-backdrop { display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.modal { background: #fff; border-radius: 24px; width: min(980px, 100%); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .22s ease; max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.modal.sm { width: min(520px, 100%); }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 22px 26px; display: flex; gap: 14px; align-items: center; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 1.25rem; }
.modal-head p { margin: 0; color: var(--ink-3); font-size: .84rem; }
.modal-head .icon-btn { margin-inline-start: auto; }
.modal-body { padding: 22px 26px; overflow-y: auto; }
.modal-foot { padding: 16px 26px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: #FCFBFE; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: .9rem; }
.tabs button.on { color: var(--purple-700); border-color: var(--purple-600); }

/* ===== البطاقة الرقمية ===== */
.zcard {
  position: relative; overflow: hidden; border-radius: 20px; padding: 20px; color: #fff; min-height: 190px;
  background: radial-gradient(120% 120% at 0% 100%, rgba(60,192,216,.55), transparent 55%), linear-gradient(135deg, #7E5FA6, #303666);
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 16px 36px rgba(48,54,102,.28);
}
.zcard::before { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; border: 30px solid rgba(255,255,255,.07); top: -90px; left: -60px; }
.zcard .zc-top { display: flex; justify-content: space-between; align-items: center; position: relative; }
.zcard .zc-top img { width: 30px; }
.zcard .zc-no { font-family: ui-monospace, Menlo, monospace; letter-spacing: .12em; font-size: 1.05rem; direction: ltr; text-align: right; position: relative; }
.zcard .zc-bal { position: relative; }
.zcard .zc-bal small { opacity: .75; font-size: .75rem; display: block; }
.zcard .zc-bal strong { font-family: var(--font-display); font-size: 1.6rem; color: #fff; }
.zcard.frozen { filter: grayscale(.85); }
.zcard .frozen-tag { position: absolute; inset: auto 16px 16px auto; background: rgba(255,255,255,.18); padding: 2px 10px; border-radius: 999px; font-size: .75rem; }
.qr { width: 64px; height: 64px; background: #fff; border-radius: 10px; padding: 6px; display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; }
.qr i { background: var(--navy); border-radius: 1px; }
.qr i.o { background: transparent; }

/* ===== الشحن ===== */
.calc-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid #F0EEF5; font-size: .9rem; }
.calc-row.head { font-size: .76rem; color: var(--ink-3); font-weight: 600; padding: 8px 0; }
.calc-row .amt { text-align: left; }
.calc-total { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding: 18px; border-radius: 16px; background: var(--navy); color: #fff; }
.calc-total strong { font-family: var(--font-display); font-size: 1.7rem; color: #fff; }
.calc-total small { color: #B9BDE0; }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--ink-3); font-weight: 600; }
.step b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); font-size: .78rem; }
.step.done b { background: var(--ok); color: #fff; border-color: var(--ok); }
.step.cur { color: var(--navy); }
.step.cur b { background: var(--purple-600); color: #fff; border-color: var(--purple-600); }
.step + .step::before { content: ""; width: 24px; height: 1px; background: var(--line); }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: .88rem; }
.check svg { color: var(--ok); width: 18px; }
.check.w svg { color: var(--warn); }

/* ===== السلال ===== */
.basket { display: flex; flex-direction: column; gap: 12px; }
.basket-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--grad-soft); color: var(--purple-700); }
.basket-ico svg { width: 26px; height: 26px; }
.basket h4 { margin: 0; font-size: 1.05rem; }
.items { display: flex; flex-wrap: wrap; gap: 6px; }
.items span { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; font-size: .76rem; color: var(--ink-2); }
.basket-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); margin-top: auto; }
.price { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: var(--navy); }
.price small { font-size: .8rem; color: var(--ink-3); font-weight: 600; }
.progress-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) 2fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid #F0EEF5; }
.progress-row:last-child { border: 0; }
.progress-row strong { display: block; color: var(--navy); font-size: .9rem; }
.progress-row small { color: var(--ink-3); font-size: .76rem; }
.pct { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; min-width: 48px; text-align: left; }
.code { font-family: ui-monospace, Menlo, monospace; background: var(--navy); color: #fff; padding: 2px 10px; border-radius: 8px; font-size: .8rem; letter-spacing: .08em; direction: ltr; display: inline-block; }

/* ===== الشركاء ===== */
.partner-card { display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.partner-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.partner-card.panda { --c: var(--panda); } .partner-card.othaim { --c: var(--othaim); }
.partner-card.danube { --c: var(--danube); } .partner-card.tamimi { --c: var(--tamimi); }
.partner-name { display: flex; align-items: center; gap: 10px; }
.partner-name .pmark { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; color: #fff; background: var(--c); font-size: 1.2rem; }
.partner-name h4 { margin: 0; font-size: 1.15rem; }
.partner-name small { color: var(--ink-3); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stats div { background: var(--bg); border-radius: 12px; padding: 8px 10px; }
.mini-stats small { display: block; font-size: .72rem; color: var(--ink-3); }
.mini-stats b { color: var(--navy); font-variant-numeric: tabular-nums; font-size: .95rem; }
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); font-size: .88rem; }
.cat .ci { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.cat.allow .ci { background: var(--ok-50); color: var(--ok); }
.cat.block .ci { background: var(--bad-50); color: var(--bad); }
.cat .ci svg { width: 17px; }
.cat .badge { margin-inline-start: auto; }

/* ===== مفاتيح ===== */
.switch { position: relative; width: 42px; height: 24px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #D9D6E3; cursor: pointer; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--teal-600); }
.switch input:checked + span::after { transform: translateX(-18px); }
.switch input:focus-visible + span { outline: 3px solid rgba(60,192,216,.5); outline-offset: 2px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid #F0EEF5; }
.set-row:last-child { border: 0; }
.set-row .grow { flex: 1; min-width: 0; }
.set-row strong { display: block; color: var(--navy); font-size: .92rem; }
.set-row small { color: var(--ink-3); font-size: .8rem; }
.money-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; height: 40px; }
.money-input input { border: 0; outline: 0; width: 90px; padding: 0 10px; text-align: center; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.money-input span { background: var(--bg); padding: 0 10px; height: 100%; display: grid; place-items: center; font-size: .8rem; color: var(--ink-3); border-inline-start: 1px solid var(--line); }
.tier-edit { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px; }
.tier-edit .tier { width: 42px; height: 42px; font-size: 1.15rem; border-radius: 12px; }
.role-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.role { border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.role strong { display: block; color: var(--navy); }
.role small { color: var(--ink-3); font-size: .78rem; }
.perm-tbl td:not(:first-child), .perm-tbl th:not(:first-child) { text-align: center; }
.perm-yes { color: var(--ok); } .perm-no { color: #C9C6D6; }

/* ===== المهام / التنبيهات ===== */
.task { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #F0EEF5; align-items: flex-start; }
.task:last-child { border: 0; }
.task .ti { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.task .ti svg { width: 18px; }
.task .ti.warn { background: var(--warn-50); color: var(--warn); }
.task .ti.bad { background: var(--bad-50); color: var(--bad); }
.task .ti.ok { background: var(--ok-50); color: var(--ok); }
.task .ti.info { background: var(--teal-50); color: var(--teal-700); }
.task p { margin: 0; font-size: .88rem; color: var(--ink); line-height: 1.5; font-weight: 500; }
.task small { color: var(--ink-3); font-size: .76rem; }
.task .link { margin-inline-start: auto; flex: none; align-self: center; }

/* ===== التقارير ===== */
.report { display: flex; flex-direction: column; gap: 12px; }
.report .r-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--purple-50); color: var(--purple-600); }
.report h4 { margin: 0; font-size: 1rem; }
.report p { font-size: .84rem; color: var(--ink-2); margin: 0; }
.report .r-foot { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.impact { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; position: relative; z-index: 1; }
.impact div strong { display: block; font-family: var(--font-display); font-size: 1.9rem; line-height: 1.1; }
.impact div span { font-size: .84rem; opacity: .85; }

/* ===== الحملات ===== */
.campaign { display: flex; flex-direction: column; gap: 10px; }
.campaign-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.campaign h4 { margin: 0; font-size: 1rem; }
.campaign .nums { display: flex; justify-content: space-between; font-size: .82rem; color: var(--ink-3); }
.campaign .nums b { color: var(--navy); }

/* ===== إشعار ===== */
.toast-wrap { position: fixed; bottom: 24px; left: 24px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--navy-900); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; font-size: .88rem; animation: pop .22s ease; max-width: 360px;
}
.toast svg { color: var(--teal); }
.toast.ok svg { color: #5BD6A3; }
.toast.bad svg { color: #F28A98; }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-3); }
.empty svg { width: 36px; height: 36px; color: var(--purple-100); margin-bottom: 8px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; font-size: .82rem; color: var(--ink-3); border-top: 1px solid var(--line); flex-wrap: wrap; gap: 8px; }
.pager .pg { display: flex; gap: 4px; }
.pager .pg button { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: .82rem; }
.pager .pg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.row-actions { display: flex; gap: 6px; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 16px; }
.stat-inline { display: flex; gap: 24px; flex-wrap: wrap; }
.stat-inline div small { display: block; color: var(--ink-3); font-size: .76rem; }
.stat-inline div b { font-family: var(--font-display); font-size: 1.25rem; color: var(--navy); font-variant-numeric: tabular-nums; }
.view-enter { animation: fadeUp .3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== الاستجابة ===== */
@media (max-width: 1360px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .role-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 1180px) {
  .g-main, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .g-3.keep { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .span-2 { grid-column: auto; }
  .tb-search { max-width: 280px; }
}
@media (max-width: 1023px) {
  .sidebar {
    position: fixed; top: 0; right: 0; bottom: 0; transform: translateX(105%);
    transition: transform .28s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow-lg); z-index: 100;
  }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(25,29,58,.45); z-index: 95; }
  .icon-btn.sb-close { display: inline-grid; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 0 20px; gap: 12px; }
  .content { padding: 22px 20px 40px; }
  .date-range select { max-width: 120px; }
}
@media (max-width: 780px) {
  .tb-search { display: none; }
  .tb-actions { margin-inline-start: auto; }
  .tb-user { display: none; }
  .g-2, .g-3.keep, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .impact { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .role-grid { grid-template-columns: minmax(0,1fr); }
  .dl { grid-template-columns: minmax(0,1fr); }
  .progress-row { grid-template-columns: 1fr auto; }
  .progress-row .meter { grid-column: 1 / -1; grid-row: 2; }
  .tier-edit { grid-template-columns: auto 1fr; }
  .calc-row { grid-template-columns: 1.3fr .8fr .8fr 1.1fr; font-size: .82rem; }
  .field-search { max-width: none; min-width: 0; }
}
@media (max-width: 480px) {
  .content { padding: 18px 16px 36px; }
  .topbar { padding: 0 16px; }
  .date-range { display: none; }
  .panel { padding: 16px; border-radius: 18px; }
  .kpi-val { font-size: 1.35rem; }
  .page-head h2 { font-size: 1.3rem; }
  .modal-backdrop { padding: 10px; }
  .modal-head, .modal-body, .modal-foot { padding-inline: 16px; }
}
