/* ویرایشگر متن غنی */
.rte { border: 1.5px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; position: relative; }
.rte:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(247, 147, 30, .12); }
.rte.is-over { border-color: var(--red); }
.rte-tb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 8px; background: var(--gray-50); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.rte-b { min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; display: inline-grid; place-items: center; font: 700 14px/1 inherit; font-family: inherit; }
.rte-b:hover { background: #fff; box-shadow: var(--shadow-xs); }
.rte-b.hl { color: var(--brand-700); }
.rte-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.rte-sp { flex: 1; }
.rte-fmt { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: 600 13px/1 inherit; font-family: inherit; padding: 0 8px; color: var(--ink-2); }
.rte-area { min-height: 240px; padding: 16px 18px; outline: none; max-height: 70vh; overflow-y: auto; }
.rte-area:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.rte-area img { cursor: default; }
.rte-src { width: 100%; min-height: 280px; border: 0; padding: 14px; font: 13px/1.7 ui-monospace, Consolas, monospace; direction: ltr; text-align: left; resize: vertical; outline: none; background: #0f1524; color: #d7e0f5; }
.rte-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line-2); background: var(--gray-50); font-size: 12px; color: var(--muted); }
.rte-chip { border: 0; background: #fff; border-radius: 999px; padding: 3px 10px; font: 600 12px/1.4 inherit; font-family: inherit; cursor: pointer; color: var(--ink-2); box-shadow: var(--shadow-xs); }
.rte-chip.ok { color: var(--blue); } .rte-chip.bad { color: #fff; background: var(--red); }
.rte-stats.shake { animation: rte-shake .5s; }
@keyframes rte-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.rte-links { border-top: 1px solid var(--line-2); padding: 8px 12px; max-height: 220px; overflow: auto; }
.rte-li { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12.5px; border-bottom: 1px dashed var(--line-2); flex-wrap: wrap; }
.rte-li b { color: var(--muted); } .rte-li .t { font-weight: 600; } .rte-li .u { color: var(--muted); flex: 1; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rte-li em { font-style: normal; background: var(--violet-50); color: var(--violet); border-radius: 6px; padding: 1px 7px; font-size: 11px; }
.rte-li button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 3px 10px; cursor: pointer; font: 600 12px/1.4 inherit; font-family: inherit; }
.rte-li button.bad { color: var(--red); }
.rte-empty { margin: 4px 0; color: var(--muted); font-size: 12.5px; }
.rte-tips { padding: 0 12px 8px; font-size: 12px; color: #9a5b00; }
.rte-tips:empty { display: none; }
.rte-restore { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--brand-50); font-size: 12.5px; border-bottom: 1px solid var(--brand-100); }
.rte-ov { position: fixed; inset: 0; background: rgba(15, 20, 35, .5); display: grid; place-items: center; z-index: 2000; }
.rte-dlg { background: #fff; border-radius: 16px; padding: 18px; width: min(440px, 92vw); display: flex; flex-direction: column; gap: 12px; }
.rte-f { display: flex; flex-direction: column; gap: 5px; } .rte-f label { font-size: 12.5px; font-weight: 600; }
.rte-chk { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.rte-err { color: var(--red); font-size: 12.5px; min-height: 0; } .rte-act { display: flex; gap: 8px; margin-top: 4px; }
.rte.is-full { position: fixed; inset: 0; z-index: 1500; border-radius: 0; display: flex; flex-direction: column; }
.rte.is-full .rte-area, .rte.is-full .rte-src { flex: 1; max-height: none; }
.rte.is-full .rte-area { overflow: auto; }
html.rte-lock { overflow: hidden; }

.rte-txt { font: 700 12.5px/1 inherit; font-family: inherit; color: var(--brand-700); background: #fff; box-shadow: var(--shadow-xs); padding: 0 12px; }
.rte-busy { color: var(--brand-700); font-weight: 700; }
.rte-tpl { width: min(560px, 94vw); max-height: 84vh; }
.rte-tpl-head { display: flex; align-items: center; justify-content: space-between; }
.rte-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.rte-tpl-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; max-height: 52vh; padding: 2px; }
.rte-tpl-item { text-align: right; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 11px 14px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-family: inherit; }
.rte-tpl-item:hover { border-color: var(--brand); background: var(--brand-50); }
.rte-tpl-item small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.rte-tag { background: var(--blue-50); color: var(--blue); border-radius: 6px; padding: 1px 8px; font-size: 11px; align-self: start; }
