/* مدى أبشر — لوحة «حسابي» v1 (تعمل مع assets/js/acct-dash.js) */
.ad {
  --ad-brand: var(--primary, #00877a);
  --ad-brand-600: var(--primary-600, #006d63);
  --ad-brand-soft: #e9f6f4;
  --ad-ink: var(--navy, #0b1a4a);
  --ad-text: #4a4f5c;
  --ad-muted: #5f6576;
  --ad-line: #dce9e6;
  --ad-paper: #fff;
  --ad-bg: #f4f8f7;
  --ad-danger: #b42318;
  --ad-danger-soft: #fdf0ef;
  --ad-wa: #128c4a;
  --ad-r: 18px;
  --ad-r-sm: 12px;
  --ad-shadow: 0 1px 2px rgba(11,26,74,.05), 0 8px 24px rgba(11,26,74,.06);
  --ad-ease: cubic-bezier(.22,.61,.36,1);
  --ad-top: calc(var(--header-h, 80px) + 16px);
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  color: var(--ad-text);
  font-size: 15px;
  line-height: 1.6;
}
.ad *, .ad *::before, .ad *::after { box-sizing: border-box; }
.ad svg { flex: none; }

/* ---------- تعطيل إطار النافذة الأصلي عند تفعيل اللوحة ---------- */
html.acct-in .acct-wrap { max-width: 1240px; }
html.acct-in .acct-trk { display: none; }
.rcv-modal.ad-on .rcv-modal__head,
.rcv-modal.ad-on .rcv-modal__foot,
.rcv-modal.ad-on .rcv-modal__bg { display: none !important; }
.rcv-modal.ad-on .rcv-modal__box { background: transparent !important; box-shadow: none !important; border: 0 !important; border-radius: 0 !important; max-width: none !important; width: 100% !important; overflow: visible !important; }
.rcv-modal.ad-on .rcv-modal__body { padding: 0 !important; overflow: visible !important; max-height: none !important; }

/* ---------- القائمة الجانبية ---------- */
.ad-side {
  position: sticky; top: var(--ad-top);
  background: var(--ad-paper); border: 1px solid var(--ad-line); border-radius: var(--ad-r);
  box-shadow: var(--ad-shadow); padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.ad-me { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; border-bottom: 1px solid var(--ad-line); }
.ad-me__av {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--ad-ink), var(--ad-brand)); color: #fff; font-weight: 800; font-size: 20px;
}
.ad-me div { min-width: 0; display: flex; flex-direction: column; }
.ad-me b { color: var(--ad-ink); font-size: 16px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.ad-me small { color: var(--ad-muted); font-size: 13px; direction: ltr; text-align: right; }
.ad-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ad-nav__i {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 0; border-radius: var(--ad-r-sm); background: transparent; color: var(--ad-text);
  font: inherit; font-size: 15px; font-weight: 600; text-align: right; text-decoration: none; cursor: pointer;
  transition: background-color .18s var(--ad-ease), color .18s var(--ad-ease);
  touch-action: manipulation;
}
.ad-nav__i span { flex: 1; }
.ad-nav__i svg { color: var(--ad-muted); transition: color .18s var(--ad-ease); }
.ad-nav__i em {
  font-style: normal; font-size: 12px; font-weight: 700; min-width: 24px; height: 24px; padding: 0 7px;
  display: grid; place-items: center; border-radius: 999px; background: var(--ad-bg); color: var(--ad-ink);
  font-variant-numeric: tabular-nums;
}
.ad-nav__i:hover { background: var(--ad-bg); color: var(--ad-ink); }
.ad-nav__i.is-on { background: var(--ad-brand-soft); color: var(--ad-brand-600); }
.ad-nav__i.is-on svg { color: var(--ad-brand); }
.ad-nav__i.is-on em { background: var(--ad-brand); color: #fff; }
.ad-nav li { position: relative; }
.ad-nav__i.is-on { box-shadow: inset -3px 0 0 var(--ad-brand); }
.ad-side__foot { border-top: 1px solid var(--ad-line); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.ad-nav__out { color: var(--ad-danger); }
.ad-nav__out svg { color: var(--ad-danger); }
.ad-nav__out:hover { background: var(--ad-danger-soft); color: var(--ad-danger); }

/* ---------- الشريط العلوي ---------- */
.ad-main { min-width: 0; display: flex; flex-direction: column; gap: 20px; scroll-margin-top: var(--ad-top); }
.ad-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ad-date { margin: 0 0 2px; display: inline-flex; align-items: center; gap: 6px; color: var(--ad-muted); font-size: 13px; }
.ad-hello { margin: 0; color: var(--ad-ink); font-size: clamp(22px, 2.4vw, 28px); font-weight: 800; line-height: 1.3; }
.ad-top__acts { display: flex; gap: 8px; }

/* ---------- الأزرار ---------- */
.ad-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 700; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap; touch-action: manipulation;
  transition: background-color .18s var(--ad-ease), border-color .18s var(--ad-ease), color .18s var(--ad-ease), transform .12s var(--ad-ease);
}
.ad-btn:active { transform: scale(.97); }
.ad-btn--brand { background: var(--ad-brand); color: #fff; }
.ad-btn--brand:hover { background: var(--ad-brand-600); color: #fff; }
.ad-btn--line { background: var(--ad-paper); border-color: var(--ad-line); color: var(--ad-ink); }
.ad-btn--line:hover { border-color: var(--ad-brand); color: var(--ad-brand-600); }
.ad-btn--ghost { background: var(--ad-paper); border-color: var(--ad-line); color: var(--ad-ink); }
.ad-btn--ghost:hover { background: var(--ad-bg); }
.ad-btn--icon { width: 44px; padding: 0; }
.ad .ad-btn--wa, .ad .ad-btn--wa:visited { background: var(--ad-wa); color: #fff !important; }
.ad .ad-btn--wa:hover { background: #0e7a40; color: #fff !important; }
.ad .ad-btn--brand, .ad .ad-btn--brand:visited { color: #fff !important; }
.ad-btn--danger { background: var(--ad-paper); border-color: #f1c4bf; color: var(--ad-danger); }
.ad-btn--danger:hover { background: var(--ad-danger-soft); }
.ad-link { background: none; border: 0; padding: 6px 4px; min-height: 32px; font: inherit; font-size: 14px; font-weight: 700; color: var(--ad-brand-600); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: transparent; transition: text-decoration-color .18s; }
.ad-link:hover { text-decoration-color: currentColor; }
.ad :focus-visible { outline: 3px solid color-mix(in srgb, var(--ad-brand) 55%, transparent); outline-offset: 2px; }
.ad h2[tabindex="-1"]:focus { outline: none; }

/* ---------- البطاقات ---------- */
.ad-card { background: var(--ad-paper); border: 1px solid var(--ad-line); border-radius: var(--ad-r); box-shadow: var(--ad-shadow); padding: 20px; }
.ad-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ad-brand-600); background: var(--ad-brand-soft); padding: 4px 10px; border-radius: 999px; }
.ad-muted { color: var(--ad-muted); margin: 0; font-size: 14px; }

/* الطلب الحالي */
.ad-spot {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center;
  background: linear-gradient(135deg, #fff 0%, #fff 55%, var(--ad-brand-soft) 100%);
  border-color: color-mix(in srgb, var(--ad-brand) 25%, var(--ad-line));
}
.ad-spot__main { min-width: 0; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.ad-spot h3 { margin: 0; color: var(--ad-ink); font-size: clamp(18px, 2vw, 22px); font-weight: 800; line-height: 1.4; }
.ad-spot__who { display: flex; align-items: center; gap: 10px; margin: 0; min-width: 0; }
.ad-spot__who img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--ad-line); }
.ad-spot__who span { display: flex; flex-direction: column; min-width: 0; }
.ad-spot__who b { color: var(--ad-ink); font-size: 14px; overflow-wrap: anywhere; }
.ad-spot__who small { color: var(--ad-muted); font-size: 13px; }
.ad-spot__next { margin: 0; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; padding: 8px 12px; border-radius: 10px; background: var(--ad-bg); }
.ad-spot__next span { color: var(--ad-muted); }
.ad-spot__next b { color: var(--ad-ink); }
.ad-spot__next.is-ticket { background: #eef3ff; }
.ad-spot__acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ad-ring { position: relative; width: 132px; height: 132px; }
.ad-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ad-ring circle { fill: none; stroke-width: 8; }
.ad-ring__bg { stroke: var(--ad-line); }
.ad-ring__fg { stroke: var(--ad-brand); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ad-ease); }
.ad-ring b { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ad-ink); font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; }
.ad-ring b small { font-size: 15px; font-weight: 700; color: var(--ad-muted); }
.ad-ring b { grid-auto-flow: column; align-content: center; justify-content: center; gap: 1px; }

/* المؤشرات */
.ad-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ad-kpi {
  display: flex; align-items: center; gap: 12px; padding: 16px; text-align: right; cursor: pointer; font: inherit;
  background: var(--ad-paper); border: 1px solid var(--ad-line); border-radius: var(--ad-r); box-shadow: var(--ad-shadow);
  transition: border-color .18s var(--ad-ease), transform .18s var(--ad-ease); min-height: 44px;
}
.ad-kpi:hover { border-color: color-mix(in srgb, var(--ad-brand) 45%, var(--ad-line)); transform: translateY(-2px); }
.ad-kpi__ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--ad-brand-soft); color: var(--ad-brand-600); flex: none; }
.ad-kpi__t { display: flex; flex-direction: column; min-width: 0; }
.ad-kpi__t small { font-size: 13px; color: var(--ad-muted); font-weight: 600; }
.ad-kpi__t b { font-size: 26px; line-height: 1.2; font-weight: 800; color: var(--ad-ink); font-variant-numeric: tabular-nums; }
.ad-kpi__t em { font-style: normal; font-size: 12px; color: var(--ad-muted); }

.ad-grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ad-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ad-sec-h h3 { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 16px; color: var(--ad-ink); font-weight: 800; }
.ad-sec-h h3 svg { color: var(--ad-brand); }
.ad-prev { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ad-prev li + li { border-top: 1px solid var(--ad-line); }
.ad-prev button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 4px; background: none; border: 0; font: inherit; text-align: right; cursor: pointer; border-radius: 10px; min-height: 56px; transition: background-color .18s; }
.ad-prev button:hover { background: var(--ad-bg); }
.ad-prev img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.ad-prev span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ad-prev b { color: var(--ad-ink); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-prev small { color: var(--ad-muted); font-size: 12px; }
.ad-prev em { font-style: normal; font-size: 13px; font-weight: 700; color: var(--ad-brand-600); white-space: nowrap; }

.ad-help { display: flex; flex-direction: column; gap: 12px; background: linear-gradient(150deg, var(--ad-ink), #17327a 70%, var(--ad-brand)); color: #e7ecf8; border: 0; }
.ad-help__ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #fff; }
.ad-help h3 { margin: 0 0 2px; color: #fff; font-size: 17px; font-weight: 800; }
.ad-help p { margin: 0; font-size: 14px; color: #d6deef; }
.ad-help__acts { display: flex; gap: 8px; flex-wrap: wrap; }
.ad-help .ad-btn--line { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.28); color: #fff; }
.ad-help .ad-btn--line:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ---------- الأقسام ---------- */
.ad-panel { display: flex; flex-direction: column; gap: 16px; }
.ad-panel[hidden] { display: none !important; }
.ad-panel.is-in { animation: adIn .28s var(--ad-ease) both; }
@keyframes adIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ad-ph h2 { margin: 0; color: var(--ad-ink); font-size: 22px; font-weight: 800; scroll-margin-top: var(--ad-top); }
.ad-ph h2 small { font-size: 15px; color: var(--ad-muted); font-weight: 600; }
.ad-ph p { margin: 2px 0 0; color: var(--ad-muted); font-size: 14px; }
.ad-list { display: flex; flex-direction: column; gap: 14px; }
.ad-list > .rcv-order { margin: 0 !important; border-radius: var(--ad-r) !important; border: 1px solid var(--ad-line) !important; box-shadow: var(--ad-shadow) !important; background: var(--ad-paper) !important; scroll-margin-top: var(--ad-top); transition: box-shadow .3s var(--ad-ease); }
.ad-list > .rcv-order.ad-flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ad-brand) 45%, transparent), var(--ad-shadow) !important; }
.ad-list .rcv-minis { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important; gap: 12px !important; }
.ad-list .rcv-mini { background: var(--ad-paper); border: 1px solid var(--ad-line) !important; border-radius: var(--ad-r) !important; box-shadow: var(--ad-shadow); }
.ad-ic { display: grid !important; place-items: center; color: var(--ad-brand-600); background: var(--ad-brand-soft); }

/* طيّ المراحل */
.ad-steps { border-top: 1px dashed var(--ad-line); margin-top: 6px; }
.ad-steps > summary {
  list-style: none; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 2px; cursor: pointer;
  font-weight: 700; color: var(--ad-ink); font-size: 14px;
}
.ad-steps > summary::-webkit-details-marker { display: none; }
.ad-steps > summary span { display: inline-flex; align-items: center; gap: 6px; flex: 1; }
.ad-steps > summary span svg { color: var(--ad-brand); }
.ad-steps > summary small { color: var(--ad-muted); font-weight: 600; font-size: 13px; }
.ad-steps > summary > svg { color: var(--ad-muted); transform: rotate(-90deg); transition: transform .2s var(--ad-ease); }
.ad-steps[open] > summary > svg { transform: rotate(90deg); }
.ad-steps > summary:hover { color: var(--ad-brand-600); }

/* فارغ */
.ad-empty { text-align: center; padding: 36px 20px; background: var(--ad-paper); border: 1px dashed var(--ad-line); border-radius: var(--ad-r); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ad-empty > span { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--ad-brand-soft); color: var(--ad-brand-600); }
.ad-empty h3 { margin: 4px 0 0; color: var(--ad-ink); font-size: 17px; }
.ad-empty p { margin: 0 0 8px; color: var(--ad-muted); font-size: 14px; max-width: 42ch; }

/* بياناتي */
.ad-profile dl { margin: 0; display: grid; gap: 0; }
.ad-profile dl > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--ad-line); flex-wrap: wrap; }
.ad-profile dl > div:last-child { border-bottom: 0; }
.ad-profile dt { color: var(--ad-muted); font-size: 14px; font-weight: 600; }
.ad-profile dd { margin: 0; color: var(--ad-ink); font-weight: 700; overflow-wrap: anywhere; }
.ad-profile .rcv-idchip { background: var(--ad-bg) !important; color: var(--ad-ink) !important; border: 1px solid var(--ad-line) !important; display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 12px !important; }
.ad-profile .rcv-idchip__eye { color: var(--ad-brand-600) !important; background: var(--ad-paper) !important; border: 1px solid var(--ad-line) !important; width: 36px !important; height: 36px !important; display: grid !important; place-items: center; border-radius: 999px !important; cursor: pointer; }
.ad-profile .rcv-idchip__eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.ad-profile .rcv-idchip bdi { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.ad-danger { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-color: #f4d6d2; }
.ad-danger h3 { margin: 0; color: var(--ad-ink); font-size: 16px; }
.ad-danger p { margin: 2px 0 0; color: var(--ad-muted); font-size: 14px; }

/* ---------- تابلت ---------- */
@media (max-width: 1100px) {
  .ad-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ad-grid2 { grid-template-columns: 1fr; }
}
/* ---------- جوال: القائمة تصبح شريطاً أفقياً ---------- */
@media (max-width: 900px) {
  .ad { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .ad-side, .ad-nav { min-width: 0; }
  .ad-side { position: sticky; top: calc(var(--header-h, 64px) + 4px); z-index: 20; padding: 8px; gap: 0; border-radius: 16px; }
  .ad-me, .ad-side__foot { display: none; }
  .ad-nav ul { flex-direction: row; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; gap: 6px; }
  .ad-nav ul::-webkit-scrollbar { display: none; }
  .ad-nav li { flex: none; scroll-snap-align: start; }
  .ad-nav__i { padding: 8px 14px; white-space: nowrap; border-radius: 999px; gap: 8px; font-size: 14px; }
  .ad-nav__i.is-on { box-shadow: none; background: var(--ad-brand); color: #fff; }
  .ad-nav__i.is-on svg { color: #fff; }
  .ad-nav__i.is-on em { background: #fff; color: var(--ad-brand-600); }
}
@media (max-width: 600px) {
  .ad-top { align-items: center; }
  .ad-top__acts .ad-btn--brand { padding: 10px 14px; }
  .ad-spot { grid-template-columns: 1fr; padding: 16px; }
  .ad-spot .ad-ring { order: -1; width: 104px; height: 104px; margin-inline: auto; }
  .ad-ring b { font-size: 24px; }
  .ad-spot__acts, .ad-spot__acts .ad-btn { width: 100%; }
  .ad-kpi { padding: 12px; gap: 10px; }
  .ad-kpi__ic { width: 38px; height: 38px; }
  .ad-kpi__t b { font-size: 22px; }
  .ad-card { padding: 16px; }
  .ad-list .rcv-minis { grid-template-columns: 1fr !important; }
  .ad-danger .ad-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ad *, .ad-panel.is-in { animation: none !important; transition: none !important; }
}
