/* ============================================================
   SxEditor — استایل ویرایشگر متن غنی (پنل مدیریت) + استایل محتوای خروجی
   وابسته به توکن‌های tokens.css (تم تیره پیش‌فرض، روشن با html[data-theme=light]).
   بخش «محتوا» با .sx-content (داخل ویرایشگر) و .sx-prose (صفحهٔ عمومی) مشترک است.
   ============================================================ */

/* ---------- ۱. قاب ---------- */
.sx-ed {
  --sx-accent: var(--primary, #6366f1);
  position: relative; display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--border-1, #1e1e3a); border-radius: var(--radius-lg, 12px);
  background: var(--elev-1, #0d0d1a); color: var(--text-1, #e8e8f5);
  font-family: var(--font-sans, Tahoma, sans-serif); text-align: start;
  transition: border-color var(--dur-fast, .12s), box-shadow var(--dur-fast, .12s);
}
:root[data-theme="light"] .sx-ed { background: var(--card); }
.sx-ed.sx-ed-focus { border-color: var(--primary); box-shadow: var(--ring-primary); }
.sx-ed *, .sx-ed *::before, .sx-ed *::after { box-sizing: border-box; }
.sx-ed [hidden] { display: none !important; }
.sx-ic { width: 18px; height: 18px; flex-shrink: 0; display: block; }
.sx-ic-sm { width: 14px; height: 14px; opacity: .7; }
[dir="rtl"] .sx-flip { transform: scaleX(-1); }

/* ---------- ۲. نوار ابزار ---------- */
.sx-tb {
  position: sticky; top: 0; z-index: 6;
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 6px; background: var(--card); border-bottom: 1px solid var(--border-1);
  border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
}
.sx-tbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 34px; height: 34px; padding: 0 7px; border: 1px solid transparent; border-radius: var(--radius-sm, 8px);
  background: transparent; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; line-height: 1;
  transition: background var(--dur-fast, .12s), color var(--dur-fast, .12s);
}
.sx-tbtn:hover { background: var(--elev-3); color: var(--text-1); }
.sx-tbtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.sx-tbtn[aria-pressed="true"] { background: var(--primary-tint-strong); color: var(--primary-light); }
.sx-tbtn[aria-expanded="true"] { background: var(--elev-3); color: var(--text-1); }
.sx-tbtn[aria-disabled="true"], .sx-tbtn:disabled { opacity: .38; cursor: default; background: transparent; }
.sx-sep { width: 1px; height: 20px; background: var(--border-2); margin: 0 4px; flex-shrink: 0; }
.sx-t-block { min-width: 112px; justify-content: space-between; border-color: var(--border-1); padding: 0 10px; font-weight: 600; }
.sx-blabel { white-space: nowrap; }
.sx-cbar { position: absolute; inset-inline: 9px; bottom: 4px; height: 3px; border-radius: 2px; background: #dc2626; }
.sx-t-highlight .sx-cbar { background: #facc15; }
.sx-t-more { display: none; }
.sx-ed-narrow .sx-t-more { display: inline-flex; margin-inline-start: auto; }
.sx-ed-narrow:not(.sx-ed-more) .sx-tbtn[data-low] { display: none; }
.sx-ed-narrow .sx-sep { display: none; }
.sx-ed-src .sx-tbtn:disabled { opacity: .25; }
.sx-ed-incode .sx-t-bold, .sx-ed-incode .sx-t-italic, .sx-ed-incode .sx-t-underline, .sx-ed-incode .sx-t-strike,
.sx-ed-incode .sx-t-color, .sx-ed-incode .sx-t-highlight, .sx-ed-incode .sx-t-link { opacity: .45; }

/* ---------- ۳. جست‌وجو ---------- */
.sx-find { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 8px; background: var(--elev-2); border-bottom: 1px solid var(--border-1); }
.sx-find-row { display: flex; align-items: center; gap: 6px; flex: 1 1 280px; min-width: 0; }
.sx-find-n { font-size: 12px; color: var(--text-muted); min-width: 62px; text-align: center; white-space: nowrap; }
.sx-find-n.is-none { color: var(--red-light); }
::highlight(sx-find) { background-color: rgba(250, 204, 21, .32); }
::highlight(sx-find-cur) { background-color: rgba(249, 115, 22, .8); color: #111; }

/* ---------- ۴. ورودی‌ها و دکمه‌های رابط ---------- */
.sx-ed input[type="text"], .sx-ed input[type="search"], .sx-ed input[type="url"], .sx-ed select {
  height: 38px; min-width: 0; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--radius-sm, 8px);
  background: var(--bg2); color: var(--text-1); font: inherit; font-size: 13.5px; width: 100%;
}
.sx-ed input:focus, .sx-ed select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring-primary); }
.sx-ed input[aria-invalid="true"] { border-color: var(--red); }
.sx-ed input[dir="ltr"] { text-align: left; font-family: var(--font-mono); font-size: 12.5px; }
.sx-ub {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; flex-shrink: 0;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm, 8px); background: var(--elev-3); color: var(--text-1);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.sx-ub:hover { border-color: var(--border-3); }
.sx-ub:focus-visible, .sx-ib:focus-visible, .sx-cbtn:focus-visible, .sx-mi:focus-visible, .sx-ch:focus-visible, .sx-tc:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.sx-ub:disabled { opacity: .5; cursor: progress; }
.sx-ub-pri { background: var(--primary); border-color: var(--primary); color: #fff; }
.sx-ub-pri:hover { filter: brightness(1.08); border-color: var(--primary); }
.sx-ub-ghost { background: transparent; }
.sx-ub-danger { background: transparent; color: var(--red-light); border-color: var(--red-border-tint); }
.sx-ub-danger:hover { background: var(--red-tint); border-color: var(--red); }
.sx-ub .sx-ic { width: 16px; height: 16px; }
.sx-ib { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0; border: 0; border-radius: var(--radius-sm, 8px); background: transparent; color: var(--text-muted); cursor: pointer; }
.sx-ib:hover { background: var(--elev-3); color: var(--text-1); }

/* ---------- ۵. ناحیهٔ متن، نمای HTML، نوار وضعیت ---------- */
.sx-main { position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.sx-content { position: relative; flex: 1 1 auto; min-height: 320px; padding: 18px 22px 26px; outline: none; font-size: 15.5px; line-height: 1.95; color: var(--text-1); overflow-wrap: break-word; caret-color: var(--primary); }
.sx-ed-basic .sx-content { min-height: 140px; padding: 12px 14px 16px; font-size: 14px; line-height: 1.85; }
.sx-ed-isempty .sx-content::before { content: attr(data-placeholder); position: absolute; top: 18px; inset-inline: 22px; color: var(--text-dim); pointer-events: none; }
.sx-ed-basic.sx-ed-isempty .sx-content::before { top: 12px; inset-inline: 14px; }
.sx-src { display: block; width: 100%; min-height: 280px; resize: vertical; margin: 0; border: 0; padding: 14px 16px; background: var(--bg2); color: var(--text-1); font: 12.5px/1.75 var(--font-mono); outline: none; white-space: pre-wrap; tab-size: 2; direction: ltr; text-align: left; }
.sx-ed-drop .sx-content { outline: 2px dashed var(--primary); outline-offset: -8px; background: var(--primary-tint); }
.sx-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 32px; padding: 5px 12px; border-top: 1px solid var(--border-1); background: var(--card); border-radius: 0 0 var(--radius-lg, 12px) var(--radius-lg, 12px); font-size: 12px; color: var(--text-muted); }
.sx-st-warn:empty, .sx-st-msg:empty { display: none; }
.sx-st-warn { color: var(--yellow-light); }
.sx-st-msg { margin-inline-start: auto; color: var(--text-2); }
.sx-st-msg.is-err { color: var(--red-light); }
.sx-st-msg.is-warn { color: var(--yellow-light); }
.sx-st-hint { border: 1px dashed var(--primary-border-tint); background: var(--primary-tint); color: var(--primary-light); border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 11.5px; cursor: pointer; }

/* ---------- ۶. لایهٔ شناور: منو، پاپ‌آپ، نوار زمینه‌ای ---------- */
.sx-layer { position: fixed; top: 0; left: 0; width: 0; height: 0; z-index: 1000; }
.sx-pop, .sx-ctx, .sx-bubble {
  position: absolute; top: 0; left: 0; z-index: 2;
  background: var(--card); border: 1px solid var(--border-2); border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-pop-lg), 0 0 0 1px rgba(0, 0, 0, .04); color: var(--text-1);
  font-family: var(--font-sans, Tahoma, sans-serif); font-size: 13.5px; line-height: 1.5;
}
.sx-menu { width: max-content; min-width: 210px; max-width: calc(100vw - 16px); max-height: min(440px, 72vh); overflow: auto; padding: 6px; }
.sx-mi { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: var(--radius-sm, 8px); background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.sx-mi:hover, .sx-mi:focus-visible, .sx-mi.is-active { background: var(--elev-4); outline: none; }
.sx-mi[aria-checked="true"] { background: var(--primary-tint); color: var(--primary-light); }
.sx-mi .sx-ic { color: var(--text-muted); }
.sx-mi-l { flex: 1; }
.sx-mi-k { margin-inline-start: 14px; font: 11px var(--font-mono, monospace); color: var(--text-dim); background: none; border: 0; padding: 0; }
.sx-mglyph { width: 18px; text-align: center; font-weight: 800; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.sx-mhead { padding: 4px 10px 6px; font-size: 11.5px; color: var(--text-dim); }
.sx-msep { height: 1px; margin: 4px 6px; background: var(--border-1); }
.sx-mempty { padding: 10px; color: var(--text-dim); font-size: 12.5px; }
.sx-m-h2 .sx-mi-l { font-size: 19px; font-weight: 800; }
.sx-m-h3 .sx-mi-l { font-size: 16.5px; font-weight: 800; }
.sx-m-h4 .sx-mi-l { font-size: 15px; font-weight: 700; }
.sx-m-h5 .sx-mi-l { font-size: 14px; font-weight: 700; }
.sx-m-fs-small .sx-mi-l { font-size: 12px; } .sx-m-fs-large .sx-mi-l { font-size: 17px; } .sx-m-fs-xlarge .sx-mi-l { font-size: 20px; }
.sx-slash { width: 250px; max-height: 300px; overflow: auto; padding: 6px; }
.sx-ptitle { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 700; font-size: 13px; }
.sx-psub { margin: 10px 0 6px; font-size: 11.5px; color: var(--text-muted); }
.sx-colorpop { width: 296px; padding: 12px; }
.sx-sws { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.sx-sw { aspect-ratio: 1; min-width: 26px; padding: 0; border: 1px solid rgba(127, 127, 127, .4); border-radius: 7px; cursor: pointer; }
.sx-sw:hover { transform: scale(1.1); }
.sx-prow { display: flex; gap: 6px; margin-top: 12px; }
.sx-prow .sx-hex { flex: 1; }
.sx-cpick { flex-shrink: 0; width: 38px; height: 38px; padding: 2px; border: 1px solid var(--border-2); border-radius: var(--radius-sm, 8px); background: var(--bg2); cursor: pointer; }
.sx-wide { width: 100%; margin-top: 8px; }
.sx-tablepop { width: 300px; padding: 12px; }
.sx-tsize { font-weight: 600; color: var(--primary-light); }
.sx-tgrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin-bottom: 10px; }
.sx-tc { aspect-ratio: 1; min-height: 20px; padding: 0; border: 1px solid var(--border-2); border-radius: 3px; background: var(--bg2); cursor: pointer; }
.sx-tc.is-on { background: var(--primary-tint-strong); border-color: var(--primary); }
.sx-charspop { width: 290px; padding: 12px; }
.sx-chars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.sx-ch { height: 40px; padding: 0; border: 1px solid var(--border-1); border-radius: var(--radius-sm, 8px); background: var(--bg2); color: var(--text-1); font: inherit; font-size: 18px; cursor: pointer; }
.sx-ch small { font-size: 10px; font-family: var(--font-mono, monospace); color: var(--text-muted); }
.sx-ch:hover { border-color: var(--primary); }
.sx-chk { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--text-2); }
.sx-chk input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.sx-ctx, .sx-bubble { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; width: max-content; max-width: min(860px, calc(100vw - 12px)); padding: 4px; }
.sx-cbtn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 32px; min-width: 32px; padding: 0 8px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.sx-cbtn .sx-ic { width: 16px; height: 16px; }
.sx-cbtn:hover { background: var(--elev-4); color: var(--text-1); }
.sx-cbtn[aria-pressed="true"] { background: var(--primary-tint-strong); color: var(--primary-light); }
.sx-cdanger:hover { background: var(--red-tint); color: var(--red-light); }
.sx-cwarn { color: var(--yellow-light); }
.sx-csep { width: 1px; height: 18px; margin: 0 3px; background: var(--border-2); }
.sx-clab { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.sx-ctx select { height: 30px; width: auto; padding: 0 6px; font-family: var(--font-mono, monospace); font-size: 12px; }
.sx-cid { font: 12px var(--font-mono, monospace); color: var(--primary-light); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-bub-url { max-width: 260px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px var(--font-mono, monospace); color: var(--primary-light); }

/* ---------- ۷. دیالوگ ---------- */
.sx-dlg-bd { position: fixed; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--overlay, rgba(0, 0, 0, .6)); backdrop-filter: blur(2px); }
.sx-dlg { width: min(470px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border: 1px solid var(--border-2); border-radius: var(--radius-2xl, 16px); box-shadow: var(--shadow-panel); color: var(--text-1); font-family: var(--font-sans, Tahoma, sans-serif); animation: sx-dlg-in .18s var(--ease-out, ease-out); }
@keyframes sx-dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.sx-dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 6px; }
.sx-dlg-h h3 { margin: 0; font-size: 16px; font-weight: 800; }
.sx-dlg-b { padding: 8px 16px 4px; }
.sx-dlg-f { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 16px; }
.sx-dlg-f .sx-ub-danger { margin-inline-start: auto; }
.sx-dlg-f .sx-ub-ghost { order: 3; }
.sx-f { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.sx-fl { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.sx-fh { font-size: 11.5px; color: var(--text-dim); line-height: 1.6; }
.sx-frow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sx-upst { font-size: 12px; color: var(--green-light); }
.sx-seg { border: 0; margin: 0 0 12px; padding: 0; min-width: 0; }
.sx-seg legend { padding: 0; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.sx-seg-o { display: flex; flex-wrap: wrap; gap: 6px; }
.sx-seg label { position: relative; cursor: pointer; }
.sx-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sx-seg span { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border: 1px solid var(--border-2); border-radius: 999px; font-size: 12.5px; color: var(--text-2); background: var(--bg2); }
.sx-seg input:checked + span { border-color: var(--primary); background: var(--primary-tint-strong); color: var(--primary-light); font-weight: 700; }
.sx-seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.sx-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 2px 0 10px; }
.sx-err { margin: 6px 0; color: var(--red-light); font-size: 12.5px; }
.sx-warn { margin: 6px 0; padding: 8px 10px; border: 1px solid var(--yellow-border-tint); border-radius: var(--radius-sm, 8px); background: var(--yellow-tint); color: var(--yellow-light); font-size: 12.5px; line-height: 1.7; }
.sx-imgprev { margin-bottom: 12px; text-align: center; }
.sx-imgprev img { display: inline-block; max-width: 100%; max-height: 150px; border-radius: 8px; border: 1px solid var(--border-1); }
.sx-vparse { margin: -4px 0 10px; font-size: 12px; min-height: 1em; }
.sx-vparse.is-ok { color: var(--green-light); } .sx-vparse.is-bad { color: var(--red-light); }
.sx-or { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; color: var(--text-dim); font-size: 12px; }
.sx-or::before, .sx-or::after { content: ''; flex: 1; height: 1px; background: var(--border-1); }

/* ---------- ۸. تمام‌صفحه ---------- */
.sx-ed.sx-ed-fs { position: fixed; inset: 0; z-index: 1200; border: 0; border-radius: 0; background: var(--bg); box-shadow: none; }
.sx-ed-fs .sx-tb { position: static; justify-content: center; border-radius: 0; }
.sx-ed-fs .sx-main { overflow: auto; }
.sx-ed-fs .sx-content { width: 100%; max-width: 820px; margin: 0 auto; padding: 40px 24px 120px; font-size: 17px; }
.sx-ed-fs.sx-ed-isempty .sx-content::before { top: 40px; inset-inline: 24px; }
.sx-ed-fs .sx-src { flex: 1; height: auto !important; }
.sx-ed-fs .sx-status { justify-content: center; border-radius: 0; }
html.sx-ed-noscroll, html.sx-ed-noscroll body { overflow: hidden !important; }

/* ---------- ۹. حالت‌های ویرایشگر روی محتوا ---------- */
.sx-content .sx-ed-selected { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 10px; }
.sx-content figure[contenteditable="false"] { cursor: default; }
.sx-content .sx-figure img[alt=""], .sx-content .sx-figure img:not([alt]) { outline: 2px dashed var(--yellow); outline-offset: 2px; }
.sx-content figcaption:empty::before, .sx-content figcaption > br:only-child::before { content: 'زیرنویس…'; color: var(--text-dim); }
.sx-content ul.sx-checklist > li::before { cursor: pointer; }
.sx-content .sx-col { border: 1px dashed var(--border-2); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.sx-content details { padding-bottom: 4px; }
.sx-content details[data-sx-closed] > summary::after { content: ' — بسته در نمایش'; font-weight: 400; font-size: .8em; color: var(--text-dim); }
.sx-content .sx-toc::before { content: '☰  فهرست مطالب — در صفحهٔ مقاله خودکار از عنوان‌ها ساخته می‌شود'; }
.sx-content a { cursor: text; }
.sx-ed-uploading { margin: 1em 0; }
.sx-ed-upl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 18px; border: 1.5px dashed var(--primary-border-tint); border-radius: 12px; background: var(--primary-tint); color: var(--text-2); font-size: 13px; }
.sx-ed-spin { width: 18px; height: 18px; border: 2px solid var(--primary-border-tint); border-top-color: var(--primary); border-radius: 50%; animation: sx-spin .8s linear infinite; }
.sx-ed-bar { flex-basis: 100%; height: 4px; overflow: hidden; border-radius: 4px; background: var(--border-1); }
.sx-ed-bar i { display: block; width: 40%; height: 100%; background: var(--primary); border-radius: 4px; animation: sx-indet 1.2s ease-in-out infinite; }
@keyframes sx-spin { to { transform: rotate(360deg); } }
@keyframes sx-indet { 0% { transform: translateX(-120%); } 100% { transform: translateX(260%); } }
[dir="rtl"] .sx-ed-bar i { animation-name: sx-indet-rtl; }
@keyframes sx-indet-rtl { 0% { transform: translateX(120%); } 100% { transform: translateX(-260%); } }
.sx-embed-ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; aspect-ratio: 16 / 9; border-radius: 12px; background: linear-gradient(135deg, #1e1b4b, #0f172a 70%); color: #e8e8f5; user-select: none; text-align: center; padding: 12px; }
.sx-embed-play { display: flex; align-items: center; justify-content: center; width: 64px; height: 44px; border-radius: 12px; background: #ef4444; color: #fff; font-size: 18px; }
.sx-embed-meta { font-size: 13px; opacity: .9; }
.sx-embed-meta bdi { font-family: var(--font-mono, monospace); font-size: 12px; }
.sx-embed-t { font-size: 12px; opacity: .7; }

/* ---------- ۱۰. محتوا (مشترک ویرایشگر و صفحهٔ عمومی: .sx-prose) ---------- */
:where(.sx-content, .sx-prose) > :first-child { margin-top: 0; }
:where(.sx-content, .sx-prose) p { margin: 0 0 .9em; }
:where(.sx-content, .sx-prose) :is(h2, h3, h4, h5, h6) { margin: 1.4em 0 .55em; line-height: 1.45; color: var(--text-1); scroll-margin-top: 90px; }
:where(.sx-content, .sx-prose) h2 { font-size: 1.55em; font-weight: 800; }
:where(.sx-content, .sx-prose) h3 { font-size: 1.3em; font-weight: 800; }
:where(.sx-content, .sx-prose) h4 { font-size: 1.12em; font-weight: 700; }
:where(.sx-content, .sx-prose) :is(h5, h6) { font-size: 1em; font-weight: 700; }
:where(.sx-content, .sx-prose) a { color: var(--primary-light); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:where(.sx-content, .sx-prose) :is(ul, ol) { margin: 0 0 .9em; padding-inline-start: 1.6em; }
:where(.sx-content, .sx-prose) ul { list-style: disc; }
:where(.sx-content, .sx-prose) ol { list-style: decimal; }
:where(.sx-content, .sx-prose):where([dir="rtl"], [dir="rtl"] *) ol:not([dir="ltr"]) { list-style-type: persian; }
:where(.sx-content, .sx-prose) :is(ul, ol) ul { list-style: circle; }
:where(.sx-content, .sx-prose) li::marker { color: var(--text-muted); }
:where(.sx-content, .sx-prose) li { margin: .2em 0; }
:where(.sx-content, .sx-prose) li > :is(ul, ol) { margin: .2em 0; }
:where(.sx-content, .sx-prose) ul.sx-checklist { list-style: none; padding-inline-start: .2em; }
:where(.sx-content, .sx-prose) ul.sx-checklist > li { position: relative; padding-inline-start: 30px; }
:where(.sx-content, .sx-prose) ul.sx-checklist > li::before { content: ''; position: absolute; inset-inline-start: 2px; top: .42em; width: 18px; height: 18px; border: 2px solid var(--border-3); border-radius: 5px; background: var(--card); }
:where(.sx-content, .sx-prose) ul.sx-checklist > li[data-checked="true"]::before { background: var(--primary); border-color: var(--primary); }
:where(.sx-content, .sx-prose) ul.sx-checklist > li[data-checked="true"]::after { content: ''; position: absolute; inset-inline-start: 8px; top: calc(.42em + 3px); width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
:where(.sx-content, .sx-prose) ul.sx-checklist > li[data-checked="true"] { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--text-dim); }
:where(.sx-content, .sx-prose) blockquote { margin: 1em 0; padding: .6em 1.1em; border-inline-start: 4px solid var(--primary); border-start-end-radius: 10px; border-end-end-radius: 10px; background: var(--surface-tint); color: var(--text-2); }
:where(.sx-content, .sx-prose) blockquote > :last-child { margin-bottom: 0; }
:where(.sx-content, .sx-prose) pre { position: relative; margin: 1em 0; padding: 14px 16px; overflow-x: auto; border: 1px solid var(--border-1); border-radius: 12px; background: var(--surface-deep, #0a0a16); color: var(--text-1); font: 13.5px/1.7 var(--font-mono, monospace); direction: ltr; text-align: left; white-space: pre; tab-size: 2; }
:where(.sx-content, .sx-prose) pre code { display: block; font: inherit; background: none; border: 0; padding: 0; white-space: pre; }
:where(.sx-content, .sx-prose) pre code[class*="lang-"]:not(.lang-plain)::before { position: absolute; top: 6px; right: 10px; font: 600 10px var(--font-mono, monospace); letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); pointer-events: none; }
:where(.sx-content, .sx-prose) .lang-js::before { content: 'js'; } :where(.sx-content, .sx-prose) .lang-ts::before { content: 'ts'; } :where(.sx-content, .sx-prose) .lang-python::before { content: 'python'; }
:where(.sx-content, .sx-prose) .lang-bash::before { content: 'bash'; } :where(.sx-content, .sx-prose) .lang-json::before { content: 'json'; } :where(.sx-content, .sx-prose) .lang-html::before { content: 'html'; }
:where(.sx-content, .sx-prose) .lang-css::before { content: 'css'; } :where(.sx-content, .sx-prose) .lang-sql::before { content: 'sql'; } :where(.sx-content, .sx-prose) .lang-php::before { content: 'php'; }
:where(.sx-content, .sx-prose) .lang-go::before { content: 'go'; } :where(.sx-content, .sx-prose) .lang-rust::before { content: 'rust'; }
:where(.sx-content, .sx-prose) :not(pre) > code, :where(.sx-content, .sx-prose) kbd { padding: .1em .38em; border: 1px solid var(--border-1); border-radius: 5px; background: var(--surface-tint-strong); font-family: var(--font-mono, monospace); font-size: .86em; direction: ltr; unicode-bidi: isolate; }
:where(.sx-content, .sx-prose) kbd { border-bottom-width: 2px; }
:where(.sx-content, .sx-prose) mark { padding: 0 .15em; border-radius: 3px; background: #fde68a; color: #1a1a2e; }
:where(.sx-content, .sx-prose) span[style^="background-color"] { padding: 0 .1em; border-radius: 3px; color: #14142b; }
:where(.sx-content, .sx-prose) hr { height: 1px; margin: 2em 0; border: 0; background: var(--border-2); }
:where(.sx-content, .sx-prose) :is(sub, sup) { font-size: .72em; line-height: 0; }
:where(.sx-content, .sx-prose) figure { margin: 1.3em auto; max-width: 100%; }
:where(.sx-content, .sx-prose) .sx-figure { text-align: center; }
:where(.sx-content, .sx-prose) .sx-figure img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 10px; }
:where(.sx-content, .sx-prose) .sx-figure a { display: block; }
:where(.sx-content, .sx-prose) figure.sx-w-25 { width: 25%; min-width: 120px; }
:where(.sx-content, .sx-prose) figure.sx-w-50 { width: 50%; min-width: 160px; }
:where(.sx-content, .sx-prose) figure.sx-w-75 { width: 75%; }
:where(.sx-content, .sx-prose) figure.align-right { margin-right: 0; margin-left: auto; }
:where(.sx-content, .sx-prose) figure.align-left { margin-left: 0; margin-right: auto; }
:where(.sx-content, .sx-prose) figure.align-full { width: 100%; }
:where(.sx-content, .sx-prose) figure.align-full img { width: 100%; border-radius: 0; }
:where(.sx-content, .sx-prose) figcaption { margin-top: .55em; font-size: .85em; line-height: 1.7; color: var(--text-muted); text-align: center; }
:where(.sx-content, .sx-prose) .sx-embed :is(iframe, video) { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: 12px; background: #000; }
:where(.sx-content, .sx-prose) .sx-callout { display: flex; align-items: flex-start; gap: 12px; margin: 1em 0; padding: 12px 16px; border: 1px solid var(--border-2); border-inline-start-width: 4px; border-radius: 12px; }
:where(.sx-content, .sx-prose) .sx-callout-icon { flex-shrink: 0; font-size: 1.1em; line-height: 1.85; user-select: none; }
:where(.sx-content, .sx-prose) .sx-callout-body { flex: 1; min-width: 0; }
:where(.sx-content, .sx-prose) .sx-callout-body > :last-child { margin-bottom: 0; }
:where(.sx-content, .sx-prose) .sx-callout-info { background: var(--cyan-tint); border-color: rgba(6, 182, 212, .32); border-inline-start-color: var(--cyan); }
:where(.sx-content, .sx-prose) .sx-callout-tip { background: var(--green-tint); border-color: var(--green-border-tint); border-inline-start-color: var(--green); }
:where(.sx-content, .sx-prose) .sx-callout-warning { background: var(--yellow-tint); border-color: var(--yellow-border-tint); border-inline-start-color: var(--yellow); }
:where(.sx-content, .sx-prose) .sx-callout-danger { background: var(--red-tint); border-color: var(--red-border-tint); border-inline-start-color: var(--red); }
:where(.sx-content, .sx-prose) .sx-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 1em 0; }
:where(.sx-content, .sx-prose) .sx-col > :last-child { margin-bottom: 0; }
:where(.sx-content, .sx-prose) details { margin: 1em 0; padding: 0 14px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface-tint); }
:where(.sx-content, .sx-prose) summary { padding: 10px 0; font-weight: 700; cursor: pointer; }
:where(.sx-content, .sx-prose) details[open] > summary { margin-bottom: .6em; border-bottom: 1px solid var(--border-1); }
:where(.sx-content, .sx-prose) .sx-table { display: block; width: max-content; min-width: 100%; max-width: 100%; overflow-x: auto; margin: 1em 0; border-collapse: separate; border-spacing: 0; font-size: .94em; }
:where(.sx-content, .sx-prose) .sx-table :is(th, td) { min-width: 70px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--border-2); border-inline-start: 1px solid var(--border-2); text-align: start; vertical-align: top; white-space: normal; color: var(--text-1); font-size: inherit; }
:where(.sx-content, .sx-prose) .sx-table tr > :last-child { border-inline-end: 1px solid var(--border-2); }
:where(.sx-content, .sx-prose) .sx-table :is(thead, tbody:first-child) > tr:first-child > * { border-top: 1px solid var(--border-2); }
/* کلاس .sx-table در components.css برای جدول‌های داده‌ای سایت هم هست؛ داخل محتوا آن قواعد خنثی می‌شوند */
.sx-content .sx-table tbody tr:last-child td, .sx-prose .sx-table tbody tr:last-child td { border-bottom: 1px solid var(--border-2); }
.sx-content .sx-table tbody tr:hover td, .sx-prose .sx-table tbody tr:hover td { background: transparent; }
.sx-content .sx-table th, .sx-prose .sx-table th { text-transform: none; letter-spacing: normal; }
:where(.sx-content, .sx-prose) .sx-table thead th { background: var(--surface-tint-strong); font-weight: 700; }
:where(.sx-content, .sx-prose) .sx-toc { margin: 1em 0; padding: 12px 16px; border: 1.5px dashed var(--primary-border-tint); border-radius: 12px; background: var(--primary-tint); color: var(--primary-light); font-size: .9em; }
.sx-prose .sx-toc:empty { display: none; }
:where(.sx-content, .sx-prose) .sx-cta { margin: 1.3em 0; }
:where(.sx-content, .sx-prose) a.sx-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .5em 1.4em; border-radius: 10px; font-weight: 700; text-decoration: none; }
:where(.sx-content, .sx-prose) a.sx-btn-primary { background: var(--grad-brand, var(--primary)); color: #fff; box-shadow: var(--glow-primary-sm); }
:where(.sx-content, .sx-prose) a.sx-btn-ghost { border: 1.5px solid var(--primary); color: var(--primary-light); }
@media (max-width: 640px) { :where(.sx-content, .sx-prose) .sx-columns { grid-template-columns: 1fr; } :where(.sx-content, .sx-prose) figure.sx-w-25 { width: 50%; } }

/* ---------- ۱۱. موبایل: برگه‌های پایین، اهداف لمسی ۴۴px ---------- */
@media (max-width: 600px) {
  .sx-dlg-bd { align-items: flex-end; padding: 0; }
  .sx-dlg { width: 100%; max-width: 100%; max-height: 88vh; border-radius: 18px 18px 0 0; margin-bottom: var(--sx-kb, 0px); padding-bottom: env(safe-area-inset-bottom); animation-name: sx-sheet-in; }
  .sx-pop.sx-sheet { position: fixed; top: auto !important; left: 0 !important; right: 0; bottom: var(--sx-kb, 0px); width: auto; min-width: 0; max-width: none; max-height: 72vh; overflow: auto; border-radius: 18px 18px 0 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); animation: sx-sheet-in .2s var(--ease-out, ease-out); }
  .sx-sheet-bd { position: fixed; inset: 0; background: var(--overlay, rgba(0, 0, 0, .5)); }
  .sx-content { padding: 14px 14px 22px; font-size: 15px; }
  .sx-ed-isempty .sx-content::before { top: 14px; inset-inline: 14px; }
  .sx-mi { min-height: 44px; }
  .sx-ub, .sx-seg span { min-height: 44px; }
  .sx-ed input[type="text"], .sx-ed input[type="search"], .sx-ed select { height: 44px; font-size: 16px; }
  .sx-find-row { flex-basis: 100%; }
  .sx-ib { width: 44px; height: 44px; }
  .sx-sw { min-width: 32px; }
  .sx-tc { min-height: 26px; }
  .sx-ch { height: 46px; }
}
@media (max-width: 600px), (pointer: coarse) {
  .sx-tbtn { min-width: 44px; height: 44px; }
  .sx-cbtn { min-width: 40px; height: 40px; }
}
@keyframes sx-sheet-in { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sx-dlg, .sx-pop.sx-sheet, .sx-ed-spin, .sx-ed-bar i { animation: none; } }
