:root {
  --bg: #f5f5f6;
  --surface: #ffffff;
  --surface-2: #eeeff0;
  --text: #1d1f21;
  --muted: #5f6366;
  --line: #e1e2e4;
  /* ألوان الشعار: أحمر سحر الحياة + الرمادي */
  --primary: #a8131f;
  --primary-ink: #ffffff;
  --primary-soft: #fbe8ea;
  --hero: #54585a;
  --hero-ink: #ffffff;
  --chart-sales: #8c9195;
  --chart-profit: #a8131f;
  --pie1: #a8131f; --pie2: #18794e; --pie3: #2f6db5; --pie4: #946200; --pie5: #54585a; --pie6: #8e5bb5;
  --green: #18794e;
  --green-soft: #e3f4ea;
  --amber: #946200;
  --amber-soft: #fdf1d6;
  --red: #c62828;
  --red-soft: #fbe6e6;
  --shadow: 0 1px 2px rgba(16, 32, 31, .06), 0 4px 16px rgba(16, 32, 31, .06);
  --radius: 14px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111213;
    --surface: #1b1c1e;
    --surface-2: #242628;
    --text: #ecedee;
    --muted: #9a9ea2;
    --line: #2c2e31;
    --primary: #d63f4b;
    --primary-ink: #ffffff;
    --primary-soft: #3a1a1d;
    --hero: #3a3d40;
    --hero-ink: #ffffff;
    --chart-sales: #8f9498;
    --chart-profit: #e5525d;
    --pie1: #e5525d; --pie2: #4cc38a; --pie3: #6aa3e8; --pie4: #f0b44a; --pie5: #9a9ea2; --pie6: #b994e0;
    --green: #4cc38a;
    --green-soft: #15302a;
    --amber: #f0b44a;
    --amber-soft: #352c17;
    --red: #f07575;
    --red-soft: #3a1d1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- boot / spinner ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid transparent;
}
.topbar h1 { font-size: 20px; margin: 0; flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0;
  background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer; position: relative; flex: none;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot {
  position: absolute; top: 6px; left: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; line-height: 16px; text-align: center;
}
.emp-filter {
  border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: 12px;
  height: 40px; padding: 0 10px; max-width: 140px; font-size: 14px;
}

main.view {
  padding: 4px 16px calc(var(--tabbar-h) + var(--safe-b) + 90px);
  max-width: 720px; margin: 0 auto;
}

.tabbar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 500; position: relative;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--primary); }
.tabbar a .dot {
  position: absolute; top: 6px; left: calc(50% - 20px); min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; line-height: 16px; text-align: center;
}

.fab {
  position: fixed; z-index: 31; left: 18px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  width: 56px; height: 56px; border-radius: 18px; border: 0;
  background: var(--primary); color: var(--primary-ink);
  box-shadow: 0 6px 20px rgba(168, 19, 31, .35);
  display: grid; place-items: center; cursor: pointer;
}
.fab svg { width: 28px; height: 28px; }

/* ---------- blocks ---------- */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 2px 8px; font-size: 15px; font-weight: 700;
}
.section-title a, .section-title button { font-size: 13px; font-weight: 500; }
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px;
}
.card + .card { margin-top: 10px; }

.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); color: var(--text); cursor: pointer; width: 100%;
  background: none; border-inline: 0; border-top: 0; text-align: start;
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { text-align: end; flex: none; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700;
}

.badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.paid { background: var(--green-soft); color: var(--green); }
.badge.partial { background: var(--amber-soft); color: var(--amber); }
.badge.unpaid { background: var(--red-soft); color: var(--red); }
.badge.refund_due, .badge.r-ready { background: var(--amber-soft); color: var(--amber); }
.badge.r-received { background: var(--surface-2); color: var(--text); }
.badge.r-submitted, .badge.r-processing { background: var(--primary-soft); color: var(--primary); }
.badge.r-paid { background: var(--green-soft); color: var(--green); }
.badge.r-rejected { background: var(--red-soft); color: var(--red); }
.badge.neutral { background: var(--surface-2); color: var(--muted); }
.badge.void { background: var(--text); color: var(--bg); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 21px; font-weight: 700; margin-top: 2px; }
.kpi .value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi.wide { grid-column: 1 / -1; }
.kpi.accent { background: var(--hero); color: var(--hero-ink); }
.kpi.accent .label, .kpi.accent .value small { color: inherit; opacity: .85; }

.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.stat-strip > div { padding: 4px 8px; text-align: center; }
.stat-strip > div + div { border-inline-start: 1px solid var(--line); }
.stat-strip .label { font-size: 12px; color: var(--muted); }
.stat-strip .value { font-weight: 700; font-size: 16px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px;
  padding: 0 12px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search input { border: 0; background: none; outline: none; height: 44px; flex: 1; font-size: 16px; min-width: 0; }

.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty svg { width: 40px; height: 40px; opacity: .5; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; text-align: end; font-weight: 500; }

.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.actions.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.green { background: var(--green-soft); color: var(--green); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; font-weight: 500; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 10px 12px; font-size: 16px; min-height: 46px; outline: none;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field input[dir="ltr"] { text-align: right; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg label { flex: 1; }
.seg input { display: none; }
.seg span {
  display: block; text-align: center; padding: 8px 4px; border-radius: 10px; font-size: 14px; cursor: pointer; font-weight: 500;
}
.seg input:checked + span { background: var(--surface); box-shadow: var(--shadow); color: var(--primary); font-weight: 700; }
.preview {
  background: var(--primary-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px;
}
.preview b { font-weight: 700; }
.error-box { background: var(--red-soft); color: var(--red); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }

/* ---------- sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .35);
  opacity: 0; transition: opacity .2s;
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 51; inset-inline: 0; bottom: 0; max-height: 92vh;
  background: var(--bg); border-radius: 20px 20px 0 0;
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column; max-width: 720px; margin: 0 auto;
}
.sheet.open { transform: none; }
.sheet.tall { height: 92vh; }
.sheet-body { min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
/* البحث يفضل فوق والنتائج تتمرر تحته */
.picker .search { position: sticky; top: 0; z-index: 2; margin-bottom: 10px; box-shadow: 0 0 0 8px var(--bg), var(--shadow); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px 6px; }
.sheet-head::before {
  content: ""; position: absolute; top: 6px; left: calc(50% - 20px); width: 40px; height: 4px; border-radius: 2px; background: var(--line);
}
.sheet-head h2 { font-size: 18px; margin: 8px 0 0; flex: 1; }
.sheet-body { overflow-y: auto; padding: 8px 16px calc(var(--safe-b) + 20px); -webkit-overflow-scrolling: touch; }
.menu-list .row svg { width: 22px; height: 22px; color: var(--primary); }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 60; top: calc(var(--safe-t) + 12px); inset-inline: 16px; margin: 0 auto; max-width: 420px;
  background: var(--text); color: var(--bg); border-radius: 12px; padding: 12px 16px; font-weight: 500;
  box-shadow: var(--shadow); transform: translateY(-150%); transition: transform .25s;
}
.toast.show { transform: none; }
.toast.error { background: var(--red); color: #fff; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 380px; }
.auth .logo {
  width: 64px; height: 64px; border-radius: 18px; background: var(--primary); color: var(--primary-ink);
  display: grid; place-items: center; margin: 0 auto 14px;
}
.auth .logo svg { width: 34px; height: 34px; }
.auth h1 { text-align: center; margin: 0 0 4px; font-size: 22px; }
.auth p.lead { text-align: center; color: var(--muted); margin: 0 0 22px; }

/* ---------- misc ---------- */
.client-head { display: flex; gap: 14px; align-items: center; }
.client-head .avatar { width: 52px; height: 52px; font-size: 20px; border-radius: 16px; }
.client-head h2 { margin: 0; font-size: 20px; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-top: 14px; }
.totals .label { color: var(--muted); font-size: 12px; }
.totals .value { font-weight: 700; font-size: 17px; }
.value.red { color: var(--red); }
.value.green { color: var(--green); }
.balance-line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.notice {
  background: var(--amber-soft); color: var(--amber); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.group-label { font-size: 13px; font-weight: 700; margin: 16px 4px 6px; display: flex; gap: 6px; align-items: center; }
.group-label.red { color: var(--red); }
.fu-actions { display: flex; gap: 6px; margin-top: 8px; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.field input[type="date"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; }

/* ---------- الشعار ---------- */
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: #fff; padding: 2px; flex: none; box-shadow: var(--shadow); }
.auth .logo-card { background: #fff; border-radius: 22px; width: 150px; margin: 0 auto 16px; padding: 14px; box-shadow: var(--shadow); }
.auth .logo-card img { display: block; width: 100%; height: auto; }

/* ---------- حسب العملة ---------- */
.cur-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cur-table th { font-weight: 500; color: var(--muted); font-size: 12px; text-align: start; padding: 0 0 6px; }
.cur-table td { padding: 8px 0; border-top: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.cur-table td:first-child { font-weight: 700; }
.cur-table td small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.cur-table th:not(:first-child), .cur-table td:not(:first-child) { text-align: end; }

/* ---------- الرسوم ---------- */
.chart-card .chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.chart-card .chart-head .t { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.chart-card .chart-head .v { font-size: 13px; color: var(--muted); }
.chart-card .chart-head .v b { color: var(--text); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; align-items: end; height: 110px; border-bottom: 1px solid var(--line); }
.bars button { all: unset; cursor: pointer; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bars .bar { width: 100%; max-width: 28px; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--c); opacity: .55; transition: opacity .15s; }
.bars button.on .bar { opacity: 1; }
.bars button:focus-visible .bar { outline: 2px solid var(--text); outline-offset: 2px; }
.bar-labels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-top: 6px; }
.bar-labels span { text-align: center; font-size: 11px; color: var(--muted); }
.bar-labels span.on { color: var(--text); font-weight: 600; }
.hbars { display: grid; gap: 10px; }
.hbar .row-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.hbar .row-top b { font-weight: 600; }
.hbar .track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 4px; background: var(--chart-profit); }
.hbar.neg .fill { background: var(--muted); }

/* ---------- الفاتورة (تترسم برا الشاشة وتتحول PDF؛ ألوان ثابتة فاتحة) ---------- */
.inv-holder { position: fixed; top: 0; left: -10000px; z-index: -1; }
.inv {
  width: 794px; min-height: 1123px; padding: 44px 48px 36px; box-sizing: border-box;
  background: #fff; color: #222; font-size: 13px; line-height: 1.55; direction: rtl;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; display: flex; flex-direction: column;
}
.inv i { font-style: normal; color: #8a8f93; font-size: 11px; direction: ltr; unicode-bidi: isolate; }
.inv-head { display: flex; gap: 20px; align-items: center; padding-bottom: 18px; border-bottom: 3px solid #a8131f; }
.inv-head img { width: 92px; height: auto; }
.inv-co { flex: 1; display: grid; grid-template-columns: 1fr; gap: 4px; }
.inv-co b { font-size: 17px; color: #a8131f; }
.inv-co .en { text-align: left; }
.inv-co .contact { grid-column: 1 / -1; color: #54585a; font-size: 12px; margin-top: 4px; }
.inv-title { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 16px; }
.inv-title h1 { margin: 0; font-size: 26px; color: #54585a; letter-spacing: 0; }
.inv-title h1 span { font-size: 15px; color: #8a8f93; margin-inline-start: 6px; }
.inv-title dl { display: grid; grid-template-columns: auto auto; gap: 2px 14px; margin: 0; }
.inv-title dt { color: #54585a; }
.inv-title dd { margin: 0; font-weight: 700; text-align: left; }
.inv-to { background: #f5f5f6; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.inv-to .lbl, .inv-notes .lbl { color: #54585a; font-size: 12px; }
.inv-to .name { font-size: 16px; font-weight: 700; }
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table th { background: #54585a; color: #fff; font-weight: 600; text-align: right; padding: 8px 10px; font-size: 12px; }
.inv-table th i { color: #d9dbdc; }
.inv-table td { padding: 10px; border-bottom: 1px solid #e1e2e4; vertical-align: top; }
.inv-table .sub { color: #54585a; font-size: 12px; }
.inv .amt { text-align: left; white-space: nowrap; font-weight: 600; }
.inv-totals { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 16px; gap: 20px; }
.inv-totals table { min-width: 300px; border-collapse: collapse; }
.inv-totals td { padding: 5px 10px; }
.inv-totals tr.due td { background: #fbe8ea; color: #a8131f; font-weight: 700; border-radius: 4px; }
.inv-totals tr.due + tr td { padding-top: 12px; }
.stamp {
  border: 3px solid #18794e; color: #18794e; font-weight: 800; font-size: 18px; text-align: center;
  padding: 6px 18px; border-radius: 8px; transform: rotate(-8deg); margin: 12px 20px; line-height: 1.3;
}
.inv-notes { margin-top: 22px; }
.inv-notes .note { display: flex; gap: 8px; margin-top: 6px; }
.inv-notes .note > span { color: #a8131f; }
.inv-notes .note .en { color: #54585a; font-size: 12px; }
.inv-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid #e1e2e4; display: flex; justify-content: space-between; color: #54585a; font-size: 12px; }
.inv-stamp { margin-top: 26px; align-self: flex-end; text-align: center; color: #54585a; font-size: 12px; }
.inv-stamp img { display: block; width: 180px; height: auto; margin: 0 auto 4px; transform: rotate(-6deg); opacity: .92; }
.with-add { display: flex; gap: 6px; }
.with-add select { flex: 1; min-width: 0; }
.with-add .add-btn { height: 46px; width: 46px; border-radius: 12px; }

/* ---------- كلمة السر مع زر العين ---------- */
.pw-wrap { position: relative; }
.field .pw-wrap input { padding-inline-end: 46px; }
.pw-eye {
  position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; background: none; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; border-radius: 10px;
}
.pw-eye svg { width: 20px; height: 20px; }

/* كرت المكسب في الرئيسية يفتح التفاصيل */
a.kpi-link { display: block; color: inherit; text-decoration: none; }
.kpi-more { float: left; font-size: 12px; opacity: .85; }

/* مراحل الترجيع */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; position: relative; }
.steps li { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 11px; color: var(--muted); position: relative; }
.steps li::before { content: ""; position: absolute; top: 14px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.steps li:last-child::before { display: none; }
.steps li.done::before { background: var(--green); }
.steps .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 13px; position: relative; z-index: 1; }
.steps .dot svg { width: 16px; height: 16px; }
.steps li.done .dot { background: var(--green); color: #fff; }
.steps li.now .dot { background: var(--primary); color: var(--primary-ink); box-shadow: 0 0 0 4px var(--primary-soft); }
.steps li.now { color: var(--text); font-weight: 600; }
a.btn { text-decoration: none; }
.actions.two .btn { white-space: normal; line-height: 1.25; text-align: center; padding: 8px 10px; }
a.refund-card { display: block; color: inherit; text-decoration: none; }
.refund-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.refund-steps > div { background: var(--surface-2); border-radius: 10px; padding: 8px 4px; }
.refund-steps > div.has { background: var(--primary-soft); color: var(--primary); }
.refund-steps .value { font-size: 20px; font-weight: 700; }
.refund-steps .label { font-size: 11px; color: inherit; opacity: .85; }

/* الرسم الدائري للملخص المالي */
.donut-wrap { position: relative; width: 200px; max-width: 70%; margin: 4px auto 14px; }
.donut { width: 100%; height: auto; display: block; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 0 30px; }
.donut-value { font-weight: 700; font-size: 15px; }
.legend { display: grid; gap: 2px; }
.lg-row { display: grid; grid-template-columns: 12px 1fr auto 52px; align-items: center; gap: 8px; padding: 8px 4px; border-radius: 8px; color: inherit; text-decoration: none; }
a.lg-row:active { background: var(--surface-2); }
.lg-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-val { font-weight: 600; }
.lg-pct { color: var(--muted); font-size: 13px; text-align: end; }
.legend .swatch, .kpi .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; vertical-align: middle; }
.warn-box { background: var(--amber-soft); color: var(--amber); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.warn-box a { color: inherit; text-decoration: underline; }

/* الكاش فلو: لنا / علينا / عندنا */
a.ov-group { display: block; color: inherit; text-decoration: none; margin-top: 10px; }
.ov-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 6px; }
.ov-head .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; vertical-align: middle; }
.ov-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); padding: 3px 0; }
.ov-line b { color: var(--text); font-weight: 600; }
.diff-note { font-size: 12px; margin-top: 2px; }
