/* ===== realsize.css: ظاهر ابزار چیدمان طرح‌ها روی A4 ===== */
.rs-grid { display: grid; gap: 16px; }
@media (min-width: 900px) {
  .rs-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); align-items: start; gap: 24px; }
  .rs-preview { position: sticky; top: calc(var(--h-head) + env(safe-area-inset-top, 0px) + 20px); }
}

/* ---- بوم A4 ---- */
.rs-stage {
  padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--card);
  display: grid; place-items: center; overflow: hidden; min-height: 160px;
}
.rs-page { position: relative; background: #ffffff; box-shadow: 0 1px 8px rgba(0, 0, 0, .25); flex: none; touch-action: pan-y; }
.rs-margin { position: absolute; border: 1px dashed #c0c7cc; pointer-events: none; }
.rs-item { position: absolute; cursor: grab; touch-action: none; outline: 1px solid rgba(80, 120, 200, .35); background: transparent; user-select: none; -webkit-user-select: none; }
.rs-item.sel { outline: 2px solid #3b82f6; z-index: 5; }
.rs-item.bad { outline-color: #e5484d; }
.rs-item:focus-visible { outline: 3px solid #3b82f6; }
.rs-item, .rs-item * { -webkit-touch-callout: none; }
.rs-item img { position: absolute; left: 50%; top: 50%; pointer-events: none; -webkit-user-drag: none; max-width: none; }
.rs-handle {
  position: absolute; right: -11px; bottom: -11px; width: 22px; height: 22px; border-radius: 50%;
  background: #3b82f6; border: 2px solid #fff; cursor: nwse-resize; touch-action: none; display: none;
}
.rs-item.sel .rs-handle { display: block; }
.rs-empty { margin: 0; padding: 12px; text-align: center; font-size: 14px; color: var(--fg2); }
.rs-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 4px 0; font-size: 13px; color: var(--fg2); min-height: 20px; }
.rs-meta p { margin: 0; }
.rs-warns { margin: 6px 4px 0; padding: 0; list-style: none; font-size: 13px; color: #d9822b; }
.rs-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.rs-chips button {
  min-height: 36px; min-width: 36px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 9999px;
  background: transparent; color: var(--fg2); font: inherit; font-size: 13px; cursor: pointer;
}
.rs-chips button.on { background: var(--badge-bg); color: var(--accent); border-color: var(--accent); }
.rs-result { margin-top: 12px; text-align: center; }
.rs-result p { margin: 8px 0 0; font-size: 13px; color: var(--fg2); }

/* ---- کنترل‌ها ---- */
.rs-controls .field:last-child { margin-bottom: 0; }
.rs-controls .lbl { font-size: 14px; font-weight: 500; color: var(--fg2); }
.rs-controls select, .rs-controls input[type="number"] {
  width: 100%; min-height: 44px; background: var(--card); color: var(--fg);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font: inherit; font-size: 16px;
}
.rs-controls input[type="number"] { text-align: center; }
.rs-controls fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 0; margin: 0 0 16px; min-width: 0; }
.rs-controls legend { padding: 0 8px; font-size: 14px; font-weight: 600; color: var(--accent); }
.rs-row { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
.rs-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.rs-tools .btn { flex: 1 1 90px; min-height: 40px; padding: 6px 10px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.check small { display: block; font-size: 12px; color: var(--fg3); }

.rs-drop {
  display: grid; place-items: center; gap: 4px; text-align: center; cursor: pointer;
  min-height: 96px; padding: 16px; border: 2px dashed var(--line); border-radius: 14px; color: var(--fg2); font-size: 14px;
}
.rs-drop strong { color: var(--fg); font-size: 15px; }
.rs-drop small { color: var(--fg3); font-size: 12px; }
.rs-drop.over, .rs-drop:focus-visible { border-color: var(--accent); outline: none; background: var(--badge-bg); }
.rs-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.rs-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.rs-actions .btn { flex: 1 1 140px; }
.rs-actions .btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.rs-page.gray .rs-item img { filter: grayscale(1); }
.rs-page > .rs-empty { position: absolute; left: 0; right: 0; top: 45%; }
.rs-page { direction: ltr; }
