/* Report Studio — free-form page canvas + export UI.
   Reuses the Studio design tokens (--st-*) defined in studio.css, and the
   generic drag/resize/rotate visuals shared with PowerPoint Studio (see
   ppt-studio.css's .ps-* rules, mirrored here under .rs-* since the shared
   canvas engine (platform/canvas-editor.js) is parameterized by classPrefix). */

.rs-office-root .studio { background: #eef1f6; }
.rs-office-root .st-toolbar { display: none; }
.rs-office-root .st-body { position: relative; }
.rs-office-root .st-sidebar { display: none; }
.rs-office-root .st-center { position: relative; min-width: 0; }
.rs-office-root .st-workspace {
  padding: 0;
  overflow: hidden;
  background: #eef1f6;
}
.rs-office-root .st-inspector {
  flex: 0 0 248px;
  width: 248px;
  padding: 10px;
  background: #f9fafc;
}
.rs-office-root .st-card {
  border-radius: 7px;
  padding: 10px;
  margin-bottom: 10px;
}
.rs-office-root .st-ai {
  position: absolute;
  right: 22px;
  bottom: 92px;
  z-index: 40;
  flex: none;
  width: 0;
  height: 0;
  min-width: 0;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(18, 28, 45, .24);
  transition: opacity .16s ease, transform .16s ease;
  opacity: 0;
  transform: translateY(8px) scale(.98);
  pointer-events: none;
}
.rs-office-root .studio.ai-open .st-ai {
  width: 360px;
  height: min(500px, calc(100% - 112px));
  flex-basis: auto;
  border: 1px solid var(--st-line);
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.rs-office-root .st-ai-head {
  padding: 8px 10px;
  color: #fff;
  background: linear-gradient(135deg, #3aa6a0, #2f6bff);
}
.rs-office-root .st-ai-body { padding: 10px; }
.rs-office-root .rs-ai-chat {
  margin: 8px 0;
  gap: 6px;
}
.rs-office-root .rs-ai-msg {
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 12px;
}
.rs-office-root .rs-ai-controls { gap: 6px; margin-top: 8px; }
.rs-office-root .rs-ai-suggestions {
  gap: 5px;
  margin-top: 7px;
}
.rs-ai-quick {
  display: flex;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--st-line);
}

.rs-report-shell { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.rs-report-tabs {
  flex: 0 0 auto;
  display: flex; align-items: stretch; gap: 0;
  min-height: 34px; padding: 6px 8px 0;
  background: #eef1f6;
  border-bottom: 1px solid rgba(20, 30, 50, 0.1);
  overflow: hidden;
}
.rs-report-tabs-scroll {
  display: flex; align-items: stretch; gap: 4px; flex: 1; min-width: 0; overflow-x: auto;
}
.rs-report-tab {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
  padding: 6px 10px; border: 1px solid rgba(20, 30, 50, 0.1); border-bottom: none;
  border-radius: 8px 8px 0 0; background: #f9fafc; color: #5d6675;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.rs-report-tab:hover { background: #fff; color: #1b2230; }
.rs-report-tab.is-active {
  background: #ffffff; color: #1b2230; border-color: rgba(20, 30, 50, 0.12);
  box-shadow: 0 -1px 0 #fff inset;
}
.rs-report-tab-label { overflow: hidden; text-overflow: ellipsis; }
.rs-report-tab-close {
  flex-shrink: 0; width: 16px; height: 16px; line-height: 14px; text-align: center;
  border-radius: 4px; font-size: 13px; color: #9aa3b2;
}
.rs-report-tab-close:hover { background: rgba(20, 30, 50, 0.08); color: #df3b3b; }
.rs-report-tab-new {
  flex-shrink: 0; width: 28px; height: 28px; margin-left: 4px; align-self: center;
  border: 1px dashed rgba(20, 30, 50, 0.18); border-radius: 6px; background: #fff;
  color: #5d6675; font-size: 16px; font-weight: 700; cursor: pointer; line-height: 1;
}
.rs-report-tab-new:hover { border-color: var(--st-accent, #2f6bff); color: var(--st-accent, #2f6bff); }
.rs-report-shell > .rs-composer,
.rs-report-shell > .rs-compose,
.rs-report-shell > .rs-tool-page,
.rs-report-shell > div:not(.rs-report-tabs) {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
}

.rs-composer { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.rs-preview-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rs-preview-titlebar { display: flex; flex-direction: column; gap: 4px; }
.rs-title-input { font-size: 13px; font-weight: 700; border: 1px solid var(--st-line); border-radius: 6px; background: var(--st-bg); color: var(--st-ink); padding: 5px 8px; width: 100%; }
.rs-title-input:focus { outline: none; border-bottom: 2px solid var(--st-accent); }
.rs-page-meta { font-size: 12px; color: var(--st-ink-soft); }

.rs-ribbon {
  flex: 0 0 auto;
  background: #fff;
  border-bottom: 1px solid var(--st-line);
}
.rs-ribbon-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 28px;
  padding: 0 10px;
}
.rs-ribbon-tab {
  padding: 6px 12px 5px;
  border-radius: 6px 6px 0 0;
  color: var(--st-ink-soft);
  font-size: 12px;
  font-weight: 700;
}
.rs-ribbon-tab:hover { background: var(--st-line-soft); color: var(--st-ink); }
.rs-ribbon-tab.active {
  color: var(--st-accent);
  background: #eef1f6;
}
.rs-ribbon-body {
  display: flex;
  align-items: stretch;
  min-height: 45px;
  padding: 4px 10px 5px;
  overflow-x: auto;
}
.rs-ribbon-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3px;
  min-width: 92px;
  padding: 0 10px;
  border-right: 1px solid var(--st-line);
}
.rs-ribbon-group:first-child { padding-left: 0; }
.rs-ribbon-items {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: 25px;
  grid-auto-columns: max-content;
  gap: 3px 4px;
}
.rs-ribbon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 25px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--st-ink);
  background: transparent;
  font-size: 11.5px;
}
.rs-ribbon-btn:hover { background: #edf2fa; border-color: var(--st-line); }
.rs-ribbon-btn.primary { background: var(--st-accent); color: #fff; }
.rs-ribbon-btn.ai { color: #0d6f68; background: rgba(40, 156, 148, .09); }
.rs-ribbon-btn.danger { color: var(--st-bad); }
.rs-ribbon-btn.disabled { opacity: .42; cursor: default; }
.rs-ribbon-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  min-width: 16px;
  height: 16px;
  font-weight: 800;
  line-height: 1;
}
.rs-ribbon-text {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-ribbon-label {
  color: var(--st-ink-soft);
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
}
.rs-ribbon-name {
  display: grid;
  grid-template-columns: minmax(180px, 260px) max-content;
  align-items: center;
  gap: 8px;
  min-height: 25px;
}
.rs-readiness-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--st-ok) 14%, transparent);
  color: var(--st-ok);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.rs-readiness-pill.warn { background: color-mix(in srgb, var(--st-warn) 18%, transparent); color: var(--st-warn); }
.rs-readiness-pill.bad { background: color-mix(in srgb, var(--st-bad) 16%, transparent); color: var(--st-bad); }

.rs-int-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 18, 32, .48);
}
.rs-int-modal {
  display: flex;
  flex-direction: column;
  width: min(1120px, 96vw);
  max-height: min(860px, 94vh);
  min-height: 640px;
  overflow: hidden;
  border: 1px solid rgba(20, 30, 50, .16);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(10, 18, 35, .34);
}
.rs-int-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--st-line);
  background: #f8fafc;
}
.rs-int-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}
.rs-int-head p {
  margin: 3px 0 0;
  color: var(--st-ink-soft);
  font-size: 12px;
}
.rs-int-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .8fr);
  gap: 0;
  flex: 1;
  min-height: 0;
}
.rs-int-carousel {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  min-height: 0;
  padding: 18px 10px;
  background: #eef1f6;
  border-right: 1px solid var(--st-line);
}
.rs-int-nav {
  width: 34px;
  height: 52px;
  border: 1px solid rgba(20, 30, 50, .12);
  border-radius: 7px;
  background: rgba(255,255,255,.82);
  color: #334155;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}
.rs-int-nav:hover { border-color: var(--st-accent); color: var(--st-accent); }
.rs-int-stage {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.rs-int-card {
  position: absolute;
  inset: 0 8%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(20, 30, 50, .12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(20, 30, 50, .14);
  transition: transform .22s ease, opacity .22s ease, filter .22s ease;
  cursor: pointer;
}
.rs-int-card.is-active {
  z-index: 3;
  opacity: 1;
  filter: none;
}
.rs-int-card.is-near {
  z-index: 2;
  opacity: .52;
  filter: blur(1.4px) saturate(.82);
}
.rs-int-card.is-far {
  z-index: 1;
  opacity: .16;
  filter: blur(2.4px) saturate(.7);
  pointer-events: none;
}
.rs-int-card-preview {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(20, 30, 50, .08);
  border-radius: 6px;
  background: #fff;
}
.rs-int-card-title {
  flex: 0 0 auto;
  overflow: hidden;
  color: #1f2937;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-int-figure {
  width: 100%;
  max-height: 100%;
  overflow: auto;
}
.rs-int-figure svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
}
.rs-int-table-wrap {
  width: 100%;
  max-height: 100%;
  overflow: auto;
  padding: 8px;
}
.rs-int-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.rs-int-table th,
.rs-int-table td {
  border: 1px solid #d8dee8;
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}
.rs-int-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  font-weight: 700;
}
.rs-int-empty,
.rs-int-more {
  margin: 8px;
  color: var(--st-ink-soft);
  font-size: 12px;
}
.rs-int-text-preview {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: auto;
  padding: 10px;
  font-size: 11px;
  white-space: pre-wrap;
}
.rs-int-questions {
  min-height: 0;
  overflow: auto;
  padding: 16px;
  background: #fff;
}
.rs-int-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.rs-int-meta {
  margin-top: 3px;
  color: var(--st-ink-soft);
  font-size: 12px;
}
.rs-int-skip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  color: var(--st-ink-soft);
  font-size: 12px;
  font-weight: 700;
}
.rs-int-item-toggles {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}
.rs-int-q-actions .st-btn[disabled] { opacity: .5; cursor: not-allowed; }
.rs-int-q {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.rs-int-q > span {
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}
.rs-int-q textarea {
  resize: vertical;
  min-height: 74px;
  font-size: 12px;
  line-height: 1.4;
}
.rs-int-q textarea:disabled {
  background: #f3f4f6;
  color: #94a3b8;
}
.rs-int-q-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.rs-int-saved {
  color: var(--st-ink-soft);
  font-size: 12px;
}
.rs-int-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--st-line);
  background: #f8fafc;
}
.rs-int-status {
  min-width: 0;
  font-size: 12px;
}
.rs-int-foot-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.rs-int-ai-options {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--st-line);
  border-radius: 7px;
  background: #fff;
}
.rs-int-ai-option-head {
  color: var(--st-ink-soft);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}
.rs-int-toggle-row,
.rs-int-ai-send-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.rs-int-toggle {
  height: 26px;
  padding: 3px 8px;
  border: 1px solid var(--st-line);
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.rs-int-toggle.is-active {
  border-color: color-mix(in srgb, var(--st-accent) 52%, transparent);
  background: color-mix(in srgb, var(--st-accent) 10%, #fff);
  color: var(--st-accent);
}
.rs-int-toggle:disabled {
  opacity: .55;
  cursor: default;
}
@media (max-width: 900px) {
  .rs-int-modal { min-height: 0; }
  .rs-int-body { grid-template-columns: 1fr; grid-template-rows: minmax(320px, 48vh) minmax(0, 1fr); }
  .rs-int-carousel { border-right: 0; border-bottom: 1px solid var(--st-line); }
  .rs-int-ai-options { flex-wrap: wrap; }
}

.rs-editor-main {
  display: grid;
  grid-template-columns: var(--rs-rail-w, 152px) 6px minmax(0, 1fr) calc(var(--rs-rail-w, 152px) + 6px);
  gap: 0;
  flex: 1;
  min-height: 0;
}
.rs-editor-main::after { content: ""; min-width: 0; background: #dfe4ed; }
.rs-rail-resizer {
  width: 6px; cursor: col-resize; background: transparent; z-index: 2;
}
.rs-rail-resizer:hover,
.rs-rail-resizer.is-dragging {
  background: color-mix(in srgb, var(--st-accent, #2f6bff) 35%, transparent);
}
.rs-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  min-height: 0;
  padding: 14px 12px;
  background: #f7f8fb;
  border-right: 1px solid var(--st-line);
}
.rs-thumb { position: relative; border: 2px solid var(--st-line); border-radius: 5px; overflow: hidden; cursor: pointer; background: #fff; aspect-ratio: 8.5/11; flex: 0 0 auto; }
.rs-thumb.active { border-color: var(--st-accent); }
.rs-thumb-n { position: absolute; top: 3px; left: 4px; z-index: 2; font-size: 10px; font-weight: 700; color: var(--st-ink-soft); background: rgba(255,255,255,.7); border-radius: 3px; padding: 0 3px; }
.rs-thumb-canvas { position: absolute; inset: 0; pointer-events: none; overflow: hidden; background: #fff; }
.rs-thumb-canvas .rs-canvas-wrap { position: absolute; top: 0; left: 0; }
.rs-canvas.rs-thumb { box-shadow: none; border: none; border-radius: 0; }
.rs-canvas.rs-thumb .rs-block { pointer-events: none; cursor: default; }
.rs-page-thumb-map {
  position: absolute; inset: 4px; border-radius: 2px; overflow: hidden;
}
.rs-page-thumb-block {
  position: absolute; border-radius: 1px; opacity: 0.88;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.rs-page-thumb-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: #9aa3b2;
}
.rs-thumb-del { position: absolute; top: 2px; right: 2px; z-index: 3; width: 16px; height: 16px; line-height: 14px; border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 12px; }
.rs-add-page { border: 1px dashed var(--st-line); border-radius: 7px; background: transparent; color: var(--st-ink-soft); padding: 10px 6px; cursor: pointer; font-size: 12px; }
.rs-add-page:hover { border-color: var(--st-accent); color: var(--st-accent); }

.rs-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  container-type: size;
  min-width: 0;
  min-height: 0;
  flex: 1;
  padding: clamp(14px, 2.5cqw, 34px);
  background: #dfe4ed;
}
.rs-stage-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex: 1;
}
.rs-text-edit-bar {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(860px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--st-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 28px rgba(18, 28, 45, 0.16);
  backdrop-filter: blur(8px);
}
.rs-text-edit-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.rs-text-tool {
  min-width: 26px;
  height: 26px;
  border: 1px solid var(--st-line);
  border-radius: 5px;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  padding: 0 6px;
}
.rs-text-tool:hover { border-color: var(--st-accent); color: var(--st-accent); }
.rs-text-tool-select {
  height: 26px;
  border: 1px solid var(--st-line);
  border-radius: 5px;
  background: #fff;
  font-size: 11px;
  padding: 0 4px;
  max-width: 72px;
}
.rs-text-color {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}
.rs-text-color:hover { transform: scale(1.12); box-shadow: 0 0 0 2px var(--st-accent); }
.rs-text-bar-sep {
  width: 1px;
  height: 18px;
  background: var(--st-line);
  margin: 0 4px;
}
.rs-text-bar-quote {
  font-size: 11px;
  color: var(--st-ink-soft);
  font-style: italic;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-text-edit-ai {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rs-text-bar-input {
  flex: 1;
  min-width: 140px;
  height: 28px;
  border: 1px solid var(--st-line);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}
.rs-text-ai-dock {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 39;
  width: min(720px, calc(100% - 24px));
  padding: 10px 12px;
  border: 1px solid var(--st-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 6px 20px rgba(18, 28, 45, 0.12);
}
.rs-auto-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 14px;
  margin: 0;
  background: linear-gradient(90deg, #eef4ff, #eefaf4);
  border-bottom: 1px solid var(--st-line);
  font-size: 12px;
  color: var(--st-ink);
}
.rs-canvas-wrap {
  width: min(1040px, calc(100cqw - clamp(28px, 5cqw, 68px)), calc((100cqh - clamp(28px, 5cqh, 68px)) * var(--rs-page-ratio, 0.772727)));
  min-width: min(360px, calc(100cqw - 28px));
  max-height: 100%;
  flex: 0 0 auto;
}
.rs-canvas { position: relative; width: 100%; aspect-ratio: 8.5/11; container-type: size; border: 1px solid rgba(20,30,50,.18); border-radius: 4px; overflow: hidden; box-shadow: 0 10px 30px rgba(18, 28, 45, .18); outline: none; }
.rs-canvas.rs-grid {
  background-image:
    linear-gradient(rgba(47, 107, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 107, 255, .08) 1px, transparent 1px);
  background-size: 10px 10px;
}
.rs-block { position: absolute; padding: 6px; overflow: visible; box-sizing: border-box; cursor: move; border: 1px solid transparent; touch-action: none; user-select: none; -webkit-user-select: none; will-change: transform; transform-origin: center center; backface-visibility: hidden; }
.rs-block [data-ce-selectable-text] { cursor: text; user-select: text; -webkit-user-select: text; touch-action: auto; }
.rs-block [data-ce-block-edit] { cursor: default; user-select: auto; -webkit-user-select: auto; touch-action: auto; }
.rs-block [data-ce-source-edit] { cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.rs-block .rs-tbl-cell,
.rs-block .rs-tbl-head-input { cursor: text; user-select: text; -webkit-user-select: text; }
.rs-block:hover { border-color: color-mix(in srgb, var(--st-accent) 40%, transparent); }
.rs-block.sel { border-color: var(--st-accent); box-shadow: 0 0 0 1px var(--st-accent); }
.rs-block.locked { cursor: default; }
.rs-block.locked::after { content: "🔒"; position: absolute; top: 2px; left: 2px; font-size: 10px; opacity: .65; }
.rs-canvas.rs-dragging { cursor: grabbing; user-select: none; }
.rs-canvas.rs-dragging .rs-block { transition: none; }
.rs-block.rs-moving { z-index: 20; }

.rs-handle { position: absolute; width: 11px; height: 11px; background: #fff; border: 1.5px solid var(--st-accent); border-radius: 2px; z-index: 5; box-shadow: 0 1px 3px rgba(0,0,0,.2); touch-action: none; }
.rs-h-nw { left: -6px; top: -6px; cursor: nwse-resize; }
.rs-h-ne { right: -6px; top: -6px; cursor: nesw-resize; }
.rs-h-sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.rs-h-se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.rs-rotate { left: 50%; top: -22px; transform: translateX(-50%); border-radius: 50%; background: var(--st-accent); cursor: grab; }
.rs-rotate::before { content: ""; position: absolute; left: 50%; top: 10px; width: 1px; height: 12px; background: var(--st-accent); }
.rs-link-badge { position: absolute; top: 2px; right: 2px; font-size: 10px; background: rgba(255,255,255,.8); border-radius: 3px; padding: 0 2px; }
.rs-block.has-live-source .rs-link-badge { right: 28px; }
.rs-source-edit-btn {
  position: absolute; top: 4px; right: 4px; z-index: 6;
  width: 22px; height: 22px; border-radius: 6px; line-height: 1;
  border: 1px solid var(--st-line); background: rgba(255,255,255,.94);
  color: var(--st-accent); font-weight: 800; font-size: 11px;
  opacity: 0.92; pointer-events: auto; cursor: pointer; padding: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.rs-block.has-live-source:hover .rs-source-edit-btn,
.rs-block.has-live-source.sel .rs-source-edit-btn { opacity: 1; }
.rs-source-edit-btn:hover { border-color: var(--st-accent); background: #eef4ff; }
.rs-toggle-row {
  display: flex;
  gap: 10px;
  margin: 4px 0 8px;
  font-size: 12px;
  color: var(--st-ink-soft);
}
.rs-toggle-row label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rs-ai-fab {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  z-index: 45;
  cursor: pointer;
  background: linear-gradient(135deg, #3aa6a0, #2f6bff);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(18, 28, 45, .24);
  transition: transform .12s ease, box-shadow .12s ease;
}
.rs-ai-fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 30px rgba(18, 28, 45, .28);
}
.rs-office-root .studio.ai-open .rs-ai-fab {
  background: linear-gradient(135deg, #2f6bff, #20345f);
}

.rs-selection-popover {
  position: fixed;
  z-index: 70;
  width: 340px;
  padding: 10px;
  border: 1px solid rgba(30, 42, 70, .16);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(18, 28, 45, .24);
}
.rs-selection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 800;
  color: var(--st-ink);
}
.rs-selection-privacy {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0d6f68;
  font-size: 10px;
  font-weight: 800;
}
.rs-selection-quote {
  max-height: 88px;
  overflow: auto;
  margin-bottom: 8px;
  padding: 7px 8px;
  border-left: 3px solid var(--st-accent);
  background: #f5f8fc;
  color: var(--st-ink);
  font-size: 12px;
  line-height: 1.35;
}
.rs-selection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 6px;
}
.rs-selection-input {
  min-width: 0;
  height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--st-line);
  border-radius: 6px;
  font-size: 12px;
}
.rs-selection-input:focus { outline: none; border-color: var(--st-accent); }
.rs-selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.rs-change-preview {
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.35;
}
.rs-change-old,
.rs-change-new {
  padding: 7px 8px;
  border-radius: 6px;
}
.rs-change-old {
  color: #8d2833;
  background: #fff1f2;
  text-decoration: line-through;
}
.rs-change-new {
  color: #0b6848;
  background: #eefaf4;
  text-decoration: underline;
}
.rs-selection-note {
  margin-top: 6px;
  color: var(--st-ink-soft);
  font-size: 11px;
  line-height: 1.35;
}
.rs-mask-details-toggle {
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border: 1px solid var(--st-line);
  border-radius: 6px;
  background: #f5f8fc;
  color: #0d6f68;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
}
.rs-mask-details-toggle:hover { border-color: var(--st-accent); background: #eef6f6; }
.rs-mask-details {
  margin-top: 6px;
  padding: 7px;
  border: 1px solid var(--st-line);
  border-radius: 6px;
  background: #fbfcfe;
}
.rs-mask-meta {
  margin-bottom: 6px;
  color: var(--st-ink-soft);
  font-size: 10.5px;
}
.rs-mask-table {
  display: grid;
  max-height: 150px;
  overflow: auto;
  border: 1px solid #e4e8f0;
  border-radius: 5px;
}
.rs-mask-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(82px, .75fr);
  gap: 6px;
  padding: 4px 6px;
  border-top: 1px solid #edf0f5;
  font-size: 10.5px;
}
.rs-mask-row:first-child { border-top: 0; }
.rs-mask-row-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f8;
  color: var(--st-ink-soft);
  font-weight: 800;
}
.rs-mask-row span,
.rs-mask-row code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-mask-row code {
  color: #20345f;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.rs-tool-page {
  height: 100%;
  overflow: auto;
  padding: 16px;
  background: #eef1f6;
}
.rs-tool-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -16px -16px 14px;
  padding: 10px 16px;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--st-line);
  backdrop-filter: blur(8px);
  font-weight: 700;
}

/* --- Block content types --- */
.rs-blk-heading { font-size: 22px; font-weight: 700; line-height: 1.2; }
.rs-blk-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.rs-blk-text { font-size: 13px; line-height: 1.5; overflow: hidden; height: 100%; }
.rs-blk-text p { margin: 0 0 6px; }
.rs-blk-prose { font-size: 13px; line-height: 1.55; overflow: hidden; height: 100%; }
.rs-blk-prose.rs-blk-ai { background: color-mix(in srgb, var(--st-accent) 6%, transparent); border-left: 3px solid; padding: 6px 10px; border-radius: 4px; }
.rs-blk-qc { background: color-mix(in srgb, var(--st-accent) 5%, transparent); border-left: 3px solid; padding: 6px 10px; border-radius: 4px; font-size: 13px; height: 100%; overflow: hidden; box-sizing: border-box; }
.rs-blk-figwrap { margin: 0; width: 100%; height: 100%; display: flex; flex-direction: column; }
.rs-blk-fig { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.rs-blk-fig svg { max-width: 100%; max-height: 100%; }
.rs-blk-img { flex: 1; width: 100%; object-fit: contain; min-height: 0; }
.rs-blk-legend { font-size: 11px; color: var(--st-ink-soft); font-style: italic; margin-top: 2px; }
.rs-blk-user-interpretation {
  flex: 0 0 auto;
  max-height: 96px;
  overflow: hidden;
  margin-top: 5px;
  padding: 6px 8px;
  border-left: 3px solid var(--st-accent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--st-accent) 6%, transparent);
  color: var(--st-ink);
  font-size: 11.5px;
  font-style: normal;
  line-height: 1.42;
}
.rs-blk-user-interpretation .rs-blk-text {
  height: auto;
  overflow: visible;
  font-size: inherit;
  line-height: inherit;
}
.rs-blk-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #9aa3b2; font-size: 11px; border: 1px dashed #cdd4e2; text-align: center; }
.rs-blk-table-wrap {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}
.rs-blk-table-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; flex: 0 0 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-blk-table-toolbar {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  padding: 0 0 3px;
}
.rs-tbl-tool {
  border: 1px solid var(--st-line);
  border-radius: 4px;
  background: #fff;
  color: var(--st-ink);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  cursor: pointer;
  line-height: 1.4;
}
.rs-tbl-tool:hover { border-color: var(--st-accent); color: var(--st-accent); }
.rs-blk-table-body { flex: 1; min-height: 0; overflow: hidden; }
.rs-blk-table-wrap .rs-blk-user-interpretation { max-height: 86px; }
.rs-blk-table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
.rs-blk-table th, .rs-blk-table td {
  border: 1px solid #e2e6ee;
  padding: 1px 3px;
  text-align: left;
  overflow: hidden;
  vertical-align: top;
  position: relative;
}
.rs-blk-table th { color: #fff; }
.rs-tbl-gutter { width: 20px; padding: 0; text-align: center; background: #f5f7fb; }
.rs-tbl-head-cell { display: flex; align-items: center; gap: 2px; min-width: 0; }
.rs-tbl-head-input,
.rs-tbl-cell {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  box-sizing: border-box;
  outline: none;
}
.rs-tbl-head-input { color: #fff; font-weight: 700; }
.rs-tbl-head-input::placeholder { color: rgba(255,255,255,.65); }
.rs-tbl-mini-del,
.rs-tbl-row-del {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 3px;
  background: rgba(0,0,0,.12);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.rs-tbl-row-del { background: #eef1f6; color: #8d2833; }
.rs-tbl-mini-del:hover,
.rs-tbl-row-del:hover { background: #ffd8dc; color: #8d2833; }
.rs-tbl-col-resize {
  position: absolute; top: 0; right: -4px; bottom: 0; width: 8px;
  z-index: 4; cursor: col-resize; touch-action: none;
}
.rs-tbl-col-resize:hover { background: rgba(255,255,255,.5); }
.rs-tbl-row-resize {
  position: absolute; left: 0; right: 0; bottom: -4px; height: 8px;
  z-index: 4; cursor: row-resize; touch-action: none;
}
.rs-tbl-row-resize:hover { background: color-mix(in srgb, var(--st-accent) 35%, transparent); }
.rs-sensitive-mark {
  padding: 0 2px;
  border-radius: 3px;
  background: #fff1a8;
  color: inherit;
  box-shadow: inset 0 -1px 0 #d8a600;
}
.rs-sensitive-check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
}
.rs-sensitive-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 6px;
  margin: 8px 0;
}
.rs-sensitive-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 132px;
  overflow: auto;
}
.rs-sensitive-term {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--st-line);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
}
.rs-sensitive-term span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-sensitive-term button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--st-bad);
  cursor: pointer;
  font-weight: 800;
}
.rs-sensitive-term button:hover { background: #ffecef; }
.rs-sensitive-suggest {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--st-line);
}
.rs-sensitive-suggest-title {
  margin-bottom: 5px;
  color: var(--st-ink-soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.rs-sensitive-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}
.rs-sensitive-chips button {
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid var(--st-line);
  border-radius: 999px;
  background: #f5f8fc;
  color: var(--st-ink);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
}
.rs-sensitive-chips button:hover {
  border-color: var(--st-accent);
  color: var(--st-accent);
}

/* --- Generate (simple mode) --- */
.rs-gen-lead { color: var(--st-ink-soft); font-size: 13px; margin: 0 0 14px; max-width: 680px; line-height: 1.5; }
.rs-gen-actions { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.rs-gen-status { display: flex; gap: 6px; }
.rs-gen-progress-wrap { margin: 8px 0 12px; }
.rs-gen-progress {
  padding: 12px 14px;
  border: 1px solid var(--st-line);
  border-radius: 10px;
  background: #f7f9fc;
}
.rs-gen-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(47, 107, 255, 0.12);
  overflow: hidden;
  margin-bottom: 10px;
}
.rs-gen-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6bff, #3aa6a0);
  transition: width 0.35s ease;
}
.rs-gen-progress-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.rs-gen-progress-step {
  font-size: 11px;
  font-weight: 600;
  color: var(--st-ink-soft);
}
.rs-gen-progress-step.active { color: var(--st-accent); }
.rs-gen-progress-step.done { color: #0b6848; }
.rs-gen-progress-msg {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--st-ink-soft);
}
.rs-gen-result { margin-top: 4px; }

/* Smart report/HTML builder */
.rs-smart-intro { margin: 0 0 12px; color: var(--st-ink-soft); font-size: 12.5px; line-height: 1.5; }
.rs-smart-output-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.rs-smart-output {
  display: flex; align-items: center; gap: 11px; min-width: 0; padding: 12px 14px;
  border: 1px solid var(--st-line); border-radius: 10px; background: #fff; color: var(--st-ink);
  text-align: left; cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.rs-smart-output:hover { border-color: var(--st-accent); transform: translateY(-1px); }
.rs-smart-output.active { border-color: var(--st-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--st-accent) 24%, transparent); }
.rs-smart-output-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 8px; background: #edf3ff; color: var(--st-accent); font-size: 16px; font-weight: 800; }
.rs-smart-output span:last-child { display: flex; flex-direction: column; min-width: 0; }
.rs-smart-output strong { font-size: 13px; }
.rs-smart-output small { margin-top: 2px; color: var(--st-ink-soft); font-size: 11px; line-height: 1.35; }
.rs-smart-subhead { display: flex; align-items: center; gap: 8px; margin: 12px 0 7px; font-size: 12px; }
.rs-smart-subhead > span { color: var(--st-ink-soft); }
.rs-smart-bulk { display: inline-flex; gap: 4px; margin-left: auto; }
.rs-smart-bulk button { border: 0; background: transparent; color: var(--st-accent); font: inherit; font-weight: 700; cursor: pointer; }
.rs-smart-check-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-smart-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid var(--st-line); border-radius: 999px; background: #f8fafc; font-size: 11.5px; cursor: pointer; }
.rs-smart-check:has(input:checked) { border-color: color-mix(in srgb, var(--st-accent) 55%, var(--st-line)); background: color-mix(in srgb, var(--st-accent) 7%, #fff); color: var(--st-accent); }
.rs-smart-source-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 6px; max-height: 190px; overflow: auto; padding: 2px; }
.rs-smart-source { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--st-line); border-radius: 8px; background: #fff; cursor: pointer; }
.rs-smart-source:hover { border-color: color-mix(in srgb, var(--st-accent) 55%, var(--st-line)); }
.rs-smart-kind { padding: 2px 4px; border-radius: 4px; background: #eaf1ff; color: #2158c7; font-size: 9px; font-weight: 800; }
.rs-smart-kind.table { background: #e8f8f4; color: #08735c; }
.rs-smart-source-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 600; }
.rs-smart-source small { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--st-ink-soft); font-size: 10px; }
.rs-smart-layout-note { display: flex; gap: 8px; margin-top: 12px; padding: 9px 10px; border-left: 3px solid var(--st-accent); background: #f4f7fc; color: var(--st-ink-soft); font-size: 11.5px; line-height: 1.45; }

@media (max-width: 980px) {
  .rs-editor-main { grid-template-columns: 112px 5px minmax(0, 1fr); }
  .rs-editor-main::after { display: none; }
  .rs-smart-source-list { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .rs-editor-main { grid-template-columns: minmax(0, 1fr); }
  .rs-editor-main > .rs-rail, .rs-editor-main > .rs-rail-resizer { display: none; }
  .rs-smart-output-grid { grid-template-columns: 1fr; }
}

/* --- Auto-pilot (one-click, recommended path) --- */
.rs-gen-autopilot {
  border: 1px solid var(--st-line);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 0 0 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--st-accent) 6%, #fff), #fff);
}
.rs-gen-autopilot-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.rs-gen-autopilot-icon { font-size: 26px; line-height: 1; flex: none; }
.rs-gen-autopilot-title { font-size: 15px; font-weight: 700; color: var(--st-ink); }
.rs-gen-autopilot-reason { font-size: 12.5px; color: var(--st-ink-soft); line-height: 1.45; margin-top: 2px; max-width: 620px; }
.rs-gen-auto-btn { font-size: 14px; padding: 9px 18px; }
.rs-gen-customize-toggle {
  display: inline-block; margin-top: 10px;
  background: transparent; border: none; padding: 2px 0;
  color: var(--st-accent); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.rs-gen-customize-toggle:hover { text-decoration: underline; }

/* --- Format library picker --- */
.rs-gen-customizer { display: block; }
.rs-gen-simple { max-width: 520px; }
.rs-gen-simple .st-card { margin-bottom: 12px; }
.rs-theme-grid-compact .rs-theme-swatch { width: 56px; min-height: 44px; }
.rs-theme-grid-compact .rs-theme-name { font-size: 9px; }
.rs-format-groups { display: flex; flex-direction: column; gap: 12px; }
.rs-format-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--st-ink-soft); }
.rs-format-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 4px; }
.rs-format-card {
  border: 1.5px solid var(--st-line); border-radius: 10px; padding: 10px 12px;
  cursor: pointer; background: #fff; transition: border-color .12s, box-shadow .12s;
}
.rs-format-card:hover { border-color: color-mix(in srgb, var(--st-accent) 55%, var(--st-line)); }
.rs-format-card.active { border-color: var(--st-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--st-accent) 30%, transparent); }
.rs-format-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rs-format-card-icon { font-size: 17px; line-height: 1; }
.rs-format-card-title { font-size: 13px; font-weight: 600; color: var(--st-ink); }
.rs-format-card-desc { font-size: 11.5px; color: var(--st-ink-soft); line-height: 1.4; }
.rs-format-blueprint { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 12px; }

/* --- Theme picker --- */
.rs-theme-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.rs-theme-swatch { width: 96px; border: 2px solid var(--st-line); border-radius: 8px; overflow: hidden; cursor: pointer; background: #fff; }
.rs-theme-swatch.active { box-shadow: 0 0 0 2px var(--st-accent); }
.rs-theme-band { height: 18px; }
.rs-theme-name { font-size: 11px; font-weight: 600; padding: 6px 8px; }

/* --- Readiness/issues (shared with the old list layout) --- */
.rs-issues { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.rs-issue { text-align: left; background: transparent; border: 1px solid var(--st-line); border-radius: 6px; padding: 4px 8px; font-size: 11px; cursor: pointer; color: var(--st-ink); }
.rs-issue:hover { border-color: var(--st-accent); }
.rs-issue-static { font-size: 12px; padding: 3px 0; color: var(--st-ink-soft); }

/* ========================================================================
   Project materials — scope bar + completed-materials picker
   ======================================================================== */
.rs-scope-bar {
  display: flex; align-items: flex-end; gap: 14px;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--st-bg); border: 1px solid var(--st-line); border-radius: 10px;
}
.rs-scope-field { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.rs-scope-field label { font-size: 11px; font-weight: 700; color: var(--st-ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.rs-scope-select {
  border: 1px solid var(--st-line); border-radius: 6px; background: var(--st-bg);
  color: var(--st-ink); padding: 6px 8px; font-size: 13px; min-width: 200px;
}
.rs-scope-select:focus { outline: none; border-color: var(--st-accent); }
.rs-scope-select:disabled { opacity: .55; }
.rs-scope-spacer { flex: 1; }
.rs-scope-refresh {
  border: 1px solid var(--st-line); border-radius: 6px; background: transparent;
  color: var(--st-ink); padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.rs-scope-refresh:hover { border-color: var(--st-accent); }

.rs-materials-err { color: var(--st-bad); font-size: 12px; padding: 8px 4px; }
.rs-materials-loading { color: var(--st-ink-soft); font-size: 13px; padding: 20px 4px; }
.rs-materials-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.rs-materials-count { font-size: 12px; color: var(--st-ink-soft); font-weight: 600; }

.rs-materials-list { display: flex; flex-direction: column; gap: 4px; }
.rs-materials-group-h {
  display: flex; align-items: center; gap: 8px; margin: 12px 0 4px;
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--st-ink-soft);
}
.rs-materials-group-n {
  background: var(--st-line-soft); border-radius: 10px; padding: 1px 7px; font-size: 11px; color: var(--st-ink);
}
.rs-materials-hint { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--st-ink-soft); margin-left: 4px; }

.rs-material-app {
  border: 1px solid var(--st-line); border-radius: 10px; margin-bottom: 8px; overflow: hidden;
  background: var(--st-bg);
}
.rs-material-app-header {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: none; background: var(--st-line-soft); cursor: pointer; text-align: left;
  font: inherit; color: var(--st-ink);
}
.rs-material-app-header:hover { background: #e8eef8; }
.rs-material-app-header.is-open { border-bottom: 1px solid var(--st-line); }
.rs-material-app-chevron { font-size: 10px; color: var(--st-ink-soft); width: 14px; flex-shrink: 0; }
.rs-material-app-name { font-size: 14px; font-weight: 700; flex: 1; min-width: 0; }
.rs-material-app-status { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--st-ink-soft); white-space: nowrap; }
.rs-material-app-owner { font-size: 11px; color: var(--st-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.rs-material-app-count { font-size: 11px; font-weight: 600; color: var(--st-accent); white-space: nowrap; }
.rs-material-app-body {
  display: flex; flex-direction: column; gap: 4px; padding: 8px;
  background: var(--st-bg);
}
.rs-material-app-body .rs-material-row { margin-left: 8px; }
.rs-material-app-empty {
  font-size: 12px; color: var(--st-ink-soft); line-height: 1.5; margin: 8px 12px 4px 20px;
}
.rs-materials-orphans { margin-top: 12px; }

.rs-material-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--st-line); border-radius: 8px; cursor: pointer; background: var(--st-bg);
}
.rs-material-row:hover { border-color: var(--st-accent); }
.rs-material-row.is-selected { border-color: var(--st-accent); background: #eef4ff; }
.rs-material-main { flex: 1; min-width: 0; }
.rs-material-title { font-size: 13px; font-weight: 600; color: var(--st-ink); display: flex; align-items: center; gap: 6px; }
.rs-material-kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: .03em; font-weight: 800;
  color: var(--st-accent); background: rgba(47,107,255,.1); border-radius: 4px; padding: 1px 5px;
}
.rs-material-meta { font-size: 11px; color: var(--st-ink-soft); margin-top: 2px; display: flex; gap: 4px; flex-wrap: wrap; }
.rs-material-owner { font-weight: 600; }
.rs-material-status { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--st-ink-soft); white-space: nowrap; }
.rs-material-row.is-status-only { opacity: .72; cursor: default; }
.rs-material-preview-btn {
  flex-shrink: 0; font-size: 11px; font-weight: 600; padding: 4px 8px;
  border: 1px solid var(--st-line); border-radius: 6px; background: #fff; color: var(--st-ink-soft); cursor: pointer;
}
.rs-material-preview-btn:hover { border-color: var(--st-accent); color: var(--st-accent); }

/* Material thumbnails + preview modal */
.rs-mat-thumb {
  flex-shrink: 0; width: 52px; height: 40px; border: 1px solid var(--st-line); border-radius: 6px;
  overflow: hidden; display: flex; align-items: center; justify-content: center; background: #f4f6fa;
  font-size: 10px; color: var(--st-ink-soft);
}
.rs-mat-thumb-figure svg { max-width: 100%; max-height: 100%; display: block; }
.rs-mat-thumb-table { flex-direction: column; gap: 2px; }
.rs-mat-thumb-stat { font-weight: 800; color: var(--st-accent); font-size: 11px; }
.rs-mat-preview-backdrop {
  position: fixed; inset: 0; z-index: 13000;
  background: rgba(15, 22, 35, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.rs-mat-preview-modal {
  width: min(920px, 96vw); max-height: 90vh; display: flex; flex-direction: column;
  background: #ffffff;
  color: #1b2230;
  border: 1px solid rgba(20, 30, 50, 0.12);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  overflow: hidden;
  isolation: isolate;
}
.rs-mat-preview-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid rgba(20, 30, 50, 0.1);
  background: #ffffff;
}
.rs-mat-preview-meta { font-size: 12px; color: #5d6675; margin-top: 2px; }
.rs-mat-preview-close {
  border: none; background: transparent; font-size: 16px; cursor: pointer; color: #5d6675; padding: 4px;
}
.rs-mat-preview-close:hover { color: #1b2230; }
.rs-mat-preview-body {
  padding: 16px; overflow: auto; flex: 1; min-height: 0;
  background: #ffffff;
}
.rs-mat-preview-fig {
  background: #ffffff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 8px;
  padding: 16px;
}
.rs-mat-preview-fig svg { max-width: 100%; height: auto; display: block; margin: 0 auto; background: #fff; }
.rs-mat-preview-table-wrap {
  overflow: auto;
  background: #ffffff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 8px;
}
.rs-mat-preview-table { width: 100%; border-collapse: collapse; font-size: 12px; background: #ffffff; }
.rs-mat-preview-table th, .rs-mat-preview-table td { border: 1px solid rgba(20, 30, 50, 0.1); padding: 4px 8px; text-align: left; }
.rs-mat-preview-table th { background: #f0f2f7; font-weight: 700; color: #1b2230; }
.rs-mat-preview-table td { background: #ffffff; color: #1b2230; }
.rs-mat-preview-more, .rs-mat-preview-empty { font-size: 12px; color: #5d6675; margin-top: 8px; }
.rs-mat-preview-text {
  font-size: 11px; white-space: pre-wrap; max-height: 60vh; overflow: auto;
  background: #f6f7fb; color: #1b2230; border-radius: 8px; padding: 12px;
  border: 1px solid rgba(20, 30, 50, 0.08);
}
.rs-mat-preview-foot {
  padding: 10px 16px; border-top: 1px solid rgba(20, 30, 50, 0.1);
  display: flex; justify-content: flex-end; background: #ffffff;
}
.dark .rs-mat-preview-modal,
.dark .rs-mat-preview-head,
.dark .rs-mat-preview-body,
.dark .rs-mat-preview-foot {
  background: #1b1f27; color: #eef1f6;
}
.dark .rs-mat-preview-meta,
.dark .rs-mat-preview-close { color: #9aa3b2; }
.dark .rs-mat-preview-fig,
.dark .rs-mat-preview-table-wrap,
.dark .rs-mat-preview-table,
.dark .rs-mat-preview-table td { background: #1b1f27; color: #eef1f6; }
.dark .rs-mat-preview-fig svg { background: #1b1f27; }
.dark .rs-mat-preview-table th { background: #252a34; color: #eef1f6; }

/* Manual compose — materials palette + canvas */
.rs-compose { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.rs-compose-main { display: grid; grid-template-columns: 240px minmax(0, 1fr); flex: 1; min-height: 0; }
.rs-compose-editor { flex: 1; min-height: 0; min-width: 0; }
.rs-compose-palette {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; border-right: 1px solid var(--st-line);
  background: #f9fafc; overflow: hidden; min-height: 0;
}
.rs-compose-palette-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.rs-compose-palette-n { font-size: 11px; font-weight: 700; color: var(--st-accent); background: rgba(47,107,255,.1); border-radius: 999px; padding: 2px 8px; }
.rs-compose-palette-hint { font-size: 11px; color: var(--st-ink-soft); margin: 0; line-height: 1.4; }
.rs-compose-palette-list { display: flex; flex-direction: column; gap: 6px; overflow: hidden; flex: 1; min-height: 0; }
.rs-compose-palette-item {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center;
  padding: 8px; border: 1px solid var(--st-line); border-radius: 8px; background: #fff; cursor: grab;
}
.rs-compose-palette-item:hover { border-color: var(--st-accent); }
.rs-compose-palette-item.is-dragging { opacity: .55; }
.rs-compose-palette-meta { min-width: 0; }
.rs-compose-palette-kind { display: block; font-size: 10px; text-transform: uppercase; font-weight: 800; color: var(--st-accent); }
.rs-compose-palette-title { display: block; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-compose-palette-actions { display: flex; flex-direction: column; gap: 4px; }
.rs-compose-icon-btn {
  width: 26px; height: 26px; border: 1px solid var(--st-line); border-radius: 6px; background: #fff;
  cursor: pointer; font-size: 12px; line-height: 1; padding: 0;
}
.rs-compose-icon-btn:hover { border-color: var(--st-accent); }
.rs-compose-stage { flex: 1; min-height: 0; min-width: 0; }
.rs-compose-stage.is-drop-target .rs-canvas { outline: 2px dashed var(--st-accent); outline-offset: 2px; }
.rs-compose-foot {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--st-line); background: #fff;
}
.rs-compose-palette-empty { font-size: 12px; color: var(--st-ink-soft); }

/* ========================================================================
   Confirm-before-send review modal
   ======================================================================== */
.rs-sr-backdrop {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(15, 22, 35, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.rs-sr-modal {
  width: min(920px, 96vw); max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
  background: #ffffff;
  color: #1b2230;
  border: 1px solid rgba(20, 30, 50, 0.12);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  isolation: isolate;
}
.rs-sr-head { padding: 18px 20px 12px; border-bottom: 1px solid rgba(20, 30, 50, 0.1); background: #ffffff; }
.rs-sr-head h3 { margin: 0 0 4px; font-size: 16px; color: #1b2230; }
.rs-sr-sub { margin: 0 0 12px; font-size: 12px; color: #5d6675; }
.rs-sr-modes { display: flex; gap: 10px; }
.rs-sr-mode {
  flex: 1; text-align: left; cursor: pointer; padding: 10px 12px;
  border: 1.5px solid rgba(20, 30, 50, 0.12); border-radius: 10px; background: #ffffff;
  display: flex; flex-direction: column; gap: 2px;
}
.rs-sr-mode:hover { border-color: #2f6bff; }
.rs-sr-mode.is-active { border-color: #2f6bff; background: #eef4ff; }
.rs-sr-mode-l { font-size: 13px; font-weight: 700; color: #1b2230; }
.rs-sr-mode-s { font-size: 11px; color: #5d6675; }

.rs-sr-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; overflow: hidden; flex: 1; min-height: 0; background: #ffffff; }
.rs-sr-col { padding: 14px 16px; overflow-y: auto; border-right: 1px solid rgba(20, 30, 50, 0.1); background: #ffffff; }
.rs-sr-col:last-child { border-right: none; }
.rs-sr-col-h { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: #5d6675; margin-bottom: 10px; }
.rs-sr-empty, .rs-sr-note, .rs-sr-hint { font-size: 12px; color: #5d6675; }
.rs-sr-note { margin-top: 10px; }
.rs-sr-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; color: #1b2230; border-bottom: 1px dashed rgba(20, 30, 50, 0.1); }
.rs-sr-kind { font-size: 10px; text-transform: uppercase; font-weight: 800; color: #2f6bff; background: rgba(47,107,255,.1); border-radius: 4px; padding: 1px 5px; }

.rs-sr-art { border: 1px solid rgba(20, 30, 50, 0.1); border-radius: 8px; padding: 8px; margin-bottom: 10px; background: #ffffff; }
.rs-sr-art-h { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #1b2230; margin-bottom: 6px; }
.rs-sr-thumb { max-width: 100%; overflow: hidden; background: #ffffff; }
.rs-sr-thumb svg { max-width: 100%; height: auto; }
.rs-sr-withheld { font-size: 11px; color: #8d2833; background: rgba(214,69,69,.08); border-radius: 6px; padding: 6px 8px; }
.rs-sr-textprev { font-size: 11px; color: #5d6675; white-space: pre-wrap; }
.rs-sr-tbl { width: 100%; border-collapse: collapse; font-size: 11px; background: #ffffff; }
.rs-sr-tbl th, .rs-sr-tbl td { border: 1px solid rgba(20, 30, 50, 0.1); padding: 3px 6px; text-align: left; color: #1b2230; }
.rs-sr-tbl th { background: #f0f2f7; font-weight: 700; }

.rs-sr-map { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.rs-sr-maprow { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; cursor: default; }
label.rs-sr-maprow { cursor: pointer; }
.rs-sr-real { color: #1b2230; font-weight: 600; }
.rs-sr-arrow { color: #5d6675; }
.rs-sr-alias { color: #2f6bff; font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.rs-sr-addrow { display: flex; gap: 6px; margin-top: 10px; }
.rs-sr-add { flex: 1; border: 1px solid rgba(20, 30, 50, 0.12); border-radius: 6px; padding: 5px 8px; font-size: 12px; background: #ffffff; color: #1b2230; }
.rs-sr-addbtn { border: 1px solid rgba(20, 30, 50, 0.12); border-radius: 6px; background: #ffffff; padding: 5px 10px; font-size: 12px; cursor: pointer; color: #1b2230; }
.rs-sr-addbtn:hover { border-color: #2f6bff; }

.rs-sr-foot { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid rgba(20, 30, 50, 0.1); background: #ffffff; }
.rs-sr-count { font-size: 12px; color: #5d6675; }
.rs-sr-actions { margin-left: auto; display: flex; gap: 8px; }
.rs-sr-cancel { border: 1px solid rgba(20, 30, 50, 0.12); border-radius: 8px; background: #ffffff; padding: 8px 14px; font-size: 13px; cursor: pointer; color: #1b2230; }
.rs-sr-confirm { border: none; border-radius: 8px; background: #2f6bff; color: #fff; padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer; }
.rs-sr-confirm:disabled { opacity: .6; cursor: default; }

@media (max-width: 720px) {
  .rs-sr-body { grid-template-columns: 1fr; }
  .rs-sr-col { border-right: none; border-bottom: 1px solid var(--st-line); }
}

/* Shared canvas engine: marquee select + multi-selection */
.rs-marquee {
  position: absolute; z-index: 40; pointer-events: none;
  border: 1px solid var(--st-accent);
  background: color-mix(in srgb, var(--st-accent) 10%, transparent);
  border-radius: 2px;
}
.rs-block.marquee-hit { border-color: color-mix(in srgb, var(--st-accent) 60%, transparent); }
.rs-block.multi-sel { border-color: var(--st-accent); box-shadow: 0 0 0 1px var(--st-accent); }
