/* 
   RESONANCE THREADS — rt-studio.css
   Consolidated design studio stylesheet v1.0
   Replaces: studio.css, studio-new.css, studio-fixes.css,
             studio-mobile.css, studio-tablet.css
   ═ */

/* 
   1. STUDIO VARIABLES
 */

/* Prevent pull-to-refresh and overscroll bounce on studio pages */
html.studio-page,
body.studio-page {
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: auto;
}

:root {
  /* Studio surface colors — using unified --rt-* variables */
  --studio-bg:      var(--rt-bg-solid);
  --studio-surface: var(--rt-surface-2);
  --studio-panel:   var(--rt-surface);
  --studio-border:  var(--rt-border);
  --studio-border2: var(--rt-border-2);
  --studio-hover:   rgba(255,255,255,0.06);
  --studio-pink:    var(--rt-pink);
  --studio-cyan:    var(--rt-cyan);
  --studio-grad:    var(--rt-grad);
  --studio-text:    var(--rt-text);
  --studio-muted:   var(--rt-muted);
  --studio-radius:  7px;
  --studio-trans:   var(--rt-trans);

  /* Studio layout dimensions */
  --studio-topbar-h:    48px;
  --studio-strip-w:     44px;
  --studio-panel-w:     240px;
  --studio-right-w:     220px;
  --studio-bottom-h:    90px;
  --studio-offset:      0px;
  --studio-transition:  width 0.2s ease;

  /* Typography */
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  /* RT theme aliases for studio */
  --rt-grad-subtle: rgba(255,78,205,0.12);
  --rt-purple:      #a78bfa;
}

/* 2. STUDIO LAYOUT */
body.studio-body-root { overflow: hidden; background: var(--studio-bg); font-family: 'Inter', sans-serif; color: var(--studio-text); }
/* 3. STUDIO PAGE LAYOUT */
.studio-page {
  display: block;
  overflow: hidden;
  background: var(--studio-bg);
  min-height: 100vh;
}

body.studio-body-root .chatbot-fab,
body.studio-body-root .chatbot-window,
body.studio-body-root .site-footer,
body.studio-body-root .scroll-top-btn { display: none !important; }

/* Brand nav bar */
.s-brand-nav {
  height: 40px;
  flex-shrink: 0;
  background: rgba(10,10,12,.98);
  border-bottom: 1px solid rgba(255,78,205,.15);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 200;
}

.s-brand-back {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #666;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.1);
  transition: var(--studio-trans);
  white-space: nowrap;
}

.s-brand-back:hover { color: var(--studio-pink); border-color: rgba(255,78,205,.4); }

.s-brand-logo-link { text-decoration: none; flex: 1; display: flex; justify-content: center; }

.s-brand-logo-text {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 3px;
  background: var(--studio-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.s-brand-nav-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.s-brand-nav-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.1);
  background: transparent;
  color: #888;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--studio-trans);
  white-space: nowrap;
  cursor: pointer;
}

.s-brand-nav-btn:hover { color: #fff; border-color: #444; }
.s-brand-nav-btn-primary { background: var(--studio-grad); color: #000 !important; border-color: transparent !important; }
.s-brand-nav-btn-primary:hover { opacity: .9; }

/* 4. STUDIO TOOLBAR */
.studio-toolbar {
  height: 48px;
  flex-shrink: 0;
  background: rgba(18,18,20,.98);
  border-bottom: 1px solid var(--studio-border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  z-index: 100;
}

.studio-toolbar::-webkit-scrollbar { display: none; }

.tb-btn {
  height: 28px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #888;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: var(--studio-trans);
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.tb-btn:hover { background: var(--studio-surface); color: #fff; border-color: var(--studio-border); }
.tb-btn.active { background: rgba(255,78,205,.12); color: var(--studio-pink); border-color: rgba(255,78,205,.3); }
.tb-btn.danger { color: #ef4444; }
.tb-btn.danger:hover { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); }

.tb-select, .tb-input {
  height: 28px;
  padding: 0 7px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 5px;
  color: var(--studio-text);
  font-size: 11px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}

.tb-input { width: 44px; text-align: center; }
.tb-select:focus, .tb-input:focus { border-color: var(--studio-pink); }

.tb-divider {
  width: 1px;
  height: 20px;
  background: var(--studio-border);
  margin: 0 2px;
  flex-shrink: 0;
}

.studio-autosave {
  font-size: 10px;
  color: var(--studio-muted);
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0 6px;
  transition: color .3s;
}

.studio-autosave.saved { color: #4ade80; }
.studio-autosave.offline { color: #f59e0b; }

/* 5. STUDIO BODY GRID */
.studio-canvas-area {
  display: grid;
  grid-template-columns: 44px 240px 1fr 220px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* 6. LEFT TOOL STRIP */
.studio-tool-strip {
  width: 44px;
  flex-shrink: 0;
  background: var(--studio-panel);
  border-right: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  z-index: 10;
  height: 100%;
}

.studio-tool-strip::-webkit-scrollbar { display: none; }

.sl-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #666;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--studio-trans);
  flex-shrink: 0;
  position: relative;
}

.sl-btn:hover { background: var(--studio-surface); color: #fff; border-color: var(--studio-border); }
.sl-btn.active { background: rgba(255,78,205,.12); color: var(--studio-pink); border-color: rgba(255,78,205,.3); }

.sl-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 38px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 10px;
  color: #ddd;
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
}

.sl-divider {
  width: 24px;
  height: 1px;
  background: var(--studio-border);
  margin: 2px 0;
  flex-shrink: 0;
}

/* 7. LEFT PANEL */
.studio-left-panel {
  width: 240px;
  flex-shrink: 0;
  background: var(--studio-panel);
  border-right: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  transition: width .2s ease;
}

.studio-left-panel.collapsed { width: 0; overflow: hidden; }

.sp-tabs {
  display: flex;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
}

.sp-tab {
  flex: 1;
  height: 34px;
  background: transparent;
  border: none;
  color: #555;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  font-family: inherit;
  transition: var(--studio-trans);
  border-bottom: 2px solid transparent;
}

.sp-tab:hover { color: #aaa; }
.sp-tab.active { color: var(--studio-pink); border-bottom-color: var(--studio-pink); }

.sp-scroll {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.sp-scroll::-webkit-scrollbar { width: 3px; }
.sp-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.sp-section { padding: 8px; display: none; }
.sp-section.active { display: block; }

.sp-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #555;
  text-transform: uppercase;
  margin: 8px 0 5px;
}

.sp-input {
  width: 100%;
  padding: 6px 8px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 6px;
  color: var(--studio-text);
  font-size: 11px;
  font-family: inherit;
  outline: none;
  margin-bottom: 4px;
}

.sp-input:focus { border-color: var(--studio-pink); }

.sp-btn {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--studio-border);
  background: var(--studio-surface);
  color: #ccc;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: var(--studio-trans);
  text-align: left;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sp-btn:hover { background: var(--studio-border2); color: #fff; }
.sp-btn.grad { background: var(--studio-grad); color: #000; border-color: transparent; }
.sp-btn.grad:hover { opacity: .9; }

/* 8. CANVAS AREA */
.studio-canvas-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--studio-bg);
  position: relative;
  height: 100%;
}

.studio-canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.studio-canvas {
  background: #ffffff;
  display: block;
  box-shadow: 0 0 0 1px var(--studio-border), 0 12px 48px rgba(0,0,0,.7);
}

.studio-canvas-overlay {
  position: absolute;
  pointer-events: none;
  border: 2px dashed rgba(255,78,205,.5);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255,78,205,.1);
  z-index: 5;
}

.studio-canvas-overlay.violation {
  border-color: #ef4444;
  box-shadow: inset 0 0 0 1px rgba(239,68,68,.2);
}

/* Zoom bar */
.studio-zoom-bar {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  flex-shrink: 0;
  background: rgba(14,14,16,.8);
  border-top: 1px solid var(--studio-border);
}

.zoom-btn {
  width: 24px;
  height: 24px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 4px;
  color: #888;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--studio-trans);
}

.zoom-btn:hover { background: var(--studio-border); color: #fff; }
.zoom-label { font-size: 11px; color: #555; min-width: 38px; text-align: center; }
.zoom-slider { width: 80px; accent-color: var(--studio-pink); cursor: pointer; }

/* 9. RIGHT PANEL */
.studio-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--studio-panel);
  border-left: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
  height: 100%;
}

.studio-sidebar::-webkit-scrollbar { width: 3px; }
.studio-sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
.studio-sidebar.collapsed { width: 0; overflow: hidden; }

.rp-section {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}

.rp-title {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #555;
  text-transform: uppercase;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rp-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.rp-label { font-size: 10px; color: #555; min-width: 14px; flex-shrink: 0; }

.rp-input {
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 0 6px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 5px;
  color: var(--studio-text);
  font-size: 11px;
  font-family: inherit;
  outline: none;
  text-align: center;
}

.rp-input:focus { border-color: var(--studio-pink); }

.rp-select {
  width: 100%;
  height: 28px;
  padding: 0 7px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 5px;
  color: var(--studio-text);
  font-size: 11px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  margin-bottom: 4px;
}

.rp-select:focus { border-color: var(--studio-pink); }
.rp-range { width: 100%; accent-color: var(--studio-pink); cursor: pointer; margin: 2px 0; }

.rp-btn {
  width: 100%;
  padding: 8px;
  border-radius: 7px;
  border: none;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: var(--studio-trans);
  text-align: center;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.rp-btn.primary { background: var(--studio-grad); color: #000; }
.rp-btn.primary:hover { opacity: .9; }
.rp-btn.secondary { background: var(--studio-surface); border: 1px solid var(--studio-border); color: #ccc; }
.rp-btn.secondary:hover { background: var(--studio-border); color: #fff; }
.rp-btn.danger { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #ef4444; }

/* 10. LAYER LIST */
.studio-layer-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  color: #888;
  transition: var(--studio-trans);
  border: 1px solid transparent;
}

.studio-layer-item:hover { background: var(--studio-surface); color: #ddd; }
.studio-layer-item.selected { background: var(--studio-surface); color: #fff; border-color: rgba(255,78,205,.25); }

.layer-icon { font-size: 11px; flex-shrink: 0; }
.layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.layer-vis { background: none; border: none; color: #555; cursor: pointer; font-size: 10px; padding: 0 2px; }
.layer-vis:hover { color: #fff; }

/* 11. COLOR PICKER */
.studio-color-swatch {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.cswatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--studio-trans);
  flex-shrink: 0;
}

.cswatch:hover { transform: scale(1.15); }
.cswatch.active { border-color: var(--studio-pink); box-shadow: 0 0 0 2px var(--studio-bg), 0 0 0 4px var(--studio-pink); }

/* 12. TEXT TOOLS */
.studio-text-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.font-family-select {
  width: 100%;
  height: 28px;
  padding: 0 7px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 5px;
  color: var(--studio-text);
  font-size: 11px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.font-family-select:focus { border-color: var(--studio-pink); }

.text-align-btns {
  display: flex;
  gap: 3px;
}

.text-align-btn {
  flex: 1;
  height: 26px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 4px;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--studio-trans);
}

.text-align-btn:hover { color: #fff; border-color: #555; }
.text-align-btn.active { background: rgba(255,78,205,.12); color: var(--studio-pink); border-color: rgba(255,78,205,.3); }

/* 13. STUDIO MODALS */
.studio-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
}

.studio-modal-overlay.open { display: flex; }

.studio-modal {
  background: #161618;
  border: 1px solid var(--studio-border);
  border-radius: 14px;
  padding: 24px;
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.studio-modal-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1.5px;
  background: var(--studio-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  margin-bottom: 16px;
}

.studio-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 50%;
  color: #888;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--studio-trans);
}

.studio-modal-close:hover { background: var(--studio-border); color: #fff; }

/* 14. VERSION HISTORY PANEL */
.studio-versions-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh;
  background: var(--studio-panel);
  border-left: 1px solid var(--studio-border);
  z-index: 8000;
  transition: right .25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.studio-versions-panel.open { right: 0; }

.svp-header {
  padding: 16px;
  border-bottom: 1px solid var(--studio-border);
  font-size: 13px;
  font-weight: 700;
  color: var(--studio-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.svp-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}

.svp-item {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--studio-border);
  margin-bottom: 6px;
  cursor: pointer;
  transition: var(--studio-trans);
}

.svp-item:hover { border-color: rgba(255,78,205,.4); background: rgba(255,78,205,.04); }
.svp-item.current { border-color: var(--studio-pink); }

.svp-item-time { font-size: 11px; color: #888; margin-bottom: 3px; }
.svp-item-label { font-size: 12px; font-weight: 600; color: var(--studio-text); }

/* 15. PUBLISH MODAL */
.studio-publish-modal .studio-modal { max-width: 480px; }

.publish-step {
  display: none;
}

.publish-step.active { display: block; }

.publish-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.publish-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: 8px;
  font-size: 12px;
  color: #888;
}

.publish-check-item.pass { border-color: rgba(74,222,128,.3); color: #4ade80; }
.publish-check-item.fail { border-color: rgba(239,68,68,.3); color: #ef4444; }

/* 16. TOAST */
#studioToast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
  white-space: nowrap;
}

#studioToast.show { opacity: 1; }
#studioToast.success { background: #0d0d0f; border: 1px solid rgba(74,222,128,.4); color: #4ade80; }
#studioToast.error   { background: #0d0d0f; border: 1px solid rgba(239,68,68,.4); color: #ef4444; }
#studioToast.info    { background: #0d0d0f; border: 1px solid rgba(255,78,205,.4); color: var(--studio-pink); }

/* 17. MOBILE STUDIO (max-width 767px) */
@media (max-width: 767px) {
  .studio-canvas-area {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    position: relative;
  }

  .studio-tool-strip {
    display: none;
  }

  .studio-left-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60vh;
    border-radius: 16px 16px 0 0;
    border-right: none;
    border-top: 1px solid var(--studio-border);
    z-index: 500;
    transform: translateY(100%);
    transition: transform .25s ease;
  }

  .studio-left-panel.open {
    transform: translateY(0);
  }

  .studio-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60vh;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-top: 1px solid var(--studio-border);
    z-index: 500;
    transform: translateY(100%);
    transition: transform .25s ease;
  }

  .studio-sidebar.open {
    transform: translateY(0);
  }

  .studio-toolbar {
    height: 52px;
    padding: 0 6px;
    gap: 2px;
  }

  .tb-btn {
    height: 40px;
    min-width: 40px;
    padding: 0 6px;
    font-size: 16px;
  }

  .sl-btn {
    width: 40px;
    height: 40px;
  }

  .studio-zoom-bar {
    height: 40px;
  }

  .zoom-btn {
    width: 36px;
    height: 36px;
  }
}

/* 18. TABLET STUDIO (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .studio-canvas-area {
    grid-template-columns: 44px 200px 1fr 180px;
  }

  .studio-left-panel {
    width: 200px;
  }

  .studio-sidebar {
    width: 180px;
  }

  .studio-toolbar {
    padding: 0 6px;
    gap: 2px;
  }

  .tb-btn {
    padding: 0 5px;
    font-size: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   19. RS-* COMPONENT SYSTEM
   Used by design-studio.php (RDS layout)
   ═══════════════════════════════════════════════════════════════ */

/* ── rs-btn ── */
.rs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--studio-border);
  background: var(--studio-surface);
  color: rgba(255,255,255,.65);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui, 'Inter', sans-serif);
  transition: all 150ms ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.rs-btn:hover {
  background: var(--sa-hover, rgba(255,255,255,.06));
  color: #fff;
  border-color: rgba(255,255,255,.2);
}

.rs-btn--icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  font-size: 14px;
  flex-shrink: 0;
}

.rs-btn--primary {
  background: var(--studio-surface);
  border-color: var(--studio-border);
  color: rgba(255,255,255,.65);
}

.rs-btn--primary:hover {
  background: rgba(255,78,205,.12);
  border-color: rgba(255,78,205,.3);
  color: #ff4ecd;
}

.rs-btn--gradient {
  background: linear-gradient(90deg, #ff4ecd, #4fdcff);
  border-color: transparent;
  color: #000;
  font-weight: 700;
}

.rs-btn--gradient:hover {
  opacity: 0.88;
  color: #000;
}

.rs-btn--danger {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.3);
  color: #ef4444;
}

.rs-btn--danger:hover {
  background: rgba(239,68,68,.2);
}

/* ── rs-label ── */
.rs-label {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  margin-bottom: 5px;
}

/* ── rs-input ── */
.rs-input {
  width: 100%;
  padding: 6px 8px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 5px;
  color: var(--studio-text);
  font-size: 12px;
  font-family: var(--font-ui, 'Inter', sans-serif);
  outline: none;
  transition: border-color 150ms ease;
}

.rs-input:focus { border-color: var(--studio-pink); }
.rs-input::placeholder { color: rgba(255,255,255,.25); }

/* ── rs-select ── */
.rs-select {
  width: 100%;
  padding: 6px 8px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 5px;
  color: var(--studio-text);
  font-size: 12px;
  font-family: var(--font-ui, 'Inter', sans-serif);
  outline: none;
  cursor: pointer;
  transition: border-color 150ms ease;
}

.rs-select:focus { border-color: var(--studio-pink); }

/* ── rs-textarea ── */
.rs-textarea {
  width: 100%;
  padding: 8px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 5px;
  color: var(--studio-text);
  font-size: 12px;
  font-family: var(--font-ui, 'Inter', sans-serif);
  outline: none;
  resize: vertical;
  min-height: 72px;
  transition: border-color 150ms ease;
}

.rs-textarea:focus { border-color: var(--studio-pink); }
.rs-textarea::placeholder { color: rgba(255,255,255,.25); }

/* ── rs-accordion-section ── */
.rs-accordion-section {
  border-bottom: 1px solid var(--studio-border);
}

.rs-accordion-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.55);
  cursor: pointer;
  user-select: none;
  transition: color 150ms ease;
  letter-spacing: 0.3px;
}

.rs-accordion-section__header:hover { color: #fff; }

.rs-accordion-section__chevron {
  font-size: 9px;
  color: rgba(255,255,255,.3);
  transition: transform 200ms ease;
}

.rs-accordion-section.is-open .rs-accordion-section__chevron {
  transform: rotate(180deg);
}

.rs-accordion-section__body {
  display: none;
  padding: 0 0 8px;
}

.rs-accordion-section.is-open .rs-accordion-section__body {
  display: block;
}

/* ── rs-save-status ── */
.rs-save-status {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.35);
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
  transition: color 300ms ease;
}

.rs-save-status--saved {
  color: #4ade80;
  background: rgba(74,222,128,.08);
  border-color: rgba(74,222,128,.2);
}

.rs-save-status--saving {
  color: #f59e0b;
  background: rgba(245,158,11,.08);
  border-color: rgba(245,158,11,.2);
}

.rs-save-status--error {
  color: #ef4444;
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.2);
}

.rs-save-status--offline {
  color: #f59e0b;
  background: rgba(245,158,11,.08);
  border-color: rgba(245,158,11,.2);
}

.rs-save-status--retrying {
  color: #4fdcff;
  background: rgba(79,220,255,.08);
  border-color: rgba(79,220,255,.2);
}

/* ── rs-status-badge ── */
.rs-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.rs-status-badge--pending  { background: rgba(245,158,11,.15); color: #f59e0b; }
.rs-status-badge--approved { background: rgba(74,222,128,.15); color: #4ade80; }
.rs-status-badge--rejected { background: rgba(239,68,68,.15);  color: #ef4444; }
.rs-status-badge--draft    { background: rgba(255,255,255,.08); color: rgba(255,255,255,.5); }

/* ── RDS App layout (design-studio.php) ── */
#rdsApp {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  height: calc(100dvh - 48px);
  overflow: hidden;
  background: var(--studio-bg);
  font-family: var(--font-ui);
  color: var(--studio-text);
  margin-top: 48px; /* offset for fixed site navbar */
}

.rds-topbar {
  height: var(--studio-topbar-h);
  background: rgba(8,8,14,.98);
  border-bottom: 1px solid var(--studio-border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 6px;
  flex-shrink: 0;
  z-index: 200;
  overflow: visible;
}

.rds-topbar__left,
.rds-topbar__right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* Back to store button in topbar */
.rds-tb-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--studio-border);
  color: rgba(255,255,255,.5);
  text-decoration: none;
  transition: all 150ms ease;
  flex-shrink: 0;
}
.rds-tb-back:hover { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }

.rds-topbar__center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.rds-logo {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 2px;
  background: var(--studio-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  white-space: nowrap;
}

.rds-search {
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 20px;
  padding: 5px 14px;
  color: var(--studio-text);
  font-size: 12px;
  width: 180px;
  outline: none;
  font-family: var(--font-ui);
}

.rds-search:focus { border-color: var(--rt-purple); }

.rds-divider {
  width: 1px;
  height: 20px;
  background: var(--studio-border);
  flex-shrink: 0;
}

/* RDS Dropdown */
.rds-dropdown { position: relative; }

.rds-dropdown__btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 6px;
  color: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 150ms ease;
  white-space: nowrap;
}

.rds-dropdown__btn:hover { color: #fff; border-color: rgba(255,255,255,.2); }

.rds-dropdown__menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 8px;
  min-width: 180px;
  z-index: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  overflow: hidden;
}

.rds-dropdown.is-open .rds-dropdown__menu { display: block; }

.rds-dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: rgba(255,255,255,.75);
  cursor: pointer;
  transition: background 100ms ease;
  white-space: nowrap;
}

.rds-dropdown__item:hover { background: var(--studio-hover); color: #fff; }

.rds-dropdown__sep {
  height: 1px;
  background: var(--studio-border);
  margin: 4px 0;
}

/* RDS Main area */
.rds-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* RDS Tool strip */
.rds-tool-strip {
  width: var(--studio-strip-w);
  background: var(--studio-panel);
  border-right: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  gap: 2px;
  overflow-y: auto;
  flex-shrink: 0;
}

.rds-tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.38);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 150ms ease;
  flex-shrink: 0;
  position: relative;
}

.rds-tool-btn:hover { background: var(--sa-hover); color: #fff; }
.rds-tool-btn.is-active { background: var(--rt-grad-subtle); color: var(--sa-pink); }

/* RDS Left panel */
.rds-left-panel {
  width: var(--studio-panel-w);
  background: var(--studio-panel);
  border-right: 1px solid var(--studio-border);
  overflow-y: auto;
  flex-shrink: 0;
  position: relative;
  transition: width var(--studio-transition);
}

.rds-left-panel.collapsed { width: 0; overflow: hidden; }

/* RDS Canvas area — fills all remaining space between tool strip and right panel */
.rds-canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--studio-bg);
  overflow: hidden;
  position: relative;
  min-width: 0; /* allow flex shrink */
}

.rds-zone-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  flex-shrink: 0;
}

.rds-zone-tab {
  padding: 5px 14px;
  border-radius: 20px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  color: rgba(255,255,255,.45);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: var(--font-ui);
}

.rds-zone-tab.is-active {
  background: var(--rt-grad-subtle);
  border-color: var(--rt-purple);
  color: #fff;
}

#rdsCanvasWrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
  position: relative;
}

.rds-canvas-size-badge {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.6);
  border: 1px solid var(--studio-border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 10px;
  color: rgba(255,255,255,.45);
  white-space: nowrap;
  pointer-events: none;
}

/* RDS Right panel */
.rds-right-panel {
  width: var(--studio-right-w);
  background: var(--studio-panel);
  border-left: 1px solid var(--studio-border);
  overflow-y: auto;
  flex-shrink: 0;
  position: relative;
  transition: width var(--studio-transition);
}

.rds-right-panel.collapsed { width: 0; overflow: hidden; }

/* RDS Bottom bar */
.rds-bottom-bar {
  height: var(--studio-bottom-h);
  background: rgba(8,8,14,.98);
  border-top: 1px solid var(--studio-border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  flex-shrink: 0;
  overflow-x: auto;
}

.rds-bottom-bar select {
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 6px;
  color: var(--studio-text);
  font-size: 11px;
  padding: 4px 8px;
  font-family: var(--font-ui);
  outline: none;
}

/* RPS Overlay (product studio panel) */
#rpsOverlay {
  position: fixed;
  top: 0;
  right: -500px;
  width: 480px;
  height: 100dvh;
  background: var(--studio-panel);
  border-left: 1px solid var(--studio-border);
  z-index: 1000;
  transition: right 300ms ease;
  display: flex;
  flex-direction: column;
}

#rpsOverlay.is-open { right: 0; }
#rpsOverlay iframe { flex: 1; border: none; background: var(--studio-bg); }

.rps-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
}

.rps-overlay-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  background: var(--studio-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Panel section headers */
.rds-panel-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 10px 14px 4px;
  display: block;
}

/* ── Insert Panel Category Tabs ─────────────────────────────── */
.rds-insert-categories {
  display: flex;
  gap: 0;
  padding: 0 0 2px;
  margin-bottom: 12px;
  border-bottom: 2px solid rgba(255,255,255,.08);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--studio-panel, #0c0c12);
}
.rds-insert-categories::-webkit-scrollbar { display: none; }

.rds-insert-cat-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
  font-family: inherit;
  flex-shrink: 0;
}
.rds-insert-cat-btn:hover {
  color: rgba(255,255,255,.8);
  background: rgba(255,255,255,.04);
}
.rds-insert-cat-btn.active {
  color: #ff4ecd;
  border-bottom-color: #ff4ecd;
  background: rgba(255,78,205,.06);
}

@media (max-width: 600px) {
  .rds-insert-categories {
    padding: 0;
    margin-bottom: 10px;
    gap: 0;
  }
  .rds-insert-cat-btn {
    padding: 10px 14px;
    font-size: 12px;
  }
}

.rds-writer-content-section {
  background: var(--rt-grad-subtle);
  border: 1px solid rgba(124,77,255,.3);
  border-radius: 8px;
  padding: 10px;
  margin: 8px;
}

.rds-writer-content-section h5 {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.6);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ── btn-save-vault ── */
.btn-save-vault {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255,78,205,.35);
  background: rgba(255,78,205,.1);
  color: var(--studio-pink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 150ms ease;
  white-space: nowrap;
}

.btn-save-vault:hover {
  background: rgba(255,78,205,.2);
  border-color: var(--studio-pink);
}

/* ── Align grid ── */
.align-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  margin-bottom: 6px;
}

.align-btn {
  height: 30px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 4px;
  color: rgba(255,255,255,.55);
  cursor: pointer;
  font-size: 11px;
  transition: all 150ms ease;
}

.align-btn:hover { background: var(--studio-hover); color: #fff; }

/* ── Kittl preset grid ── */
.kittl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.kittl-preset {
  padding: 6px 8px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 10px;
  color: rgba(255,255,255,.65);
  transition: all 150ms ease;
  text-align: center;
}

.kittl-preset:hover { border-color: var(--rt-purple); color: #fff; }

/* ── RDS Mobile ── */
@media (max-width: 1023px) {
  .rds-left-panel { width: var(--studio-strip-w); overflow: hidden; }
  .rds-right-panel { display: none; }
  #rpsOverlay { width: 100%; right: -100%; }
  .rds-search { width: 120px; }
}

@media (max-width: 767px) {
  .rds-tool-strip,
  .rds-left-panel,
  .rds-right-panel { display: none !important; }
  .rds-topbar { padding: 0 8px; gap: 4px; }
  .rds-search { display: none; }
  #rpsOverlay { width: 100%; right: -100%; }
}

/* ═══════════════════════════════════════════════════════════════
   20. MISSING COMPONENTS — rs-warning-modal, rs-checkbox,
       rs-bottom-sheet, rs-toast-container, rs-tooltip,
       rds-mobile-fab-row, mobile-quick-btn, status vars
   ═══════════════════════════════════════════════════════════════ */

/* ── Status color variables ── */
:root {
  --status-safe:    #4ade80;
  --status-warn:    #f59e0b;
  --status-block:   #ef4444;
  --status-pending: #a78bfa;
}

/* ── rs-warning-modal ── */
.rs-warning-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.rs-warning-modal.is-visible { display: flex; }

.rs-warning-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.rs-warning-modal__box {
  position: relative;
  background: #161618;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 28px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}

.rs-warning-modal--amber .rs-warning-modal__box {
  border-color: rgba(245,158,11,.3);
}

.rs-warning-modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.rs-warning-modal__icon {
  font-size: 28px;
  flex-shrink: 0;
}

.rs-warning-modal__title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.rs-warning-modal__body {
  margin-bottom: 20px;
}

.rs-warning-modal__body p {
  font-size: 13px;
  color: rgba(255,255,255,.65);
  line-height: 1.6;
  margin-bottom: 10px;
}

.rs-warning-modal__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rs-warning-modal__list li {
  font-size: 13px;
  color: rgba(255,255,255,.65);
  padding: 8px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  line-height: 1.5;
}

.rs-warning-modal__footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── rs-checkbox ── */
.rs-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  line-height: 1.5;
}

.rs-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  accent-color: var(--studio-pink);
  cursor: pointer;
  margin-top: 2px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 3px;
}

/* ── rs-bottom-sheet ── */
.rs-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--studio-panel);
  border-top: 1px solid var(--studio-border);
  border-radius: 16px 16px 0 0;
  z-index: 800;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rs-bottom-sheet.is-open {
  transform: translateY(0);
}

.rs-bottom-sheet__handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,.2);
  border-radius: 2px;
  margin: 10px auto 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.rs-bottom-sheet__tabs {
  display: flex;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.rs-bottom-sheet__tabs::-webkit-scrollbar { display: none; }

.rs-bottom-sheet__tab {
  flex: 1;
  min-width: 60px;
  height: 38px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.45);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 150ms ease;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  padding: 0 8px;
}

.rs-bottom-sheet__tab:hover { color: rgba(255,255,255,.75); }
.rs-bottom-sheet__tab.is-active { color: var(--studio-pink); border-bottom-color: var(--studio-pink); }

.rs-bottom-sheet__content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

/* ── rs-toast-container (from studio-shared.js) ── */
.rs-toast-container {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 99990;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.rs-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 90vw;
  animation: rsToastIn 0.2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

@keyframes rsToastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rs-toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
}

.rs-toast--success { background: #0d0d0f; border: 1px solid rgba(74,222,128,.4); color: #4ade80; }
.rs-toast--error   { background: #0d0d0f; border: 1px solid rgba(239,68,68,.4);  color: #ef4444; }
.rs-toast--warn    { background: #0d0d0f; border: 1px solid rgba(245,158,11,.4); color: #f59e0b; }
.rs-toast--info    { background: #0d0d0f; border: 1px solid rgba(255,78,205,.4); color: var(--studio-pink); }

.rs-toast__icon  { font-size: 16px; flex-shrink: 0; }
.rs-toast__text  { flex: 1; }
.rs-toast__close { cursor: pointer; color: rgba(255,255,255,.4); font-size: 14px; flex-shrink: 0; }
.rs-toast__close:hover { color: #fff; }

/* ── rs-tooltip (from studio-shared.js HoverTooltip) ── */
.rs-tooltip {
  position: fixed;
  z-index: 9999;
  background: #1e1e22;
  border: 1px solid rgba(255,78,205,.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #e0e0e4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  max-width: 240px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.rs-tooltip.is-visible { opacity: 1; }

.rs-tooltip strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.rs-tooltip span {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  line-height: 1.4;
}

.rs-tooltip kbd {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 4px;
  font-size: 10px;
  font-family: monospace;
  color: rgba(255,255,255,.6);
}

/* ── rs-popup base (from studio-popup-system.js BasePopup) ── */
/* Hidden by default — shown only when .is-visible is added by JS */
.rs-popup {
  position: fixed;
  inset: 0;
  z-index: 9600;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.rs-popup.is-visible {
  display: flex !important;
}
.rs-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(4px);
}
.rs-popup__content {
  position: relative;
  background: #1a1a22;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1;
}
.rs-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.rs-popup__title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}
.rs-popup__close {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.rs-popup__close:hover { background: rgba(239,68,68,.12); color: #ef4444; border-color: rgba(239,68,68,.3); }
.rs-popup__body { font-size: 13px; color: rgba(255,255,255,.7); }

/* ── rs-popup-guide (from studio-shared.js PopupGuide) ── */
.rs-popup-guide {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: none;
  pointer-events: none;
}

.rs-popup-guide.is-active { display: block; }

.rs-popup-guide__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  pointer-events: auto;
}

.rs-popup-guide__highlight {
  position: absolute;
  border: 2px solid var(--studio-pink);
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(255,78,205,.2);
  pointer-events: none;
  z-index: 1;
}

.rs-popup-guide__card {
  position: absolute;
  background: #1e1e22;
  border: 1px solid rgba(255,78,205,.3);
  border-radius: 12px;
  padding: 20px;
  max-width: 320px;
  z-index: 2;
  pointer-events: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}

.rs-popup-guide__step {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--studio-pink);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.rs-popup-guide__title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 8px;
}

.rs-popup-guide__text {
  font-size: 13px;
  color: rgba(255,255,255,.65);
  line-height: 1.5;
  margin: 0 0 16px;
}

.rs-popup-guide__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── rds-mobile-fab-row — DEAD CODE, no HTML uses this ── */
.rds-mobile-fab-row {
  display: none !important;
}

/* ── mobile-quick-edit-grid ── */
.mobile-quick-edit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 4px 0;
}

.mobile-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: 8px;
  color: rgba(255,255,255,.65);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 150ms ease;
  text-align: center;
  min-height: 56px;
}

.mobile-quick-btn:hover,
.mobile-quick-btn:active {
  background: rgba(255,78,205,.12);
  border-color: rgba(255,78,205,.3);
  color: var(--studio-pink);
}

.mobile-quick-btn .icon {
  font-size: 18px;
  line-height: 1;
}

/* ── rs-save-status spinner ── */
.rs-save-status__spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(245,158,11,.3);
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: rsSpin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes rsSpin {
  to { transform: rotate(360deg); }
}

/* ── Global input override for studio — dark theme always ── */
body.studio-page input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]),
body.studio-page textarea,
body.studio-page select {
  background: var(--studio-surface) !important;
  color: var(--studio-text) !important;
  border-color: var(--studio-border) !important;
  font-size: 12px !important;
}

body.studio-page input::placeholder,
body.studio-page textarea::placeholder {
  color: var(--studio-muted) !important;
}

body.studio-page input:focus,
body.studio-page textarea:focus,
body.studio-page select:focus {
  border-color: var(--studio-pink) !important;
  box-shadow: 0 0 0 2px rgba(255,78,205,.15) !important;
}


/* ═══════════════════════════════════════════════════════════════
   21. RDS REDESIGNED LAYOUT — Topbar, Tool Strip, Sidebar,
       Zone Bar, Right Panel, Mobile Toolbar, Vault Preview
   ═══════════════════════════════════════════════════════════════ */

/* ── Topbar action buttons ── */
.rds-tb-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: rgba(255,255,255,.55);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 150ms ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.rds-tb-action:hover {
  background: var(--studio-hover);
  color: #fff;
  border-color: rgba(255,255,255,.12);
}

.rds-tb-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rds-tb-action--primary {
  background: rgba(255,78,205,.1);
  border-color: rgba(255,78,205,.3);
  color: var(--studio-pink);
}

.rds-tb-action--primary:hover {
  background: rgba(255,78,205,.2);
  border-color: var(--studio-pink);
  color: #fff;
}

.rds-tb-action--gradient {
  background: linear-gradient(90deg, #ff4ecd, #4fdcff);
  border-color: transparent;
  color: #000;
  font-weight: 700;
}

.rds-tb-action--gradient:hover {
  opacity: 0.88;
  color: #000;
}

.rds-tb-action--danger {
  color: rgba(239,68,68,.7);
}

.rds-tb-action--danger:hover {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.3);
  color: #ef4444;
}

/* ── Topbar label (text inside action buttons) ── */
.rds-tb-label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* Only hide labels on very small screens — keep them visible on desktop */
@media (max-width: 680px) {
  .rds-tb-label { display: none; }
}

/* ── Topbar divider ── */
.rds-tb-divider {
  width: 1px;
  height: 18px;
  background: var(--studio-border);
  flex-shrink: 0;
  margin: 0 2px;
}

/* ── Status bar — inline, replaces floating toasts ── */
.rds-status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-shrink: 1;
}

/* Status message — fades in/out next to save status */
.rds-status-msg {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  transition: opacity 0.3s ease;
}
.rds-status-msg--success { color: #4ade80; background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.2); }
.rds-status-msg--error   { color: #ef4444; background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.2); }
.rds-status-msg--warn    { color: #f59e0b; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.2); }
.rds-status-msg--info    { color: var(--studio-pink); background: rgba(255,78,205,.08); border: 1px solid rgba(255,78,205,.2); }

/* ── Design name input in topbar ── */
.rds-design-name-input {
  height: 28px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: rgba(255,255,255,.9);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-ui);
  outline: none;
  transition: all 150ms ease;
  max-width: 200px;
  min-width: 100px;
}

.rds-design-name-input:hover {
  border-color: rgba(255,255,255,.12);
  background: var(--studio-hover);
}

.rds-design-name-input:focus {
  border-color: var(--studio-pink);
  background: var(--studio-surface);
  color: #fff;
  max-width: 260px;
}

.rds-design-name-input::placeholder {
  color: rgba(255,255,255,.3);
  font-weight: 400;
}

/* Design ID badge next to title */
.rds-design-id-badge {
  font-size: 10px;
  color: rgba(255,255,255,.3);
  font-family: monospace;
  letter-spacing: .3px;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .rds-design-name-input { max-width: 130px; min-width: 80px; font-size: 12px; }
  .rds-design-id-badge { display: none; }
  .rds-status-msg { max-width: 120px; }
}
@media (max-width: 680px) {
  .rds-design-name-input { max-width: 90px; min-width: 60px; font-size: 11px; }
  .rds-status-msg { display: none; }
}

/* ── Tool strip with labels ── */
.rds-tool-strip {
  width: 64px !important; /* wider to fit labels */
  background: var(--studio-panel);
  border-right: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  scrollbar-width: none;
}

.rds-tool-strip::-webkit-scrollbar { display: none; }

.rds-tool-btn {
  width: 56px !important;
  height: 48px !important;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.38);
  cursor: pointer;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  font-size: 15px;
  transition: all 150ms ease;
  flex-shrink: 0;
  position: relative;
  padding: 0;
}

.rds-tool-btn:hover { background: var(--sa-hover); color: #fff; }
.rds-tool-btn.is-active { background: var(--rt-grad-subtle); color: var(--sa-pink); }

/* ── Tool label (text under icon) ── */
.rds-tool-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
  color: inherit;
  text-align: center;
}

/* ── Canvas-only tool buttons (smaller) ── */
.rds-tool-btn--canvas {
  height: 36px !important;
  width: 56px !important;
}

/* ── Tool divider ── */
.rds-tool-divider {
  width: 36px;
  height: 1px;
  background: var(--sa-border);
  margin: 4px 0;
  flex-shrink: 0;
}

/* ── Slide-out sidebar ── */
.rds-sidebar {
  position: absolute;
  top: 0;
  left: 64px; /* matches new tool strip width */
  bottom: 0;
  width: 260px;
  background: var(--sa-panel);
  border-right: 1px solid var(--sa-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 20px rgba(0,0,0,.4);
}

.rds-sidebar.is-open {
  transform: translateX(0);
}

.rds-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--sa-border);
  flex-shrink: 0;
  background: rgba(8,8,14,.6);
}

.rds-sidebar__title {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.8);
  letter-spacing: 0.3px;
}

.rds-sidebar__close {
  width: 24px;
  height: 24px;
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: 50%;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
  flex-shrink: 0;
}

.rds-sidebar__close:hover { color: #fff; border-color: rgba(255,255,255,.3); }

.rds-sidebar__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.rds-sidebar__body::-webkit-scrollbar { width: 3px; }
.rds-sidebar__body::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ── Zone bar (Front / Back / Sleeve tabs) ── */
.rds-zone-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px 6px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
}

.rds-zone-tab {
  padding: 4px 14px;
  border-radius: 20px;
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  color: rgba(255,255,255,.4);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: var(--font-ui);
  white-space: nowrap;
}

.rds-zone-tab.is-active,
.rds-zone-tab[data-zone].is-active {
  background: var(--rt-grad-subtle);
  border-color: var(--rt-purple);
  color: #fff;
}

/* ── Canvas size badge ── */
.rds-canvas-badge {
  font-size: 10px;
  color: rgba(255,255,255,.3);
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Right panel header ── */
.rds-rp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--sa-border);
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.55);
  letter-spacing: 0.3px;
}

.rds-rp-collapse {
  width: 22px;
  height: 22px;
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: 4px;
  color: rgba(255,255,255,.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
}

.rds-rp-collapse:hover { color: #fff; border-color: rgba(255,255,255,.25); }

/* Right panel collapsed state */
.rds-right-panel.is-collapsed {
  width: 0 !important;
  overflow: hidden;
}

/* ── Dropdown right-aligned ── */
.rds-dropdown__menu--right {
  left: auto;
  right: 0;
}

/* ── Mobile bottom toolbar ── */
.rds-mobile-toolbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(8,8,14,.97);
  border-top: 1px solid var(--sa-border);
  z-index: 600;
  align-items: center;
  justify-content: space-around;
  gap: 0;
}

/* ── Mobile quick-actions grid (hidden by default, shown on mobile) ── */
.rds-mobile-quick-grid {
  display: none;
}

@media (max-width: 767px) {
  .rds-mobile-toolbar { display: flex; }
  /* Hide zone bar on mobile (removed from HTML too) */
  .rds-zone-bar { display: none !important; }
  /* Right panel hidden on mobile — use bottom sheet */
  .rds-right-panel { display: none !important; }
  /* Tool strip hidden on mobile — use bottom toolbar */
  .rds-tool-strip { display: none !important; }
  /* Sidebar hidden on mobile — use bottom sheet */
  .rds-sidebar { display: none !important; }
  /* Touch selection bar hidden on mobile — use Tools in bottom toolbar */
  .rds-touch-sel-bar { display: none !important; }
}

/* ── Touch selection toolbar — HIDDEN, actions moved to mobile toolbar panel ── */
.rds-touch-sel-bar {
  display: none !important; /* Actions available via mobile toolbar Tools panel */
}

.rds-tsb-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
  flex-shrink: 0;
}

.rds-tsb-btn:hover,
.rds-tsb-btn:active {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.rds-tsb-btn--danger { color: rgba(239,68,68,.8); }
.rds-tsb-btn--danger:hover { background: rgba(239,68,68,.15); color: #ef4444; }

.rds-tsb-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,.1);
  margin: 0 2px;
  flex-shrink: 0;
}

.rds-mob-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 56px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.45);
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 150ms ease;
  padding: 0;
  letter-spacing: 0.2px;
}

.rds-mob-btn:hover,
.rds-mob-btn:active {
  color: #fff;
  background: rgba(255,255,255,.05);
}

.rds-mob-btn--save {
  color: var(--sa-pink);
  position: relative;
}

.rds-mob-btn--save::before {
  content: '';
  position: absolute;
  top: 8px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,78,205,.12);
  border: 1px solid rgba(255,78,205,.3);
}

.rds-mob-btn--save svg,
.rds-mob-btn--save span {
  position: relative;
  z-index: 1;
}

/* ── Vault save preview overlay ── */
.vault-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.vault-preview-overlay[style*="flex"] {
  display: flex !important;
}

.vault-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.vault-preview-modal {
  position: relative;
  background: #0f0f14;
  border: 1px solid rgba(255,78,205,.25);
  border-radius: 20px;
  padding: 28px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
  box-shadow: 0 32px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(255,78,205,.1);
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.vault-preview-modal::-webkit-scrollbar { width: 3px; }
.vault-preview-modal::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* Preview-only variant (design preview modal) */
.vault-preview-modal--preview {
  max-width: 600px;
  border-color: rgba(79,220,255,.2);
  box-shadow: 0 32px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(79,220,255,.08);
}

.vault-preview-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
  z-index: 2;
}

.vault-preview-close:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-color: rgba(255,255,255,.25);
}

.vault-preview-header {
  text-align: center;
  margin-bottom: 20px;
  padding-right: 24px; /* avoid overlap with close btn */
}

.vault-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(74,222,128,.1);
  border: 1px solid rgba(74,222,128,.3);
  color: #4ade80;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 10px;
}

.vault-preview-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  margin: 0 0 6px;
  line-height: 1.2;
}

.vault-preview-creator {
  font-size: 12px;
  color: rgba(255,255,255,.45);
  margin: 0;
}

.vault-preview-img-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a22;
  border: 1px solid var(--sa-border);
  margin-bottom: 16px;
  aspect-ratio: 3/4;
  max-height: 320px;
}

.vault-preview-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.vault-preview-img-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
}

.vault-preview-desc {
  font-size: 13px;
  color: rgba(255,255,255,.55);
  line-height: 1.6;
  margin: 0 0 16px;
  padding: 10px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
}

.vault-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.vault-preview-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 150ms ease;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1;
}

.vault-preview-btn--primary {
  background: linear-gradient(90deg, #ff4ecd, #4fdcff);
  color: #000;
  border-color: transparent;
}

.vault-preview-btn--primary:hover { opacity: 0.88; }

.vault-preview-btn--secondary {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.12);
  color: rgba(255,255,255,.8);
}

.vault-preview-btn--secondary:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.vault-preview-btn--ghost {
  background: transparent;
  border-color: rgba(255,255,255,.1);
  color: rgba(255,255,255,.5);
}

.vault-preview-btn--ghost:hover {
  border-color: rgba(255,255,255,.25);
  color: rgba(255,255,255,.8);
}

.vault-preview-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  color: rgba(255,255,255,.3);
  line-height: 1.5;
  padding: 10px 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 8px;
}

.vault-preview-note svg { flex-shrink: 0; margin-top: 1px; }

/* ── Mobile vault preview adjustments ── */
@media (max-width: 600px) {
  .vault-preview-modal {
    padding: 20px 16px;
    border-radius: 16px;
    max-height: 95vh;
  }

  .vault-preview-title { font-size: 18px; }
  .vault-preview-img-wrap { max-height: 240px; }

  .vault-preview-actions {
    flex-direction: column;
  }
}

/* ── RDS Main layout fix for new tool strip width ── */
.rds-main {
  position: relative; /* needed for sidebar absolute positioning */
}

/* ── Canvas area adjusts when sidebar is open ── */
.rds-canvas-area {
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Right panel section label ── */
.rds-right-panel .rp-section > .rs-label:first-child {
  margin-top: 0;
}

/* ── Topbar responsive ── */
@media (max-width: 767px) {
  .rds-topbar {
    padding: 0 8px;
    gap: 4px;
    height: 44px;
  }

  .rds-design-name-input {
    max-width: 100px;
    font-size: 11px;
  }

  .rds-topbar__center {
    gap: 4px;
  }

  .rds-topbar__right {
    gap: 3px;
  }

  /* Hide export and apply on mobile — available in mobile toolbar */
  #ddExport,
  #btnApplyToProduct {
    display: none;
  }
}

@media (max-width: 480px) {
  .rds-topbar__left .rs-save-status { display: none; }
  .rds-design-name-input { max-width: 80px; }
}

/* ── Tool strip mobile: hidden (replaced by bottom toolbar) ── */
@media (max-width: 767px) {
  .rds-tool-strip { display: none !important; }
  .rds-right-panel { display: none !important; }
  .rds-sidebar {
    left: 0;
    width: 100%;
    top: auto;
    bottom: 56px; /* above mobile toolbar */
    height: 65vh;
    transform: translateY(100%);
    border-right: none;
    border-top: 1px solid var(--sa-border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,.5);
  }
  .rds-sidebar.is-open { transform: translateY(0); }
}

/* ── Tablet adjustments ── */
@media (min-width: 768px) and (max-width: 1023px) {
  .rds-tool-strip { width: 56px !important; }
  .rds-tool-btn { width: 48px !important; }
  .rds-tool-label { display: none; }
  .rds-tool-btn { height: 40px !important; }
  .rds-sidebar { left: 56px; width: 240px; }
  .rds-right-panel { width: 180px; }
  .rds-tb-label { display: none; }
}


/* ═══════════════════════════════════════════════════════════════
   22. COLOR SWATCH SYSTEM — replaces raw color inputs
   ═══════════════════════════════════════════════════════════════ */

.rp-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  margin-bottom: 4px;
}

.rp-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
  flex-shrink: 0;
  padding: 0;
  outline: none;
  position: relative;
}

.rp-swatch:hover {
  transform: scale(1.18);
  border-color: rgba(255,255,255,.4);
}

.rp-swatch.is-active {
  border-color: var(--sa-pink);
  box-shadow: 0 0 0 2px var(--sa-bg), 0 0 0 4px var(--sa-pink);
}

/* Transparent swatch — checkerboard */
.rp-swatch--transparent {
  background:
    linear-gradient(45deg, #555 25%, transparent 25%) -4px 0,
    linear-gradient(-45deg, #555 25%, transparent 25%) -4px 0,
    linear-gradient(45deg, transparent 75%, #555 75%),
    linear-gradient(-45deg, transparent 75%, #555 75%);
  background-size: 8px 8px;
  background-color: #333;
}

/* Custom color swatch — wraps hidden input */
.rp-swatch--custom {
  background: conic-gradient(#ff4ecd, #4fdcff, #ffd600, #4ade80, #ff4ecd);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.9);
  cursor: pointer;
}

.rp-swatch--custom input[type="color"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.rp-swatch--custom:hover { transform: scale(1.18); }

/* Range slider — proper styling */
.rp-range {
  width: 100%;
  height: 4px;
  accent-color: var(--sa-pink);
  cursor: pointer;
  margin: 6px 0;
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   23. DESKTOP LAYOUT FIXES — tool strip, sidebar, canvas
   ═══════════════════════════════════════════════════════════════ */

/* Fix: rds-main overflow — hidden to prevent canvas escaping viewport */
.rds-main {
  overflow: hidden;
  position: relative;
}

/* Fix: canvas area must clip its own overflow */
.rds-canvas-area {
  overflow: hidden;
  min-width: 0;
}

/* Fix: sidebar pushes canvas — use margin not absolute on desktop */
@media (min-width: 768px) {
  .rds-sidebar {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: 0;
    overflow: hidden;
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 0 solid var(--sa-border);
    box-shadow: none;
    flex-shrink: 0;
  }

  .rds-sidebar.is-open {
    width: 260px;
    border-right-width: 1px;
    box-shadow: none;
  }
}

/* Fix: right panel always visible on desktop */
@media (min-width: 1024px) {
  .rds-right-panel {
    display: flex !important;
    flex-direction: column;
    width: 220px;
    min-width: 220px;
  }
}

/* Fix: tool strip width consistent */
@media (min-width: 768px) {
  .rds-tool-strip {
    width: 64px !important;
    flex-shrink: 0;
  }
}

/* Fix: canvas wrapper — base styles (mobile overridden at end of file) */
#rdsCanvasWrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
  position: relative;
  min-height: 0;
  min-width: 0;
  background: var(--sa-bg);
}

/* Fabric.js canvas container */
#rdsCanvasWrapper .canvas-container {
  transform-origin: center center;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 16px 64px rgba(0,0,0,.7);
}

/* ═══════════════════════════════════════════════════════════════
   24. MOBILE CANVAS CENTERING & LAYOUT
   (Authoritative rules consolidated at end of file — section 27)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  .studio-page {
    overflow: hidden;
    min-height: 100dvh;
  }

  .studio-page .navbar {
    height: 44px !important;
    min-height: 44px !important;
  }

  .rds-zone-bar {
    padding: 5px 8px 4px;
    gap: 4px;
    flex-shrink: 0;
  }

  .rds-zone-tab {
    padding: 3px 10px;
    font-size: 10px;
  }

  .rds-canvas-badge {
    font-size: 9px;
    padding: 2px 6px;
  }

  /* Topbar: compact on mobile — minimize to give canvas more space */
  .rds-topbar {
    height: 36px;
    padding: 0 6px;
    gap: 3px;
    flex-shrink: 0;
  }

  .rds-topbar .rds-topbar-title {
    font-size: 11px;
  }

  .rds-topbar .rds-topbar-btn {
    height: 28px;
    padding: 0 6px;
    font-size: 10px;
  }

  /* Mobile toolbar: fixed at bottom */
  .rds-mobile-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 600;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* ═══════════════════════════════════════════════════════════════
   25. REDESIGNED VAULT PREVIEW CARD — vp-* system
   ═══════════════════════════════════════════════════════════════ */

/* Overlay */
.vp-overlay {
  position: fixed;
  inset: 0;
  z-index: 9900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.vp-overlay[style*="flex"] { display: flex !important; }

.vp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Floating card */
.vp-card {
  position: relative;
  z-index: 1;
  background: #0c0c12;
  border-radius: 16px;
  padding: 16px 20px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
  /* Gradient border via box-shadow */
  box-shadow:
    0 0 0 1px rgba(255,78,205,.35),
    0 0 0 2px rgba(79,220,255,.15),
    0 32px 80px rgba(0,0,0,.7),
    inset 0 1px 0 rgba(255,255,255,.06);
}

.vp-card::-webkit-scrollbar { width: 3px; }
.vp-card::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* Animated gradient glow ring behind card */
.vp-glow-ring {
  position: absolute;
  inset: -1px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,78,205,.3), rgba(79,220,255,.2), rgba(167,139,250,.2));
  z-index: 0;
  filter: blur(8px);
  opacity: 0.4;
  pointer-events: none;
  animation: vpGlowPulse 3s ease-in-out infinite alternate;
}

.vp-glow-ring--cyan {
  background: linear-gradient(135deg, rgba(79,220,255,.4), rgba(167,139,250,.3));
}

@keyframes vpGlowPulse {
  from { opacity: 0.4; filter: blur(10px); }
  to   { opacity: 0.7; filter: blur(16px); }
}

/* Close button */
.vp-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
  z-index: 2;
}

.vp-close:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-color: rgba(255,255,255,.3);
}

/* Badge row */
.vp-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.vp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}

.vp-badge--saved {
  background: rgba(74,222,128,.1);
  border-color: rgba(74,222,128,.3);
  color: #4ade80;
}

.vp-badge--pending {
  background: rgba(245,158,11,.1);
  border-color: rgba(245,158,11,.3);
  color: #f59e0b;
}

.vp-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: vpDotPulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes vpDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Image column (legacy — kept for compat) */
.vp-img-col { flex-shrink: 0; width: 100%; }

.vp-img-frame {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #111118;
  border: 1px solid rgba(255,78,205,.15);
  width: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  padding: 0;
  line-height: 0;
}

.vp-img-frame img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0;
  padding: 0;
}

/* Shine overlay on image */
.vp-img-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.06) 0%, transparent 50%);
  pointer-events: none;
}

/* Info column */
.vp-info-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vp-brand-mark {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(90deg, #ff4ecd, #4fdcff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2px;
}

.vp-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  margin: 0;
  line-height: 1.2;
  word-break: break-word;
}

.vp-creator {
  font-size: 12px;
  color: rgba(255,255,255,.45);
  margin: 0;
}

.vp-creator strong { color: rgba(255,255,255,.7); }

.vp-design-id {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,.25);
  margin: 0;
}

.vp-desc {
  font-size: 12px;
  color: rgba(255,255,255,.5);
  line-height: 1.5;
  margin: 4px 0;
  padding: 8px 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
}

/* Action buttons */
.vp-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.vp-actions--row {
  flex-direction: row;
  flex-wrap: wrap;
}

.vp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 150ms ease;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
}

/* Primary: gradient fill */
.vp-btn--primary {
  background: linear-gradient(90deg, #ff4ecd, #a78bfa);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(255,78,205,.3);
}

.vp-btn--primary:hover {
  box-shadow: 0 6px 20px rgba(255,78,205,.45);
  transform: translateY(-1px);
  color: #fff;
}

/* Community: cyan accent */
.vp-btn--community {
  background: rgba(79,220,255,.1);
  border-color: rgba(79,220,255,.3);
  color: var(--sa-cyan);
}

.vp-btn--community:hover {
  background: rgba(79,220,255,.18);
  border-color: var(--sa-cyan);
  color: #fff;
}

/* Vault: subtle ghost */
.vp-btn--vault {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.1);
  color: rgba(255,255,255,.55);
}

.vp-btn--vault:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.2);
  color: rgba(255,255,255,.85);
}

/* Note */
.vp-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 10px;
  color: rgba(255,255,255,.28);
  line-height: 1.5;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 8px;
}

.vp-note svg { flex-shrink: 0; margin-top: 1px; }

/* Mobile base card overrides */
@media (max-width: 600px) {
  .vp-card {
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-radius: 0;
    max-height: 100dvh;
    max-height: -webkit-fill-available;
    max-width: 100vw;
    width: 100vw;
  }

  .vp-badge-row { margin-bottom: 6px; }

  .vp-btn {
    padding: 8px 10px;
    font-size: 11px;
  }
}

/* Tablet base */
@media (min-width: 601px) and (max-width: 1024px) {
  .vp-card {
    padding: 16px 18px;
  }
}

/* Design ID display */
.vp-design-id-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
}
.vp-design-id-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  flex-shrink: 0;
}
.vp-design-id {
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: var(--sa-cyan, #4fdcff);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Editable fields */
.vp-field {
  margin-bottom: 10px;
}
.vp-field-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  margin-bottom: 4px;
}
.vp-field-input {
  width: 100%;
  padding: 7px 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 7px;
  color: #fff;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 150ms ease;
  resize: none;
}
.vp-field-input:focus { border-color: rgba(255,78,205,.5); }
.vp-field-input::placeholder { color: rgba(255,255,255,.25); }
.vp-field-textarea { min-height: 52px; }

/* Visibility toggles */
.vp-toggles {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.vp-toggle-item {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}
.vp-toggle-item input[type="checkbox"] { display: none; }
.vp-toggle-track {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.12);
  position: relative;
  transition: background 200ms ease, border-color 200ms ease;
  flex-shrink: 0;
}
.vp-toggle-track::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  top: 2px;
  left: 2px;
  transition: transform 200ms ease, background 200ms ease;
}
.vp-toggle-item input:checked + .vp-toggle-track {
  background: rgba(255,78,205,.25);
  border-color: rgba(255,78,205,.5);
}
.vp-toggle-item input:checked + .vp-toggle-track::after {
  transform: translateX(14px);
  background: #ff4ecd;
}
.vp-toggle-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.55);
}

/* Save meta button */
.vp-btn--save-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255,78,205,.1);
  border: 1px solid rgba(255,78,205,.3);
  border-radius: 8px;
  color: #ff4ecd;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 150ms ease;
  margin-bottom: 10px;
  width: 100%;
  justify-content: center;
}
.vp-btn--save-meta:hover { background: rgba(255,78,205,.18); border-color: #ff4ecd; }
.vp-btn--save-meta:disabled { opacity: 0.5; cursor: not-allowed; }

/* Edit button */
.vp-btn--edit {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.12);
  color: rgba(255,255,255,.6);
}
.vp-btn--edit:hover { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }

/* Danger/delete button */
.vp-btn--danger {
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.2);
  color: #ef4444;
}
.vp-btn--danger:hover { background: rgba(239,68,68,.16); border-color: rgba(239,68,68,.4); }

/* ═══════════════════════════════════════════════════════════════
   25B. PREVIEW-SAVE PANEL (metadata input before saving)
   ═══════════════════════════════════════════════════════════════ */

.vp-card--preview-save {
  max-width: 860px;
  width: 92vw;
  max-height: 92vh;
  padding: 16px 20px;
  overflow-y: auto;
}

.vp-card--preview-save .vp-badge-row {
  margin-bottom: 10px;
}

.vp-preview-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  align-items: stretch;
  margin-top: 4px;
}

.vp-preview-img-col {
  width: 100%;
  display: flex;
  align-items: stretch;
}

.vp-preview-img-col .vp-preview-img-wrap {
  border-radius: 10px;
  overflow: hidden;
  background: #111118;
  border: 1px solid rgba(79,220,255,.15);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.vp-preview-img-col .vp-preview-img-wrap img {
  width: 100%;
  height: 100%;
  max-height: 72vh;
  object-fit: contain;
  display: block;
  padding: 0;
  margin: 0;
}

.vp-preview-form-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.vp-preview-form-col .vp-field {
  margin-bottom: 4px;
}

.vp-preview-form-col .vp-field-input {
  padding: 8px 10px;
  font-size: 12px;
}

.vp-preview-form-col .vp-field-textarea {
  min-height: 48px;
  resize: vertical;
}

.vp-preview-form-col .vp-toggles {
  margin-bottom: 4px;
}

.vp-actions--preview-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.vp-actions--preview-btns .vp-btn--lg {
  width: 100%;
  flex: 0 0 100%;
}

.vp-actions--preview-btns .vp-btn--sm {
  flex: 1 1 auto;
}

/* Button sizes */
.vp-btn--lg {
  padding: 10px 16px;
  font-size: 12px;
}

.vp-btn--sm {
  padding: 6px 10px;
  font-size: 10px;
}

/* Mobile: preview-save panel */
@media (max-width: 600px) {
  .vp-card--preview-save {
    max-width: 100vw;
    width: 100vw;
    max-height: 100dvh;
    max-height: -webkit-fill-available;
    height: 100dvh;
    height: -webkit-fill-available;
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .vp-card--preview-save .vp-badge-row {
    margin-bottom: 6px;
    flex-shrink: 0;
  }

  .vp-preview-body {
    grid-template-columns: 1fr;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .vp-preview-img-col {
    align-items: center;
    justify-content: center;
  }

  .vp-preview-img-col .vp-preview-img-wrap {
    border-radius: 8px;
    width: auto;
    max-width: 100%;
    display: inline-flex;
  }

  .vp-preview-img-col .vp-preview-img-wrap img {
    max-height: 44vh;
    width: auto;
    max-width: 100%;
    height: auto;
  }

  .vp-preview-form-col {
    gap: 4px;
  }

  .vp-preview-form-col .vp-field-input {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 8px;
  }

  .vp-preview-form-col .vp-field-textarea {
    min-height: 50px;
  }

  .vp-btn--lg {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 10px;
  }

  .vp-btn--sm {
    padding: 9px 12px;
    font-size: 12px;
    border-radius: 8px;
  }

  .vp-actions--preview-btns {
    gap: 5px;
  }

  .vp-toggle-label {
    font-size: 13px;
  }

  .vp-close {
    width: 32px;
    height: 32px;
  }
}

/* Tablet: preview-save panel */
@media (min-width: 601px) and (max-width: 1024px) {
  .vp-card--preview-save {
    max-width: 88vw;
    width: 88vw;
    max-height: 90vh;
    padding: 16px 18px;
  }

  .vp-preview-body {
    grid-template-columns: 1.3fr 1fr;
    gap: 16px;
  }

  .vp-preview-img-col .vp-preview-img-wrap img {
    max-height: 62vh;
  }

  .vp-btn--lg {
    padding: 11px 16px;
    font-size: 12px;
  }
}

/* Desktop: preview-save panel */
@media (min-width: 1025px) {
  .vp-card--preview-save {
    max-width: 860px;
  }

  .vp-preview-img-col .vp-preview-img-wrap img {
    max-height: 72vh;
  }
}

/* ═══════════════════════════════════════════════════════════════
   25C. SAVED PANEL (read-only confirmation after save)
   ═══════════════════════════════════════════════════════════════ */

.vp-card--saved {
  max-width: 720px;
  width: 90vw;
  max-height: 92vh;
  padding: 16px 20px;
  overflow-y: auto;
}

.vp-card--saved .vp-badge-row {
  margin-bottom: 10px;
}

.vp-saved-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  align-items: stretch;
  margin-top: 4px;
}

.vp-saved-img-col {
  width: 100%;
  display: flex;
  align-items: stretch;
}

.vp-saved-img-col .vp-img-frame {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #111118;
  border: 1px solid rgba(255,78,205,.15);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}

.vp-saved-img-col .vp-img-frame img {
  width: 100%;
  height: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
  padding: 0;
  margin: 0;
}

.vp-saved-info-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.vp-saved-title {
  font-family: var(--font-display, 'Inter', sans-serif);
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  margin: 0;
  line-height: 1.3;
  word-break: break-word;
}

.vp-saved-desc {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  line-height: 1.5;
  margin: 0;
  padding: 6px 8px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 6px;
}

.vp-saved-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.vp-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(167,139,250,.1);
  border: 1px solid rgba(167,139,250,.2);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  color: #a78bfa;
}

.vp-saved-visibility {
  margin: 2px 0;
}

.vp-saved-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: rgba(255,78,205,.05);
  border: 1px solid rgba(255,78,205,.12);
  border-radius: 6px;
}

.vp-saved-id-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
}

.vp-saved-id-value {
  font-size: 13px;
  font-weight: 800;
  color: #ff4ecd;
  font-family: monospace;
  letter-spacing: 1px;
}

.vp-actions--saved {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.vp-actions--saved .vp-btn {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  white-space: nowrap;
}

/* Mobile: saved panel */
@media (max-width: 600px) {
  .vp-card--saved {
    max-width: 100vw;
    width: 100vw;
    max-height: 100dvh;
    max-height: -webkit-fill-available;
    height: 100dvh;
    height: -webkit-fill-available;
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .vp-card--saved .vp-badge-row {
    margin-bottom: 6px;
    flex-shrink: 0;
  }

  .vp-saved-body {
    grid-template-columns: 1fr;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .vp-saved-img-col {
    align-items: center;
    justify-content: center;
  }

  .vp-saved-img-col .vp-img-frame {
    width: auto;
    max-width: 100%;
    display: inline-flex;
  }

  .vp-saved-img-col .vp-img-frame img {
    max-height: 44vh;
    width: auto;
    max-width: 100%;
    height: auto;
  }

  .vp-saved-title {
    font-size: 15px;
  }

  .vp-saved-desc {
    font-size: 11px;
  }

  .vp-actions--saved {
    gap: 4px;
  }

  .vp-actions--saved .vp-btn {
    padding: 9px 10px;
    font-size: 11px;
    border-radius: 8px;
  }

  .vp-saved-id-value {
    font-size: 12px;
  }

  .vp-close {
    width: 32px;
    height: 32px;
  }
}

/* Tablet: saved panel */
@media (min-width: 601px) and (max-width: 1024px) {
  .vp-card--saved {
    max-width: 85vw;
    width: 85vw;
    max-height: 90vh;
    padding: 16px 18px;
  }

  .vp-saved-body {
    grid-template-columns: 1.3fr 1fr;
    gap: 16px;
  }

  .vp-saved-img-col .vp-img-frame img {
    max-height: 58vh;
  }
}

/* Desktop: saved panel */
@media (min-width: 1025px) {
  .vp-card--saved {
    max-width: 720px;
  }

  .vp-saved-body {
    grid-template-columns: 1.4fr 1fr;
  }

  .vp-saved-img-col .vp-img-frame img {
    max-height: 68vh;
  }
}


/* ═══════════════════════════════════════════════════════════════
   26. DESKTOP VIEWPORT FIX
   ═══════════════════════════════════════════════════════════════ */

/* Desktop: canvas wrapper padding */
body.studio-page #rdsCanvasWrapper,
.studio-page #rdsCanvasWrapper {
  padding: 8px !important;
  min-height: 0 !important;
}

/* Mobile overrides handled in section 27 at end of file */


/* ═══════════════════════════════════════════════════════════════
   27. AUTHORITATIVE LAYOUT — Canvas, Viewport, Mobile (FINAL)
   This section is the single source of truth for canvas layout.
   All earlier conflicting rules in this file have been neutralized.
   ═══════════════════════════════════════════════════════════════ */

:root { --rs-brand-nav-h: 48px; }

html, body.studio-page {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden !important;
  position: fixed;
  width: 100%;
}

#rdsApp {
  margin-top: var(--rs-brand-nav-h) !important;
  height: calc(100dvh - var(--rs-brand-nav-h)) !important;
  max-height: calc(100dvh - var(--rs-brand-nav-h)) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.rds-topbar { flex-shrink: 0 !important; height: 48px !important; overflow: hidden; }

.rds-main {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: row;
  overflow: hidden !important;
  position: relative !important;
}

.rds-tool-strip, .rds-left-panel, .rds-right-panel, .rds-sidebar {
  flex-shrink: 0; min-height: 0; overflow-y: auto; overflow-x: hidden;
}

.rds-canvas-area {
  flex: 1 1 0 !important; min-width: 0 !important; min-height: 0 !important;
  display: flex !important; flex-direction: column !important;
  overflow: hidden !important; align-items: center !important;
}

#rdsCanvasWrapper {
  flex: 1 1 0 !important; min-height: 0 !important; min-width: 0 !important;
  width: 100% !important; display: flex !important;
  align-items: center !important; justify-content: center !important;
  overflow: hidden !important; padding: 8px !important; position: relative !important;
}

#rdsCanvasWrapper .canvas-container { flex-shrink: 0 !important; transform-origin: center center !important; }

.rds-bottom-bar { flex-shrink: 0 !important; }
.rds-zone-tabs, .rds-zone-bar { flex-shrink: 0; }

/* Desktop (≥1024px) */
@media (min-width: 1024px) {
  .rds-right-panel { display: flex !important; flex-direction: column !important; width: 260px !important; min-width: 260px !important; flex-shrink: 0 !important; }
  .rds-tool-strip { width: 60px !important; min-width: 60px !important; }
  #rdsCanvasWrapper { padding: 8px 16px !important; }
}

/* Tablet (768-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .rds-right-panel { width: 220px !important; min-width: 220px !important; }
  .rds-tool-strip { width: 52px !important; }
  #rdsCanvasWrapper { padding: 6px 10px !important; }
}

/* Desktop JS-writeback guard */
@media (min-width: 768px) {
  #rdsCanvasWrapper[style] { flex: 1 1 0 !important; height: auto !important; min-height: 0 !important; }
}

/* ── MOBILE (≤767px) — JS controls canvas dimensions ── */
@media (max-width: 767px) {
  #rdsApp { margin-top: var(--rs-brand-nav-h) !important; height: calc(100dvh - var(--rs-brand-nav-h)) !important; max-height: calc(100dvh - var(--rs-brand-nav-h)) !important; }
  .rds-topbar { height: 44px !important; flex-shrink: 0 !important; min-height: 44px !important; padding: 0 6px !important; gap: 3px !important; overflow-x: auto !important; overflow-y: hidden !important; scrollbar-width: none !important; display: none !important; }
  .rds-topbar::-webkit-scrollbar { display: none !important; }
  .rds-topbar .rds-tb-label { display: none !important; }
  .rds-topbar .rds-tb-action { height: 32px !important; padding: 0 8px !important; min-width: 32px !important; font-size: 12px !important; }
  .rds-design-name-input { max-width: 120px !important; font-size: 12px !important; }
  .rds-topbar__left { flex-shrink: 0 !important; gap: 4px !important; }
  .rds-topbar__center { gap: 3px !important; flex-shrink: 1 !important; }
  .rds-topbar__right { flex-shrink: 0 !important; gap: 3px !important; }
  .rds-tool-strip, .rds-left-panel, .rds-right-panel, .rds-sidebar { display: none !important; }
  .rds-main { flex: 1 1 0 !important; min-height: 0 !important; overflow: hidden !important; padding-bottom: 0 !important; flex-direction: column !important; }
  .rds-canvas-area { flex: 1 1 0 !important; width: 100% !important; min-height: 0 !important; padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px)) !important; overflow: hidden !important; align-items: center !important; justify-content: flex-start !important; }
  /* Wrapper: JS sets explicit width/height on mobile — CSS just ensures block + centered */
  #rdsCanvasWrapper, body.studio-page #rdsCanvasWrapper, .studio-page #rdsCanvasWrapper { flex: none !important; padding: 0 !important; width: auto !important; min-height: 0 !important; overflow: hidden !important; margin: 8px auto 0 !important; display: block !important; }
  #rdsCanvasWrapper .canvas-container, body.studio-page #rdsCanvasWrapper .canvas-container, .studio-page #rdsCanvasWrapper .canvas-container { transform-origin: top left !important; max-width: calc(100vw - 12px) !important; flex-shrink: 0 !important; }
  .rds-mobile-toolbar { position: fixed !important; bottom: 0 !important; left: 0 !important; right: 0 !important; height: calc(64px + env(safe-area-inset-bottom, 0px)) !important; z-index: 400 !important; padding-bottom: env(safe-area-inset-bottom, 0px) !important; background: rgba(8,8,14,0.98) !important; border-top: 1.5px solid rgba(255,78,205,0.15) !important; }
  .rds-mob-btn { height: 62px !important; gap: 4px !important; font-size: 10px !important; font-weight: 700 !important; min-width: 56px !important; }
  .rds-mob-btn svg { width: 22px !important; height: 22px !important; }
  .rds-mobile-quick-grid { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; gap: 6px !important; padding: 8px 12px !important; background: rgba(12,12,20,0.97) !important; border-top: 1px solid rgba(255,255,255,0.06) !important; position: fixed !important; bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important; left: 0 !important; right: 0 !important; z-index: 390 !important; }
  .rds-mq-btn { display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important; gap: 3px !important; padding: 8px 4px !important; border-radius: 8px !important; border: 1px solid rgba(255,255,255,0.08) !important; background: rgba(255,255,255,0.04) !important; color: rgba(255,255,255,0.65) !important; font-size: 9px !important; font-weight: 600 !important; font-family: inherit !important; cursor: pointer !important; min-height: 48px !important; }
  .rds-mq-btn svg { width: 18px !important; height: 18px !important; }
  .rs-bottom-sheet { z-index: 500 !important; max-height: 70vh !important; background: rgba(12,12,20,0.98) !important; border-radius: 20px 20px 0 0 !important; border-top: 1.5px solid rgba(255,78,205,0.2) !important; }
  .rs-bottom-sheet__handle { width: 48px !important; height: 5px !important; margin: 14px auto 10px !important; background: rgba(255,255,255,0.3) !important; position: relative !important; }
  .rs-bottom-sheet__tab { min-height: 44px !important; font-size: 12px !important; font-weight: 700 !important; }
  .rs-bottom-sheet__content { padding: 14px 16px !important; }
}

/* ── Transform-origin override — desktop uses center, mobile uses top left ── */
@media (min-width: 768px) {
  #rdsCanvasWrapper .canvas-container, body.studio-page #rdsCanvasWrapper .canvas-container, .studio-page #rdsCanvasWrapper .canvas-container { transform-origin: center center !important; flex-shrink: 0 !important; }
}
@media (max-width: 767px) {
  #rdsCanvasWrapper .canvas-container, body.studio-page #rdsCanvasWrapper .canvas-container, .studio-page #rdsCanvasWrapper .canvas-container { transform-origin: top left !important; flex-shrink: 0 !important; }
}

/* ── Save dropdown z-index ── */
.rds-topbar .rds-dropdown__menu, .rds-topbar .rds-dropdown__menu--right { z-index: 9999 !important; position: fixed !important; }
.rds-topbar .rds-dropdown { position: static !important; }

/* ── Right panel enhanced layout ── */
.rds-rp-header { padding: 10px 14px !important; font-size: 11px !important; font-weight: 800 !important; letter-spacing: 1px !important; text-transform: uppercase !important; color: rgba(255,255,255,.45) !important; border-bottom: 1px solid var(--studio-border) !important; display: flex !important; align-items: center !important; justify-content: space-between !important; flex-shrink: 0 !important; min-height: 36px !important; }
.rp-section { padding: 10px 14px !important; border-bottom: 1px solid rgba(255,255,255,.05) !important; }
.rp-accordion-header { display: flex !important; align-items: center !important; justify-content: space-between !important; padding: 9px 14px !important; font-size: 10px !important; font-weight: 700 !important; color: rgba(255,255,255,.55) !important; cursor: pointer !important; border-bottom: 1px solid rgba(255,255,255,.05) !important; user-select: none !important; transition: color .15s !important; letter-spacing: .5px !important; text-transform: uppercase !important; }
.rp-accordion-header:hover { color: rgba(255,255,255,.85) !important; }
.rp-accordion-header .rp-acc-arrow { font-size: 9px !important; transition: transform .2s !important; color: rgba(255,255,255,.3) !important; }
.rp-accordion-header.open .rp-acc-arrow { transform: rotate(180deg) !important; }
.rp-accordion-body { overflow: hidden !important; transition: max-height .25s ease !important; max-height: 0 !important; }
.rp-accordion-body.open { max-height: 800px !important; }
.rp-transform-grid { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 5px !important; }
.rp-transform-grid .rp-field { display: flex !important; flex-direction: column !important; gap: 3px !important; }
.rp-transform-grid .rp-field label { font-size: 9px !important; color: rgba(255,255,255,.3) !important; letter-spacing: .5px !important; text-transform: uppercase !important; }
.rp-transform-grid .rp-field input { height: 26px !important; padding: 0 6px !important; font-size: 11px !important; text-align: center !important; background: var(--studio-surface) !important; border: 1px solid var(--studio-border) !important; border-radius: 5px !important; color: var(--studio-text) !important; width: 100% !important; }
.rp-slider-row { display: flex !important; align-items: center !important; gap: 8px !important; margin-bottom: 8px !important; }
.rp-slider-row label { font-size: 10px !important; color: rgba(255,255,255,.4) !important; min-width: 52px !important; flex-shrink: 0 !important; }
.rp-slider-row input[type="range"] { flex: 1 !important; accent-color: #ff4ecd !important; height: 3px !important; }
.rp-slider-row .rp-slider-val { font-size: 10px !important; color: rgba(255,255,255,.4) !important; width: 28px !important; text-align: right !important; flex-shrink: 0 !important; }
.rp-section .rs-btn { font-size: 11px !important; padding: 7px 10px !important; height: auto !important; }
