/* إرسال — أبيض وأخضر هادي، بطاقات بحواف 20px، خط IBM Plex Sans Arabic */
:root {
  --bg: #F3F6F4; --card: #FFFFFF; --text: #17211C; --muted: #56655D; --line: #E2E8E4; --line-soft: #EEF2EF;
  --field: #FAFBFA; --field-line: #D5DED9;
  --primary: #0E6B53; --primary-hover: #0A5341; --primary-ink: #FFFFFF; --primary-soft: #E2F1EB; --primary-line: #B9CDC3;
  --ok: #0E6B53; --ok-bg: #E2F1EB; --warn: #7A4A00; --warn-bg: #FFF1D6; --warn-dot: #C77C00;
  --bad: #A3261B; --bad-bg: #FDECEA; --info: #1F5A96; --info-bg: #E6EFF8; --neutral: #3D4A43; --neutral-bg: #EEF1EF;
  --live: #1F9D6E; --live-ring: #D5EEE4;
  --radius: 20px; --radius-sm: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1613; --card: #17201C; --text: #E4ECE7; --muted: #9AABA2; --line: #26332D; --line-soft: #202B26;
    --field: #121A16; --field-line: #31403A;
    --primary: #4FBF96; --primary-hover: #6FD0AC; --primary-ink: #0B1A14; --primary-soft: #18352B; --primary-line: #2B5446;
    --ok: #6FD0AC; --ok-bg: #18352B; --warn: #F2C46A; --warn-bg: #3A2C10; --warn-dot: #F2C46A;
    --bad: #F2A39B; --bad-bg: #3D1C18; --info: #9CC2EE; --info-bg: #1A2B3E; --neutral: #C3CFC8; --neutral-bg: #222C27;
    --live: #4FBF96; --live-ring: #1E4436;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.7 "IBM Plex Sans Arabic", Tahoma, system-ui, sans-serif; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
svg.i { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }

/* الشريط العلوي */
header.top { background: var(--card); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; min-height: 62px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 20px; }
.brand:hover { color: var(--text); }
.brand .logo { width: 38px; height: 38px; border-radius: 12px; background: var(--primary); color: var(--primary-ink);
  display: grid; place-items: center; }
.brand .logo svg.i { width: 20px; height: 20px; }
nav.tabs-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav.tabs-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px;
  color: var(--muted); text-decoration: none; }
nav.tabs-nav a:hover { background: var(--line-soft); color: var(--text); }
nav.tabs-nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
nav.tabs-nav svg.i { display: none; }
.mode { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.mode:hover { color: var(--warn); }
.mode::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn-dot); }
.mode.live { background: var(--primary-soft); color: var(--primary); }
.mode.live::before { background: var(--live); }

main.wrap { padding: 32px 24px 56px; }
h1 { font-size: 28px; font-weight: 700; margin: 0 0 20px; line-height: 1.35; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); margin-bottom: 20px; }
.grid > .card { margin-bottom: 0; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 14px; }
.ltr { direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }

/* بطاقة الحالة الرئيسية */
.hero { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; padding: 24px 28px; }
.hero .info { flex: 1 1 320px; display: flex; flex-direction: column; gap: 6px; }
.hero .state { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.hero .sub { color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ring { position: relative; width: 104px; height: 104px; flex: 0 0 auto; }
.ring svg { display: block; }
.ring .track { stroke: var(--primary-soft); }
.ring .bar { stroke: var(--primary); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.15; }
.ring .val strong { display: block; font-size: 26px; color: var(--primary); }
.ring .val span { font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.dot.running { background: var(--live); box-shadow: 0 0 0 5px var(--live-ring); }
.dot.paused { background: var(--warn-dot); box-shadow: 0 0 0 5px var(--warn-bg); }
.dot.hired { background: var(--primary); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
td.actions { display: table-cell; }   /* خلية جدول: flex يكسر محاذاة الصف على الكمبيوتر */
td.actions form { display: inline-block; margin-inline-end: 6px; }

.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px; }
.stat .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat .lbl { color: var(--muted); font-size: 14px; font-weight: 500; }
.stat .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.stat .num { font-size: 30px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .num small { font-size: 15px; color: var(--muted); font-weight: 500; }
.tone-green { background: var(--primary-soft); color: var(--primary); }
.tone-blue { background: var(--info-bg); color: var(--info); }
.tone-amber { background: var(--warn-bg); color: var(--warn); }
.tone-red { background: var(--bad-bg); color: var(--bad); }
.tone-muted { background: var(--neutral-bg); color: var(--neutral); }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.checklist li:last-child { border-bottom: 0; }
.check { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px;
  border: 2px solid var(--field-line); color: transparent; flex: 0 0 auto; }
.check.done { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.checklist a { margin-inline-start: auto; font-weight: 600; text-decoration: none; }

/* رسائل */
.banner { padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.err { background: var(--bad-bg); color: var(--bad); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }

/* جداول وقوائم */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 12px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; border-bottom-color: var(--line); }
tr:last-child td { border-bottom: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.list li:last-child { border-bottom: 0; }
.list .who { font-weight: 600; }
.list .meta { color: var(--muted); font-size: 13px; white-space: nowrap; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.muted { background: var(--neutral-bg); color: var(--neutral); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.good { background: var(--primary); color: var(--primary-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); text-decoration: none; color: var(--text); background: var(--card); font-size: 14px; }
.chip:hover { color: var(--text); background: var(--line-soft); }
.chip.on { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); font-weight: 600; }

/* نماذج */
form.inline { display: inline; }
label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 14px; }
label.plain { font-weight: normal; display: inline-flex; gap: 8px; align-items: center; margin: 6px 0; }
input[type=text], input[type=email], input[type=search], input[type=password], input[type=number], textarea, select {
  width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid var(--field-line); border-radius: var(--radius-sm);
  background: var(--field); color: var(--text); font: inherit; }
textarea { padding: 12px 14px; min-height: 280px; line-height: 1.9; resize: vertical; }
input[type=file] { font: inherit; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-inline-end: 10px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--field-line); background: var(--card); color: var(--text); cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }
input:focus, textarea:focus, select:focus { outline: 3px solid var(--primary-soft); border-color: var(--primary); }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: var(--radius-sm); border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-ink); }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--primary-line); outline-offset: 2px; }
button.big { min-height: 50px; padding: 0 28px; font-size: 16px; font-weight: 700; }
button.secondary, .btn.secondary { background: var(--card); color: var(--text); border-color: var(--field-line); }
button.secondary:hover, .btn.secondary:hover { background: var(--line-soft); color: var(--text); }
button.ghost { min-height: 34px; background: transparent; border-color: var(--line); color: var(--muted); font-weight: 500;
  padding: 0 12px; font-size: 13px; border-radius: 10px; }
button.ghost:hover { background: var(--line-soft); color: var(--text); }
button.success { background: var(--card); color: var(--primary); border-color: var(--primary); }
button.success:hover { background: var(--primary-soft); color: var(--primary); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 170px; }
.row > button, .row > .btn { flex: 0 0 auto; }

/* أزرار المتغيرات في صفحة الرسالة */
.vars { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.vars .list-btns { display: flex; gap: 8px; flex-wrap: wrap; }
button.var { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--primary-line);
  background: var(--primary-soft); color: var(--primary); font-size: 14px; }
button.var:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

details.more { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
details.more > summary { cursor: pointer; padding: 16px 22px; font-weight: 600; color: var(--muted); list-style: none; }
details.more > summary::before { content: "＋ "; }
details.more[open] > summary::before { content: "－ "; }
details.more > .inner { padding: 0 22px 20px; }
details > summary { cursor: pointer; }

/* المحرر والمعاينة */
.editor { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; margin-bottom: 20px; }
.editor > .card { margin-bottom: 0; }
@media (max-width: 900px) { .editor { grid-template-columns: minmax(0, 1fr); } }
.tabs { display: inline-flex; gap: 4px; margin-bottom: 10px; padding: 4px; background: var(--line-soft); border-radius: 12px; }
.tabs button { min-height: 38px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-weight: 500; }
.tabs button:hover { background: var(--card); color: var(--text); }
.tabs button.on, .tabs button[aria-selected="true"] { background: var(--card); color: var(--text); font-weight: 600; }
.frame-wrap { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; justify-content: center; }
.mail-frame { border: 0; border-radius: 10px; background: #f4f5f7; height: 620px; width: 100%; display: block; }
.preview-box[data-view="mobile"] .mail-frame { width: 375px; max-width: 100%; }
pre.preview { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; }
.pager { display: flex; gap: 16px; justify-content: center; margin-top: 12px; }

/* الجوال: القائمة تصير شريط تنقل تحت بأيقونات */
@media (max-width: 639px) {
  .wrap { padding: 0 16px; }
  header.top .wrap { min-height: 56px; padding-block: 8px; gap: 12px; }
  .brand { font-size: 18px; }
  .brand .logo { width: 34px; height: 34px; }
  .mode { margin-inline-start: auto; }
  nav.tabs-nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    gap: 0; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
  nav.tabs-nav a { flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 4px 2px; border-radius: 12px;
    font-size: 11px; background: transparent; }
  nav.tabs-nav a.on { background: transparent; }
  nav.tabs-nav a:hover { background: transparent; }
  nav.tabs-nav svg.i { display: block; width: 22px; height: 22px; }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  main.wrap { padding: 20px 16px 32px; }
  h1 { font-size: 23px; margin-bottom: 14px; }
  .card { padding: 16px; border-radius: 18px; margin-bottom: 14px; }
  .grid, .stats { gap: 12px; margin-bottom: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px; }
  .stat .num { font-size: 24px; }
  .hero { gap: 16px; padding: 18px; }
  .ring { width: 76px; height: 76px; }
  .ring svg { width: 76px; height: 76px; }
  .ring .val strong { font-size: 20px; }
  .ring .val span { font-size: 10px; }
  .hero .state { font-size: 19px; }
  .hero .actions { width: 100%; }
  .hero .actions form, .hero .actions button { flex: 1 1 auto; width: 100%; }
}

/* أول حرف من اسم الجهة في القوائم */
.list li { align-items: center; }
.list .grow { flex: 1; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.avatar.t0 { background: var(--primary-soft); color: var(--primary); }
.avatar.t1 { background: var(--info-bg); color: var(--info); }
.avatar.t2 { background: var(--warn-bg); color: var(--warn); }
.avatar.t3 { background: var(--neutral-bg); color: var(--neutral); }

/* تعدد المستخدمين: الدخول والحساب والمستخدمين */
.card.narrow { max-width: 460px; }
main > form.card.narrow:first-child { margin-inline: auto; margin-top: 24px; }
header.top .who { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; }
header.top .who a { color: var(--text); font-weight: 600; text-decoration: none; }
header.top .who a:hover { color: var(--primary); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--line-soft); padding: 2px 6px; border-radius: 6px; }
tr.muted td { opacity: .6; }
@media (max-width: 639px) {
  header.top .who { font-size: 13px; gap: 4px; }
  header.top .who a { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .mode { margin-inline-start: auto; padding: 4px 10px; font-size: 12px; }
}

/* طريقة الرسالة */
.msg-mode .choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.msg-mode .choice { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; font-weight: normal; }
.msg-mode .choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.msg-mode .choice input { margin-top: 4px; width: auto; }
.msg-mode .choice strong { display: block; }
.msg-mode .when-personal { margin-top: 10px; }
.msg-mode:has(input[value="template"]:checked) .when-personal { display: none; }

/* الجداول في الجوال: كل صف كرت، وكل خلية «العنوان: القيمة» */
@media (max-width: 639px) {
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards thead, table.cards tr:has(> th) { display: none; }
  table.cards tr { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 10px; }
  table.cards tr:last-child td { border-bottom: 0; }
  table.cards td { border: 0; padding: 5px 0; }
  table.cards td[data-label] { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; text-align: end; }
  table.cards td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: start; flex: 0 0 auto; }
  table.cards td.title { font-size: 15px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
  table.cards td.opt { display: none; }
  table.cards .m-only { display: block; }
  table.cards tr { padding: 8px 12px; margin-bottom: 8px; }
  table.cards td { padding: 3px 0; }
  table.cards td.title { padding-bottom: 6px; }
  table.cards td.actions { padding-top: 6px; }
  table.cards td button { min-height: 40px; }
  /* زر التخصيص جنب عنوانه، وأزرار الكرت جنب بعض بدل كل واحد سطر (مراجعة التجربة 08) */
  table.cards td[data-label] button { width: auto; min-height: 36px; padding: 0 14px; }
  table.cards td.actions { flex-wrap: nowrap; }
  table.cards td.actions form { flex: 1 1 0; min-width: 0; }
  table.cards td.actions button { font-size: 13px; padding: 0 8px; }
  /* الجهات: سطر الاسم، وتحته سطر وحد فيه الحالة وزر التخصيص وزر الاستبعاد (بدون عناوين، الشارة والأزرار واضحة) */
  table.cards.compact tr { display: grid; grid-template-columns: auto auto 1fr; column-gap: 8px; align-items: center; }
  table.cards.compact td.title, table.cards.compact td[colspan] { grid-column: 1 / -1; }
  table.cards.compact td[data-label] { display: block; text-align: start; }
  table.cards.compact td[data-label]::before { display: none; }
  table.cards.compact td.actions { padding-top: 0; }
  table.cards.compact td.actions:empty { display: block; }
  table.cards.compact td.opt { display: none; }
  table.cards td.actions:empty { display: none; }
  table.cards td.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
  table.cards td.actions form { flex: 1 1 auto; }
  table.cards td button { min-height: 42px; width: 100%; }
  table.cards td[colspan] { text-align: center; }
  .table-wrap { overflow-x: visible; }
}

.m-only { display: none; }

/* الشرح فوق الحقل */
.howto { background: var(--info-bg); color: var(--text); border-radius: var(--radius-sm); padding: 12px 14px; margin: 4px 0 8px; font-size: 14px; }
.howto ol, .howto ul { margin: 6px 0; padding-inline-start: 22px; }
.howto li { margin: 4px 0; }
.howto details { margin-top: 6px; }
.howto summary { cursor: pointer; color: var(--info); font-weight: 600; }
.field-help { margin: -2px 0 6px; color: var(--muted); }
input.bad { border-color: var(--bad) !important; box-shadow: 0 0 0 1px var(--bad); }
.check-result { margin-top: 10px; }

/* الشروط والخصوصية */
.card.legal { max-width: 760px; margin-inline: auto; }
.card.legal h2 { margin-top: 24px; }
.card.legal ul { padding-inline-start: 22px; }
.card.legal li { margin-bottom: 6px; }
footer.site { text-align: center; color: var(--muted); font-size: 13px; padding: 0 16px 32px; }
footer.site a { color: var(--muted); margin: 0 8px; }

/* معالج البداية */
.stepper { list-style: none; margin: 0 0 16px; padding: 0; counter-reset: none; }
.stepper li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.stepper li:last-child { border-bottom: 0; }
.stepper .num { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; border: 2px solid var(--field-line); color: var(--muted); }
.stepper .body { display: flex; flex-direction: column; }
.stepper .body a { color: var(--text); text-decoration: none; }
.stepper .body a:hover { color: var(--primary); }
.stepper li.done .num { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.stepper li.done .body strong { color: var(--muted); }
.stepper li.current .num { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }

/* زر Google */
.btn.google { width: 100%; }
.btn.google svg.i { fill: currentColor; stroke: none; }
.hint.or { text-align: center; margin: 0 0 4px; }

button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; opacity: .9; }

/* للمراجعة */
.review-item .row-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.review-item textarea { min-height: 220px; }
.review-item form.reject { border-top: 1px solid var(--line-soft); margin-top: 8px; padding-top: 4px; }
.banner.info-banner { background: var(--info-bg); color: var(--info); }

details.sig-more { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
details.sig-more > summary { cursor: pointer; font-weight: 600; color: var(--primary); }

details.more-card > summary { cursor: pointer; display: flex; gap: 8px; align-items: center; }

details.lang-box { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
details.lang-box > summary { cursor: pointer; display: flex; gap: 8px; align-items: center; }

/* الدفع (المرحلة 14) */
.card.narrow-lg { max-width: 640px; }
.balance { font-size: 18px; margin: 0 0 8px; }
.balance strong { font-size: 30px; color: var(--primary); }
.packages { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 12px; }
.package { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.package .pkg-name { font-size: 18px; font-weight: 700; }
.package .pkg-price { font-size: 24px; font-weight: 700; color: var(--primary); }
.package button { margin-top: 8px; }
ul.plain-list { padding-inline-start: 20px; margin: 8px 0 0; }
button:disabled { opacity: .5; cursor: not-allowed; }
.banner.upsell { background: var(--primary-soft); color: var(--primary); }


/* Ersal UI refresh — visual layer only. No third-party JS/CSS dependencies. */
:root {
  --brand-forest: #153d35;
  --brand-leaf: #27634d;
  --brand-lime: #dff6d4;
  --brand-shell: #f5f8f5;
  --brand-line: #dfebe3;
  --brand-muted: #6c8076;
  --brand-shadow: 0 12px 38px rgba(14, 49, 34, .055);
  --brand-ease: cubic-bezier(.2,.74,.28,1);
}
body { background: var(--brand-shell); }
button, .btn, .chip, .brand, .ersal-nav a, .ersal-mobile-nav a { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #82cfa6; outline-offset: 3px; }
.ersal-shell { display: grid; grid-template-columns: 244px minmax(0,1fr); min-height: 100vh; }
.ersal-side { position: sticky; top: 0; height: 100vh; padding: 24px 18px 18px; background: #fff; border-inline-end: 1px solid var(--brand-line); display: flex; flex-direction: column; gap: 0; z-index: 12; }
.ersal-brand { text-decoration: none; color: var(--brand-forest); display: flex; align-items: center; gap: 12px; margin-bottom: 38px; padding: 0 9px; font-size: 25px; font-weight: 700; line-height: 1.15; letter-spacing: -.5px; }
.ersal-brand:hover { color: var(--brand-forest); }
.ersal-brand small { display: block; color: #86998c; letter-spacing: 0; font-size: 10px; font-weight: 500; margin-top: 6px; white-space: nowrap; }
.ersal-brand-icon { width: 43px; height: 43px; flex: 0 0 auto; display: grid; place-items: center; color: #efffe9; background: var(--brand-forest); border-radius: 14px; box-shadow: 0 6px 16px rgba(21,61,53,.15); }
.ersal-brand-icon .i { width: 23px; height: 23px; transition: transform .35s var(--brand-ease); }
.ersal-brand:hover .ersal-brand-icon .i { transform: translate(3px,-3px); }
.side-label { margin: 0 12px 13px; font-size: 11px; font-weight: 700; color: #8ba296; }
.ersal-nav { display: flex; flex-direction: column; gap: 5px; }
.ersal-nav a { min-height: 47px; display: flex; align-items: center; gap: 12px; padding: 9px 13px; border-radius: 13px; font-weight: 600; font-size: 14px; color: #687c72; text-decoration: none; transition: color .22s, background .22s, transform .22s; }
.ersal-nav a .i { width: 19px; height: 19px; }
.ersal-nav a:hover { background: #f2f7f2; color: var(--brand-forest); transform: translateX(-2px); }
.ersal-nav a.on { color: #20533e; background: #eaf5eb; }
.ersal-nav-ping { margin-inline-start: auto; width: 5px; height: 5px; border-radius: 50%; background: #9cc6a9; opacity: .8; }
.side-bottom { margin-top: auto; }
.side-note { position: relative; padding: 20px 16px 16px; border-radius: 16px; overflow: hidden; background: linear-gradient(155deg,#eff8eb,#d9ebdf); color: #224a3b; border: 1px solid #e0eee0; }
.side-note strong { display: block; max-width: 135px; font-size: 13px; line-height: 1.6; }
.side-note p { margin: 7px 0 0; color: #617d6b; font-size: 11px; line-height: 1.7; }
.side-note-art { position: absolute; top: 1px; left: 10px; color: #73ad80; font-size: 45px; transform-origin: center; animation: starDrift 6s ease-in-out infinite; }
.side-account { display: flex; gap: 10px; align-items: center; color: var(--brand-forest); padding: 20px 2px 7px; text-decoration: none; }
.side-account:hover { color: var(--brand-forest); }
.side-avatar, .ersal-top-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: #e4f0e4; color: #295942; border: 1px solid #d9e7dd; font-weight: 700; }
.side-account-name { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.side-account-name small { display: block; font-size: 11px; font-weight: 400; color: #7b9182; margin-top: 0; }
.side-account > .i { width: 15px; color: #98a99a; }
.side-logout { padding-inline-start: 45px; }
.side-logout .ghost { font-size: 13px; border: 0; padding: 4px 0; background: transparent; min-height: 0; color: #94a49a; }
.side-logout .ghost:hover { color: #b54f47; }
.ersal-work { min-width: 0; }
.ersal-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 75px; padding: 0 clamp(22px, 3.5vw, 48px); background: rgba(255,255,255,.82); border-bottom: 1px solid #e4ece6; backdrop-filter: blur(14px); }
.ersal-crumb { color: #9bab9e; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.ersal-crumb strong { color: #2c5644; }
.ersal-head-actions { display: flex; align-items: center; gap: 16px; }
.ersal-head-actions .mode { font-size: 12px; }
.ersal-top-avatar { text-decoration: none; font-size: 13px; }
.ersal-top-avatar:hover { background: #d4eadd; color: #295942; }
.ersal-main { max-width: 1310px; padding: 30px clamp(20px, 3.5vw, 48px) 70px; }
.ersal-main > .card, .ersal-main .card { box-shadow: var(--brand-shadow); }
.ersal-main .card { border-color: #e6eee8; }
.ersal-mobile-nav { display: none; }
.ersal-work footer.site { padding-top: 0; }

/* Dashboard: real-state widgets + illustrative journey (no invented analytics) */
.ersal-welcome { position: relative; display: grid; grid-template-columns: minmax(0,1fr) minmax(330px,.96fr); min-height: 270px; align-items: center; overflow: hidden; background: linear-gradient(105deg,#133a32 5%,#1c5041 66%,#275c48 100%); border: 1px solid #1b5142; border-radius: 25px; box-shadow: 0 18px 35px rgba(19,60,45,.12); margin-bottom: 24px; isolation: isolate; }
.ersal-welcome::before { position: absolute; width: 290px; height: 290px; border-radius: 50%; content: ''; background: #58a77c; opacity: .13; filter: blur(52px); top: -145px; right: 24%; pointer-events: none; }
.ersal-welcome-copy { z-index: 1; padding: 31px clamp(24px,3.6vw,46px); }
.welcome-kicker { color: #b7e6c8; font-size: 12px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.welcome-kicker-dot { width: 7px; height: 7px; display: inline-block; background: #a8ebae; border-radius: 50%; box-shadow: 0 0 0 5px rgba(168,235,174,.14); }
.ersal-welcome h1 { color: #fff; margin: 11px 0 9px; font-size: clamp(25px, 2.85vw, 39px); line-height: 1.5; letter-spacing: -.7px; }
.ersal-welcome h1 em { color: #d7f7be; font-style: normal; }
.ersal-welcome p { color: #c7dfd2; font-size: 13px; line-height: 1.95; max-width: 420px; margin: 0 0 22px; }
.welcome-actions { display: flex; align-items: center; gap: 23px; flex-wrap: wrap; }
.welcome-actions .welcome-cta { color: #184332; background: #dcf6d2; border-color: #dcf6d2; font-weight: 700; padding: 8px 21px; border-radius: 12px; text-decoration: none; min-height: 43px; display: inline-flex; align-items: center; gap: 11px; transition: transform .25s, box-shadow .25s; }
.welcome-cta:hover { transform: translateY(-3px); color: #184332; box-shadow: 0 10px 22px rgba(0,0,0,.16); }
.welcome-secondary { color: #edfff0; font-size: 13px; font-weight: 600; text-decoration: none; }
.welcome-secondary:hover { color: #c7fbd0; }
.welcome-illustration { min-width: 0; align-self: stretch; display: flex; justify-content: center; align-items: center; padding: 8px 10px; }
.journey-svg { display: block; width: min(100%,470px); height: auto; max-height: 290px; overflow: visible; }
.journey-route { animation: routeMarch 16s linear infinite; }
.journey-plane { transform-box: fill-box; transform-origin: center; animation: planeFloat 5s ease-in-out infinite; }
.journey-card-a { animation: cardFloat 6s ease-in-out infinite; }
.journey-card-b { animation: cardFloat 6s ease-in-out -3s infinite; }
.journey-spark { animation: starDrift 5s ease-in-out infinite; }
.journey-spark.s2 { animation-delay: -2s; }
.journey-spark.s3 { animation-delay: -1.4s; }
.section-kicker { color: #699c7c; font-weight: 700; font-size: 11px; letter-spacing: .1px; }
.ersal-live-hero { position: relative; min-height: 152px; overflow: hidden; gap: 23px; border-radius: 20px; background: linear-gradient(115deg,#fff 25%,#f7fcf7 100%); }
.ersal-live-hero .status-accent { position: absolute; top: -58px; left: -55px; width: 180px; height: 180px; background: radial-gradient(circle,#d7f0dd 0,transparent 72%); pointer-events: none; }
.ersal-live-hero .info .section-kicker { margin-bottom: 2px; }
.ersal-live-hero .ring { filter: drop-shadow(0 2px 7px rgba(40,117,66,.12)); }
.ersal-live-hero .dot.running { animation: statusPulse 2.4s ease-in-out infinite; }
.ersal-live-hero .actions button { border-radius: 12px; }
.ersal-main .stats { gap: 16px; }
.ersal-main .ersal-stat, .ersal-main .stat { background: var(--card); border-color: #e6eee8; box-shadow: var(--brand-shadow); border-radius: 18px; transition: transform .3s var(--brand-ease), box-shadow .3s; }
.ersal-main .ersal-stat:hover, .ersal-main .stat:hover { transform: translateY(-4px); box-shadow: 0 17px 38px rgba(20,60,36,.085); }
.ersal-main .stat .ico { width: 40px; height: 40px; border-radius: 13px; }
.ersal-main .stat .ico svg { width: 21px; height: 21px; }
.ersal-main .stat .num { font-size: 32px; }
.ersal-setup { border: 1px solid var(--brand-line) !important; }
.section-heading, .ersal-section-head, .company-list-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.section-heading h2, .ersal-section-head h2, .company-list-heading h2 { margin: 2px 0 0; font-size: 19px; }
.setup-symbol { display: grid; place-items: center; width: 44px; height: 44px; color: var(--brand-leaf); background: #eaf6e9; border-radius: 15px; font-size: 31px; }
.ersal-setup .stepper li { transition: background .2s, padding .2s; border-radius: 10px; }
.ersal-setup .stepper li:hover { background: #f7fbf7; padding-inline: 6px; }
.ersal-setup .stepper .num { width: 34px; height: 34px; }
.ersal-section-head { margin: 29px 0 13px; }
.ersal-section-head a { text-decoration: none; font-weight: 600; font-size: 12px; }
.ersal-activity { gap: 18px; }
.ersal-activity .card { padding: 23px 24px; }
.ersal-activity .list li { align-items: center; }
.activity-header { display: flex; gap: 10px; align-items: center; margin-bottom: 11px; }
.activity-header h2 { margin: 0; }
.activity-icon { width: 38px; height: 38px; border-radius: 12px; background: #e6f5e7; color: #236143; display: grid; place-items: center; }
.activity-icon.reply-icon { background: #e6f0f8; color: #315d92; }
.ersal-empty-state { text-align: center; padding: 24px 12px 10px; color: var(--muted); font-size: 13px; }
.ersal-empty-state p { margin: 0; }
.ersal-empty-state a { display: inline-block; text-decoration: none; font-size: 12px; font-weight: 700; margin-top: 9px; }
.empty-art { color: #7fbc92; font-size: 33px; display: block; margin: 0 auto 9px; line-height: 1.4; animation: starDrift 6s ease-in-out infinite; }

/* Companies: list as source of truth; animation purely decorative */
.companies-intro { display: flex; gap: 16px; align-items: center; justify-content: space-between; border-radius: 22px; margin-bottom: 20px; padding: 16px 28px 16px 34px; background: linear-gradient(110deg,#edf7ee,#f9fcf7); border: 1px solid #e1eee1; overflow: hidden; min-height: 148px; }
.companies-intro h1 { margin: 3px 0 0; font-size: clamp(25px, 3vw, 33px); }
.companies-intro p { color: #708679; margin: 4px 0; font-size: 13px; }
.companies-total { font-size: 14px; padding: 3px 11px; border-radius: 40px; background: #dceee0; color: #35644a; vertical-align: middle; }
.companies-intro-art { max-width: 225px; flex: 0 1 225px; }
.companies-intro-art svg { display: block; width: 100%; height: 126px; }
.companies-dash { animation: routeMarch 13s linear infinite; }
.ersal-filter-chips { padding: 3px 0; }
.ersal-filter-chips .chip { border-radius: 11px; transition: background .2s, transform .2s; }
.ersal-filter-chips .chip:hover { transform: translateY(-2px); }
.company-list-heading { margin-bottom: 20px; }
.company-list-decor { font-size: 31px; line-height: 1; color: #8db69a; }
.ersal-company-list .row { margin-bottom: 10px; }
.ersal-company-list table tr { transition: background .2s; }
.ersal-company-list table tr:hover td { background: #f7faf7; }
.ersal-company-list td.title a { text-decoration: none; }
.ersal-company-list td.title a:hover { text-decoration: underline; }

/* Public onboarding: graphic is illustrative, never actual application state */
.ersal-public-header .wrap { justify-content: space-between; }
.ersal-public-header nav { display: flex; gap: clamp(8px, 2vw, 22px); align-items: center; font-size: 13px; }
.ersal-public-header nav a { text-decoration: none; color: var(--brand-forest); font-weight: 600; }
.ersal-public-header nav .btn { color: white; border-radius: 11px; }
.ersal-public-main { max-width: 1180px; }
.ersal-start-hero { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(280px,.85fr); gap: 14px; align-items: center; position: relative; overflow: hidden; min-height: 440px; padding: 45px 45px 42px 32px; border-radius: 26px; background: linear-gradient(115deg, #fbfefa,#f0f9ed); }
.ersal-start-hero .start-copy { position: relative; z-index: 1; }
.start-eyebrow { display: inline-flex; background: #def2e0; color: #236041; border-radius: 30px; font-size: 12px; font-weight: 700; padding: 5px 12px; }
.ersal-start-hero h1 { font-size: clamp(29px, 3.8vw, 47px); letter-spacing: -.7px; margin: 15px 0 10px; }
.ersal-start-hero h1 em { font-style: normal; color: #1b8061; }
.ersal-start-hero .muted { font-size: 15px; max-width: 550px; }
.ersal-start-hero .row { align-items: center; margin-top: 26px; }
.ersal-start-hero .row button { white-space: nowrap; }
.ersal-start-hero .hint { font-size: 12px; line-height: 1.8; }
.start-graphic { position: relative; width: min(100%,380px); height: 320px; margin: auto; display: grid; place-items: center; isolation: isolate; }
.start-orbit { position: absolute; border-radius: 50%; border: 1px solid #cfe9d2; }
.start-orbit.orbit-one { width: 290px; height: 290px; background: radial-gradient(circle,#ddefdc 0,transparent 69%); }
.start-orbit.orbit-two { width: 225px; height: 225px; border-style: dashed; border-color: #acd3b8; animation: spin 50s linear infinite; }
.floating-document { position: relative; width: 182px; height: 235px; background: #fff; border: 1px solid #e1eee2; border-radius: 18px; box-shadow: 0 21px 45px rgba(25,82,47,.16); transform: rotate(-7deg); padding: 27px 20px; display: flex; flex-direction: column; gap: 10px; animation: floatDocument 5.5s ease-in-out infinite; }
.doc-fold { position: absolute; left: 0; top: 0; border-top: 31px solid #dcefe1; border-right: 31px solid transparent; }
.doc-avatar { width: 39px; height: 39px; border-radius: 14px; background: linear-gradient(150deg,#bfe8c4,#e6f9d9); margin-bottom: 6px; }
.doc-line { width: 80%; height: 7px; background: #dfede1; border-radius: 5px; }
.doc-line.line-med { width: 66%; }
.doc-line.line-short { width: 52%; }
.doc-line.line-long { width: 92%; }
.doc-pill { margin-top: auto; align-self: start; background: #dcf3db; color: #327350; font: 700 12px/1.5 sans-serif; border-radius: 6px; padding: 3px 12px; }
.floating-send { position: absolute; right: 25px; top: 49px; width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: #215a47; color: #e2f9d9; box-shadow: 0 12px 25px rgba(20,78,43,.21); font-size: 32px; animation: planeFloat 4.8s ease-in-out infinite; }
.floating-reply { position: absolute; bottom: 44px; left: 0; background: #fff; border: 1px solid #dcebdd; color: #327550; padding: 9px 15px; border-radius: 12px; font-weight: 700; font-size: 14px; box-shadow: 0 10px 25px rgba(25,82,47,.11); animation: cardFloat 5s ease-in-out -1s infinite; }
.floating-reply span { font-size: 12px; }
.start-star { position: absolute; font-size: 30px; color: #91c5a4; animation: starDrift 5s ease-in-out infinite; }
.start-star.star-one { top: 30px; left: 60px; }
.start-star.star-two { bottom: 35px; right: 25px; animation-delay: -2.5s; }

/* Subtle animation, respectful accessibility */
.ersal-reveal { animation: sectionRise .55s var(--brand-ease) both; }
.ersal-reveal:nth-of-type(2) { animation-delay: .07s; }
.ersal-reveal:nth-of-type(3) { animation-delay: .11s; }
.ersal-reveal:nth-of-type(4) { animation-delay: .15s; }
.ersal-activity .ersal-reveal:nth-child(2) { animation-delay: .13s; }
@keyframes sectionRise { from { opacity: .01; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes planeFloat { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-13px) rotate(3deg); } }
@keyframes cardFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes floatDocument { 0%,100% { transform: translateY(0) rotate(-7deg); } 50% { transform: translateY(-10px) rotate(-5deg); } }
@keyframes routeMarch { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -180; } }
@keyframes starDrift { 0%,100% { transform: translateY(0) rotate(0); opacity: .65; } 50% { transform: translateY(-8px) rotate(17deg); opacity: 1; } }
@keyframes statusPulse { 0%,100% { box-shadow: 0 0 0 5px var(--live-ring); } 50% { box-shadow: 0 0 0 9px transparent; } }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .ersal-shell { grid-template-columns: 208px minmax(0,1fr); }
  .ersal-side { padding-inline: 13px; }
  .ersal-welcome { grid-template-columns: 1.1fr .85fr; }
  .ersal-welcome-copy { padding: 26px; }
  .ersal-main { padding-inline: 24px; }
}
@media (max-width: 800px) {
  .ersal-shell { display: block; }
  .ersal-side { display: none; }
  .ersal-topbar { height: 62px; padding-inline: 20px; }
  .ersal-main { padding: 22px 18px 110px; }
  .ersal-mobile-nav { display: flex; position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; padding: 7px 8px calc(6px + env(safe-area-inset-bottom)); gap: 2px; background: rgba(255,255,255,.97); border-top: 1px solid #dfe9e2; box-shadow: 0 -8px 26px rgba(15,45,27,.05); backdrop-filter: blur(16px); }
  .ersal-mobile-nav a { flex: 1; min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; font-size: 10px; font-weight: 600; color: #829487; border-radius: 11px; transition: background .18s, color .18s, transform .18s; }
  .ersal-mobile-nav a.on { color: #236247; background: #eaf5eb; }
  .ersal-mobile-nav a:hover { color: #236247; }
  .ersal-mobile-nav .i { width: 20px; height: 20px; }
  .ersal-work footer.site { padding-bottom: 88px; }
  .ersal-welcome { grid-template-columns: 1.1fr .9fr; min-height: 240px; }
  .ersal-welcome h1 { font-size: 29px; }
  .journey-svg { min-width: 0; }
  .ersal-start-hero { padding: 30px; }
}
@media (max-width: 590px) {
  .ersal-topbar { padding-inline: 16px; }
  .ersal-crumb { gap: 7px; font-size: 12px; }
  .ersal-head-actions { gap: 8px; }
  .ersal-top-avatar { width: 30px; height: 30px; }
  .ersal-main { padding-inline: 14px; padding-top: 17px; }
  .ersal-welcome { grid-template-columns: 1fr; min-height: 0; border-radius: 20px; }
  .ersal-welcome-copy { padding: 25px 24px 4px; }
  .ersal-welcome h1 { font-size: 29px; }
  .ersal-welcome p { font-size: 12px; margin-bottom: 14px; }
  .welcome-illustration { height: 150px; padding: 0; overflow: hidden; }
  .journey-svg { width: 270px; max-height: none; margin-top: -14px; }
  .welcome-actions { gap: 16px; }
  .ersal-live-hero { gap: 15px; }
  .ersal-main .stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .ersal-main .stat { padding: 14px 12px; border-radius: 14px; }
  .ersal-main .stat .num { font-size: 24px; }
  .ersal-main .stat .lbl { font-size: 12px; }
  .ersal-main .stat .ico { width: 33px; height: 33px; }
  .ersal-main .card { padding: 17px; }
  .ersal-main .ersal-welcome { padding: 0; }
  .ersal-activity .card { padding: 17px 16px; }
  .ersal-section-head h2 { font-size: 16px; }
  .companies-intro { padding: 19px 18px; min-height: 108px; }
  .companies-intro-art { flex-basis: 110px; }
  .companies-intro-art svg { height: 98px; }
  .companies-intro h1 { font-size: 25px; }
  .companies-intro p { font-size: 11px; }
  .ersal-start-hero { grid-template-columns: 1fr; padding: 25px 21px; }
  .ersal-start-hero h1 { font-size: 31px; }
  .start-graphic { height: 225px; width: 260px; }
  .start-orbit.orbit-one { width: 220px; height: 220px; }
  .start-orbit.orbit-two { width: 178px; height: 178px; }
  .floating-document { transform: scale(.72) rotate(-7deg); animation: none; width: 150px; height: 182px; padding: 22px 16px; }
  .floating-send { right: 12px; top: 25px; transform: scale(.8); animation: none; }
  .floating-reply { bottom: 18px; left: -12px; }
  .ersal-public-header nav { gap: 9px; font-size: 11px; }
  .ersal-public-header nav a:not(.btn) { display: none; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-shell: #0f1613; --brand-line: #273e30; --brand-muted: #9eada2;
  }
  :root:not([data-theme="light"]) body { background: var(--bg); }
  :root:not([data-theme="light"]) .ersal-side, :root:not([data-theme="light"]) .ersal-topbar, :root:not([data-theme="light"]) .ersal-mobile-nav { background: #17201c; border-color: #293c2f; }
  :root:not([data-theme="light"]) .ersal-side a, :root:not([data-theme="light"]) .ersal-side small, :root:not([data-theme="light"]) .ersal-crumb strong { color: #d9e9de; }
  :root:not([data-theme="light"]) .ersal-nav a.on, :root:not([data-theme="light"]) .ersal-mobile-nav a.on { background: #23402d; }
  :root:not([data-theme="light"]) .side-note { background: #223729; border-color: #35513b; }
  :root:not([data-theme="light"]) .side-note p { color: #b3cabb; }
  :root:not([data-theme="light"]) .ersal-live-hero, :root:not([data-theme="light"]) .ersal-main .stat, :root:not([data-theme="light"]) .ersal-start-hero { background: var(--card); border-color: var(--line); }
  :root:not([data-theme="light"]) .companies-intro { background: #1d3026; border-color: #2c4332; }
  :root:not([data-theme="light"]) .companies-intro p, :root:not([data-theme="light"]) .ersal-start-hero .muted { color: #a9beae; }
  :root:not([data-theme="light"]) .ersal-company-list table tr:hover td, :root:not([data-theme="light"]) .ersal-setup .stepper li:hover { background: #1d3026; }
  :root:not([data-theme="light"]) .ersal-start-hero h1 { color: #e5f0e8; }
  :root:not([data-theme="light"]) .ersal-mobile-nav a.on { color: #cbf3d5; }
  :root:not([data-theme="light"]) .side-avatar, :root:not([data-theme="light"]) .ersal-top-avatar { background: #2e4a39; color: #d2f0d7; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Real aggregate progress: based solely on counts.sent and counts.queued. */
.ersal-overall-progress { margin: 19px 0 15px; padding: 16px; border: 1px solid var(--brand-line); border-radius: 13px; background: #f8fbf8; }
.progress-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #2b664b; font-size: 12px; margin-bottom: 10px; }
.progress-heading > span { font-size: 14px; font-weight: 700; }
.progress-track { height: 10px; border-radius: 99px; overflow: hidden; background: #e2eee4; }
.progress-track > span { display: block; height: 100%; background: linear-gradient(90deg,#2f8b64,#80cd92); border-radius: inherit; animation: progressGrow .9s var(--brand-ease) both; transform-origin: right center; }
.progress-legend { display: flex; align-items: center; gap: 16px; color: #7a9080; font-size: 11px; margin-top: 8px; }
@keyframes progressGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ersal-overall-progress { background: #1b2c21; } :root:not([data-theme="light"]) .progress-heading { color: #b6dec1; } }

/* اللوحة: بطاقة المراجعة، البانرات، التقدم، والخطوات */
.ersal-side { position: relative; height: auto; min-height: 100vh; align-self: stretch; }
.side-bottom { margin-top: 34px; }
.ersal-nav-ping { width: auto; min-width: 22px; height: 22px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; opacity: 1; }
.ersal-nav-ping[hidden] { display: none; }
.ersal-top-avatar { width: 44px; height: 44px; }
.ersal-side .side-account, .ersal-side .side-logout button { min-height: 44px; }
.ersal-side .side-label, .ersal-brand small, .side-note p, .side-account-name small, .side-logout .ghost { font-size: 12px; }
.ersal-head-actions .mode { min-height: 44px; }
.ersal-section-head a, .ersal-empty-state a, footer.site a, .welcome-secondary, .stepper .body a { min-height: 44px; display: inline-flex; align-items: center; }
.ersal-section-head a { font-size: 13px; }
footer.site a { padding: 0 8px; }
.section-kicker, .side-label { font-size: 12px; }
.ersal-hero-compact { min-height: 0; display: block; border-radius: 20px; }
.ersal-hero-compact .ersal-welcome-copy { padding: 18px 26px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ersal-hero-compact h1 { font-size: 19px; margin: 0; }
.ersal-hero-compact p, .ersal-hero-compact .welcome-kicker, .ersal-hero-compact .welcome-illustration, .ersal-hero-compact .welcome-secondary { display: none; }
.ersal-hero-compact .welcome-actions { margin: 0; }
.ersal-welcome .welcome-cta { min-height: 44px; }
.ersal-live-hero .state { font-size: 18px; line-height: 1.4; }
.ersal-live-hero .sub { font-size: 12px; }
.ersal-live-hero .sub svg { width: 16px; height: 16px; }
.ersal-live-hero .ring .val span { font-size: 12px; }
.ersal-live-hero .info { min-width: 0; }
.ersal-live-hero .ring .bar { transition: stroke-dasharray .5s var(--brand-ease); }
.ersal-live-hero .status-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }
.ersal-live-hero .status-actions .btn { min-height: 44px; }
.ersal-review-card { padding: 17px 20px !important; background: var(--card); border: 1px solid var(--primary-line) !important; }
.ersal-review-card .review-content { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ersal-review-card .review-label { font-size: 17px; line-height: 1.45; font-weight: 700; }
.ersal-review-card .review-label strong { color: var(--primary); }
.ersal-review-card .review-preview { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.ersal-review-card .review-cta { flex: 0 0 auto; min-height: 44px; }
.ersal-review-card.is-empty { border-color: var(--line) !important; }
.ersal-review-card.is-empty .review-label strong { color: var(--muted); }
.ersal-dual-banners { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.ersal-dual-banners .banner { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 74px; padding: 14px 16px; border-radius: 14px; }
.ersal-dual-banners .banner a { display: inline-flex; min-height: 44px; flex: 0 0 auto; align-items: center; justify-content: center; border-radius: 10px; padding: 0 13px; font-size: 13px; font-weight: 700; text-decoration: none; }
.ersal-dual-banners .quota-banner { background: var(--primary-soft); color: var(--primary); }
.ersal-dual-banners .quota-banner a { background: var(--primary); color: var(--primary-ink); }
.ersal-dual-banners .mode-banner { background: var(--warn-bg); color: var(--warn); }
.ersal-dual-banners .mode-banner a { color: var(--warn); text-decoration: underline; }
.ersal-dual-banners .mode-banner.is-live { background: var(--ok-bg); color: var(--ok); }
.ersal-dual-banners .mode-banner.is-live a { color: var(--ok); }
.stat .num bdi { display: inline-block; }
.ersal-main .stat .stat-hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.ersal-summary .section-heading { margin-bottom: 10px; }
.ersal-summary .total-progress { color: var(--muted); font-size: 13px; }
.ersal-summary .progress-heading { font-size: 12px; }
.ersal-summary .progress-heading > span { font-size: 13px; }
.ersal-overall-progress .progress-legend { font-size: 12px; }
.ersal-setup .stepper li { padding: 0; border-bottom: 1px solid var(--line-soft); }
.ersal-setup .stepper li a { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 9px 5px; color: var(--text); text-decoration: none; }
.ersal-setup .stepper li .body { margin: 0; }
.ersal-setup .stepper li .body strong { font-size: 14px; }
.ersal-setup .stepper li .body .hint { font-size: 12px; }
.ersal-setup .stepper li .step-arrow { margin-inline-start: auto; color: var(--muted); font-size: 18px; }
.ersal-activity .list .meta { font-size: 12px; white-space: normal; }
.ersal-activity .list li { align-items: center; }
.ersal-activity .list .who { font-size: 14px; }
.ersal-activity .list li .avatar { width: 36px; height: 36px; }
.ersal-activity .list .grow { display: flex; flex-direction: column; line-height: 1.55; }
.ersal-activity .list .status-time { color: var(--muted); font-size: 12px; }
.ersal-activity .list .pill { font-size: 12px; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 2px 8px; }
.ersal-activity .list .pill.reply { background: var(--info-bg); color: var(--info); }
.ersal-activity .activity-caption { color: var(--muted); font-size: 12px; margin: -5px 0 12px; }
@media (max-width: 800px) {
  .ersal-mobile-nav a { font-size: 12px; min-height: 56px; }
  .ersal-mobile-nav a .i { width: 20px; height: 20px; }
  .ersal-top-avatar { width: 44px; height: 44px; }
  .ersal-dual-banners { grid-template-columns: 1fr; }
}
@media (max-width: 599px) {
  .ersal-main { padding: 9px 13px 110px; }
  .ersal-welcome, .ersal-welcome.ersal-hero-compact { min-height: 0; display: block; margin-bottom: 9px; }
  .ersal-welcome .welcome-illustration { display: none !important; }
  .ersal-welcome-copy, .ersal-hero-compact .ersal-welcome-copy { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 11px 13px; align-items: center; }
  .ersal-welcome h1, .ersal-hero-compact h1 { font-size: 17px; line-height: 1.35; margin: 0; }
  .ersal-welcome .welcome-kicker { display: none; }
  .ersal-welcome p, .ersal-hero-compact p { display: block; margin: 0; grid-column: 1; grid-row: 2; font-size: 12px; line-height: 1.5; max-width: 210px; }
  .ersal-welcome .welcome-actions { grid-column: 2; grid-row: 1/3; gap: 0; }
  .ersal-welcome .welcome-cta { display: inline-flex; padding: 4px 11px; min-height: 44px; font-size: 12px; white-space: nowrap; }
  .ersal-welcome .welcome-secondary { display: none; }
  .ersal-live-hero { display: flex; flex-wrap: nowrap; min-height: 0; margin-bottom: 9px; padding: 12px !important; gap: 10px; }
  .ersal-live-hero .status-accent { display: none; }
  .ersal-live-hero .ring, .ersal-live-hero .ring svg { width: 57px; height: 57px; }
  .ersal-live-hero .ring svg { overflow: visible; }
  .ersal-live-hero .ring .val strong { font-size: 18px; }
  .ersal-live-hero .ring .val span { font-size: 12px; }
  .ersal-live-hero .info { flex: 1; gap: 0; }
  .ersal-live-hero .info .section-kicker { font-size: 12px; margin: 0; }
  .ersal-live-hero .state { font-size: 14px; gap: 7px; line-height: 1.4; }
  .ersal-live-hero .dot { width: 10px; height: 10px; }
  .ersal-live-hero .sub { font-size: 12px; }
  .ersal-live-hero .sub svg { display: none; }
  .ersal-review-card { margin-bottom: 9px; padding: 11px 12px !important; }
  .ersal-review-card .review-content { gap: 8px; }
  .ersal-review-card .review-label { font-size: 14px; }
  .ersal-review-card .review-preview { font-size: 12px; line-height: 1.5; }
  .ersal-review-card .review-cta { padding: 0 12px; min-height: 44px; font-size: 13px; }
  .ersal-dual-banners { gap: 8px; }
  .ersal-dual-banners .banner { min-height: 58px; padding: 8px 12px; font-size: 12px; }
  .ersal-dual-banners .banner a { font-size: 12px; }
  .ersal-main .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ersal-mobile-nav { padding-inline: 4px; gap: 1px; }
  .ersal-mobile-nav a { min-width: 0; padding: 3px 0; font-size: 12px; }
  .ersal-topbar { height: 58px; }
  .ersal-crumb { font-size: 12px; }
  .ersal-head-actions .mode { font-size: 12px; min-height: 44px; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ersal-review-card { background: var(--card); border-color: var(--primary-line) !important; }
  :root:not([data-theme="light"]) .ersal-dual-banners .quota-banner { background: var(--primary-soft); }
  :root:not([data-theme="light"]) .ersal-dual-banners .mode-banner { background: var(--warn-bg); }
  :root:not([data-theme="light"]) .ersal-dual-banners .mode-banner.is-live { background: var(--ok-bg); }
}


/* 44×44 للمس، و12px حد أدنى للنص على الجوال */
@media (max-width: 800px) {
  .ersal-filter-chips a.chip, .ersal-company-list a, .ersal-company-list button,
  .ersal-company-list button.ghost, .companies-intro a, .ersal-public-header nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .companies-intro p, .ersal-public-header nav,
  .ersal-public-header .hint, .side-note p { font-size: 12px; }
  table.cards td[data-label] button, table.cards td[data-label] .ghost { min-height: 44px; }
  .ersal-main a[href="/blocklist"] { min-height: 44px; display: inline-flex; align-items: center; }
}

/* أزرار الحالة الحقيقية (بدء/إيقاف/حصلت وظيفة) تبقى ظاهرة في الجوال */
.ersal-live-hero .actions { margin-inline-start: auto; }
.ersal-status-wrap > .banner, .ersal-status-wrap > .hint { margin-top: 0; }
.ersal-activity .list .badge { font-size: 12px; margin-inline-start: 4px; }
.ersal-setup .stepper li.final { padding: 9px 5px; display: flex; align-items: center; gap: 12px; }
.ersal-setup .stepper li.final .body { display: flex; flex-direction: column; }
.ersal-setup .stepper li a .body { display: flex; flex-direction: column; }
@media (max-width: 599px) {
  .ersal-live-hero { flex-wrap: wrap; }
  .ersal-live-hero .actions { width: 100%; margin: 4px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
  .ersal-live-hero .actions button { min-height: 44px; }
}
.ersal-mobile-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* زر الخروج في «حسابي»: القائمة الجانبية تختفي في الجوال، فهذا المكان الوحيد له هناك */
.account-logout form { margin: 0; }
.account-logout button.ghost { width: 100%; min-height: 44px; font-size: 14px; color: var(--bad); border-color: var(--line); }
.account-logout button.ghost:hover { color: var(--bad); }
