* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #0f1117;
  color: #f5f7fb;
}

main {
  width: min(1540px, calc(100% - 24px));
  margin: 20px auto 120px;
}

.hidden { display: none !important; }

h1, h2, h3 { margin: 0 0 8px; }
p, small { color: #aeb7c7; }

input, textarea, select {
  width: 100%;
  border: 1px solid #323a49;
  background: #0d1017;
  color: #fff;
  border-radius: 9px;
  padding: 8px 9px;
  margin: 5px 0 9px;
  outline: none;
  font-size: 13px;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

button, .button-link {
  border: 0;
  background: #6674ff;
  color: white;
  padding: 8px 11px;
  border-radius: 9px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

button.ghost, .button-link.ghost { background: #2a303c; }

.login-card, .panel, .builder-shell {
  background: rgba(24, 28, 37, .94);
  border: 1px solid #2c3443;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.24);
}

.login-card {
  max-width: 430px;
  margin: 90px auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 15px 17px;
  background: rgba(24, 28, 37, .86);
  border: 1px solid #2c3443;
  border-radius: 16px;
}

.top-actions, .builder-head-actions, .builder-actions, .row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 14px;
  align-items: start;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  padding: 15px;
}

.builder-shell {
  overflow: hidden;
}

.builder-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #2c3443;
  background: #151a23;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: #252d3a;
  color: #dbe4f3;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.builder-body {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 720px;
}

.palette {
  padding: 12px;
  background: #111620;
  border-right: 1px solid #2c3443;
  overflow-y: auto;
}

.palette-group {
  margin-bottom: 16px;
}

.palette-group h3 {
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #c9d2e3;
}

.palette-block {
  width: 100%;
  text-align: left;
  margin: 5px 0;
  border-radius: 10px;
  color: #fff;
  padding: 8px 10px;
  box-shadow: inset 0 -2px rgba(0,0,0,.18);
  cursor: grab;
}

.palette-block.dragging {
  opacity: .6;
  transform: scale(.98);
}

.start { background: #d97706; }
.condition { background: #2563eb; }
.time { background: #7c3aed; }
.email { background: #16a34a; }
.helper { background: #475569; }
.custom { background: #0891b2; }

.canvas-wrap {
  padding: 14px;
  min-width: 0;
  overflow: auto;
}

.canvas-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 11px;
  align-items: center;
  margin-bottom: 11px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #dce5f5;
  font-weight: 800;
  white-space: nowrap;
}

.switch input {
  width: auto;
  margin: 0;
}

.workspace {
  min-height: 500px;
  border: 2px dashed #3b4558;
  border-radius: 16px;
  background:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px),
    #0d1017;
  background-size: 24px 24px;
  padding: 18px;
  overflow: auto;
}

.workspace.drop-ready {
  border-color: #60a5fa;
  box-shadow: inset 0 0 0 3px rgba(96,165,250,.18);
}

.empty-workspace {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #8490a3;
  text-align: center;
  margin-top: 150px;
}

.empty-workspace strong {
  color: #cbd5e1;
  font-size: 18px;
}

.script-block {
  max-width: 1180px;
  color: #fff;
  border-radius: 11px;
  padding: 8px 10px;
  margin: 0 0 6px;
  display: flex;
  gap: 8px;
  align-items: center;
  box-shadow: inset 0 -2px rgba(0,0,0,.18), 0 6px 14px rgba(0,0,0,.18);
  cursor: grab;
}

.script-block.dragging {
  opacity: .45;
}

.drag-handle {
  opacity: .75;
  font-weight: 900;
  cursor: grab;
  user-select: none;
}

.block-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.script-block input, .script-block textarea, .script-block select {
  width: auto;
  min-width: 82px;
  max-width: 100%;
  margin: 0;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  color: #fff;
  padding: 6px 8px;
  font-size: 12px;
}

.script-block textarea {
  border-radius: 9px;
}

.script-block .tiny {
  width: 66px;
  min-width: 66px;
}

.script-block .mini-text {
  width: 160px;
  min-width: 130px;
}

.script-block .medium {
  width: 280px;
  min-width: 180px;
}

.script-block .short-area {
  width: 210px;
  min-width: 180px;
  height: 42px;
  min-height: 42px;
}

.script-block .message-area {
  width: 360px;
  min-width: 260px;
  height: 58px;
  min-height: 58px;
}

.script-block label {
  font-weight: 900;
  font-size: 12px;
}

.block-remove {
  margin-left: auto;
  background: rgba(0,0,0,.25);
  padding: 5px 8px;
}

.block-name, .block-when { background: #d97706; }
.block-check { background: #2563eb; }
.block-schedule { background: #7c3aed; }
.block-send, .block-link { background: #16a34a; }
.block-variables, .block-note { background: #475569; }

.custom-label {
  background: rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 3px 7px;
  font-weight: 900;
  font-size: 11px;
}

.custom-box {
  background: #101620;
  border: 1px solid #303948;
  border-radius: 13px;
  padding: 11px;
  margin-bottom: 12px;
}

.custom-palette-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  align-items: center;
}

.tiny-delete {
  padding: 7px 8px;
  background: #334155;
}

.preview {
  margin-top: 12px;
  border: 1px solid #394253;
  background: #111620;
  border-radius: 13px;
  padding: 13px;
}

.item {
  border: 1px solid #303948;
  background: #111620;
  border-radius: 12px;
  padding: 10px;
  margin-top: 8px;
}

.item strong { display: block; margin-bottom: 5px; }
.item p { margin: 6px 0; }

.badge {
  display: inline-block;
  background: #252d3a;
  color: #cfd8e8;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 11px;
  margin: 2px 3px 2px 0;
}

.activity-panel {
  margin-top: 14px;
}

.sheet-helper {
  margin: 8px 0 12px;
  padding: 10px;
  background: #101620;
  border: 1px solid #303948;
  border-radius: 12px;
}

.sheet-helper-title {
  font-weight: 900;
  margin-bottom: 7px;
}

.sheet-helper ol {
  margin: 0 0 8px 18px;
  padding: 0;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.4;
}

.service-box {
  display: flex;
  gap: 7px;
  align-items: center;
  background: #0b0f16;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 8px;
  margin: 7px 0;
  overflow: hidden;
}

#serviceEmailText {
  flex: 1;
  font-size: 11px;
  color: #dbeafe;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tiny-btn {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11px;
}

.full-btn {
  width: 100%;
}

.ok-msg { color: #86efac; font-weight: 800; }
.warn-msg { color: #fde68a; font-weight: 800; }
.bad-msg { color: #fca5a5; font-weight: 800; }
.small-muted { color: #94a3b8; margin-top: 4px; }

#catMeme {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  color: #111;
  border-radius: 999px;
  padding: 9px 13px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  max-width: 330px;
}

#catMeme .cat {
  font-size: 28px;
}

#catText {
  font-weight: 900;
  font-size: 12px;
}

.cat-pop {
  animation: pop .65s ease both;
}

.cat-warn {
  animation: shake .4s ease both;
  background: #fff7ed !important;
}

@keyframes pop {
  0% { transform: scale(.94) rotate(-3deg); }
  45% { transform: scale(1.08) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

.builder-shell.builder-fullscreen {
  position: fixed;
  inset: 8px;
  z-index: 9999;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  background: #181c25;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.72), 0 25px 80px rgba(0,0,0,.55);
}

.builder-shell.builder-fullscreen .builder-head {
  flex: 0 0 auto;
}

.builder-shell.builder-fullscreen .builder-body {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: 240px 1fr;
}

.builder-shell.builder-fullscreen .canvas-wrap {
  min-height: 0;
  overflow: auto;
}

.builder-shell.builder-fullscreen .canvas-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(24,28,37,.94);
  backdrop-filter: blur(12px);
  padding: 8px;
  border: 1px solid #2d3544;
  border-radius: 12px;
}

.builder-shell.builder-fullscreen .workspace {
  width: 6000px;
  min-width: 6000px;
  min-height: 4000px;
  border-radius: 14px;
  background:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    #0d1017;
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  overflow: visible;
  padding: 26px;
}

body.builder-modal-open {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .builder-body { grid-template-columns: 1fr; }
  .palette {
    border-right: 0;
    border-bottom: 1px solid #2c3443;
    max-height: 290px;
  }
}

@media (max-width: 700px) {
  main { width: min(100% - 12px, 1540px); }
  .topbar, .builder-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .canvas-toolbar { grid-template-columns: 1fr; }
  .script-block input, .script-block textarea, .script-block select { width: 100%; }
  .builder-shell.builder-fullscreen { inset: 4px; border-radius: 12px; }
  .builder-shell.builder-fullscreen .workspace {
    width: 3600px;
    min-width: 3600px;
    min-height: 2800px;
  }
  #catMeme { left: 12px; right: 12px; bottom: 12px; }
}

.designer-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,.72);
  padding: 22px;
  overflow: auto;
}

.designer-card {
  width: min(1180px, 100%);
  margin: 0 auto;
  background: #181c25;
  border: 1px solid #334155;
  border-radius: 18px;
  box-shadow: 0 25px 90px rgba(0,0,0,.55);
  overflow: hidden;
}

.designer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid #334155;
  background: #111620;
}

.designer-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 0;
  min-height: 680px;
}

.designer-list {
  padding: 14px;
  border-right: 1px solid #334155;
  background: #101620;
}

.designer-list button {
  width: 100%;
  margin-bottom: 7px;
}

.design-list-items {
  margin-top: 16px;
  border-top: 1px solid #334155;
  padding-top: 12px;
}

.design-list-item {
  background: #242b38;
  justify-content: flex-start;
}

.design-list-item.active {
  background: #6674ff;
}

.designer-editor {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  padding: 16px;
}

.designer-form {
  background: #101620;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 14px;
}

.designer-form label {
  display: block;
  font-size: 12px;
  font-weight: 900;
  color: #cbd5e1;
  margin-top: 8px;
}

#emailDesignPreview {
  background: #0d1017;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 14px;
  min-height: 420px;
  overflow: auto;
}

.email-preview-outer {
  padding: 22px;
  color: #111;
}

.email-preview-card {
  max-width: 620px;
  margin: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
}

.email-preview-head {
  color: #fff;
  padding: 16px 18px;
  font-size: 20px;
  font-weight: 900;
}

.email-preview-body {
  padding: 18px;
  color: #111;
  line-height: 1.55;
}

.email-preview-notice {
  max-width: 620px;
  margin: auto;
  background: #fff;
  border-left: 6px solid #6674ff;
  border-radius: 10px;
  padding: 18px;
  color: #111;
}

.email-preview-letter {
  max-width: 620px;
  margin: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 24px;
  color: #111;
  font-family: Georgia, serif;
  line-height: 1.65;
}

.email-preview-compact,
.email-preview-plain {
  background: #fff;
  color: #111;
  padding: 18px;
  border-radius: 10px;
  line-height: 1.55;
}

.fake-email-button {
  display: inline-block;
  color: #fff;
  padding: 9px 13px;
  border-radius: 8px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .designer-layout,
  .designer-editor {
    grid-template-columns: 1fr;
  }

  .designer-list {
    border-right: 0;
    border-bottom: 1px solid #334155;
  }
}

.custom-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.custom-grid label,
.custom-box label {
  display: block;
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 800;
}

.advanced-custom {
  margin: 10px 0;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px;
  background: #0d1017;
}

.advanced-custom summary {
  cursor: pointer;
  font-weight: 900;
  color: #dbeafe;
}

#customBlockJson {
  min-height: 150px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.custom-palette-row small {
  opacity: .75;
  font-size: 10px;
  margin-left: 6px;
}

@media (max-width: 800px) {
  .custom-grid {
    grid-template-columns: 1fr;
  }
}

.custom-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.custom-grid label,
.custom-box label {
  display: block;
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 800;
}

.advanced-custom {
  margin: 10px 0;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px;
  background: #0d1017;
}

.advanced-custom summary {
  cursor: pointer;
  font-weight: 900;
  color: #dbeafe;
}

#customBlockJson {
  min-height: 150px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.custom-palette-row small {
  opacity: .75;
  font-size: 10px;
  margin-left: 6px;
}

@media (max-width: 800px) {
  .custom-grid {
    grid-template-columns: 1fr;
  }
}

.canva-shell {
  width: min(1500px, 100%);
  height: calc(100vh - 44px);
  margin: 0 auto;
  background: #0f1117;
  border: 1px solid #334155;
  border-radius: 18px;
  box-shadow: 0 25px 90px rgba(0,0,0,.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.canva-top {
  padding: 14px 16px;
  background: #171c26;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.canva-top h2 {
  margin: 0;
}

.canva-top p {
  margin: 4px 0 0;
}

.canva-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.canva-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px 1fr 300px;
}

.canva-left,
.canva-right {
  background: #111620;
  border-right: 1px solid #334155;
  padding: 12px;
  overflow: auto;
}

.canva-right {
  border-right: 0;
  border-left: 1px solid #334155;
}

.canva-left h3,
.canva-right h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #cbd5e1;
  margin: 14px 0 8px;
}

.canva-left button,
.canva-design-list button,
.layer-row {
  width: 100%;
  justify-content: flex-start;
  margin: 4px 0;
  background: #242b38;
}

.canva-design-list button.active,
.layer-row.active {
  background: #6674ff;
}

.canva-centre {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #0b0e14;
}

.canva-toolbar {
  height: 42px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  color: #cbd5e1;
  font-size: 13px;
}

.canva-stage-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 32px;
  display: grid;
  place-items: start center;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    #0b0e14;
  background-size: 28px 28px;
}

.canva-stage {
  position: relative;
  padding: 24px;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}

.canva-paper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.canva-el {
  position: absolute;
  box-sizing: border-box;
  cursor: move;
  user-select: none;
  overflow: hidden;
  line-height: 1.35;
  color: #111827;
}

.canva-el.selected {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.canva-el img {
  max-width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.resize-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 9px;
  height: 9px;
  background: #38bdf8;
  border-radius: 50%;
  display: none;
}

.canva-el.selected .resize-dot {
  display: block;
}

.canva-preview-button {
  display: inline-block;
  color: #fff;
  padding: 10px 14px;
  font-weight: 800;
}

.canva-pill {
  display: inline-block;
  color: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
}

.image-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: #e5e7eb;
  color: #475569;
  border-radius: 8px;
}

.layers-box {
  max-height: 230px;
  overflow: auto;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 6px;
  background: #0d1017;
}

.layer-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-size: 12px;
}

.layer-row small {
  color: #cbd5e1;
  opacity: .75;
}

.props-box {
  margin-top: 12px;
  background: #0d1017;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px;
}

.props-box label {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  margin: 8px 0;
}

.props-box textarea {
  min-height: 86px;
}

.prop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.danger-btn {
  background: #991b1b;
  width: 100%;
  margin-top: 10px;
}

@media (max-width: 1000px) {
  .canva-grid {
    grid-template-columns: 1fr;
  }

  .canva-left,
  .canva-right {
    border: 0;
    border-bottom: 1px solid #334155;
    max-height: 280px;
  }

  .canva-shell {
    height: auto;
    min-height: calc(100vh - 44px);
  }
}

.canva-shell {
  width: min(1500px, 100%);
  height: calc(100vh - 44px);
  margin: 0 auto;
  background: #0f1117;
  border: 1px solid #334155;
  border-radius: 18px;
  box-shadow: 0 25px 90px rgba(0,0,0,.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.canva-top {
  padding: 14px 16px;
  background: #171c26;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.canva-top h2 {
  margin: 0;
}

.canva-top p {
  margin: 4px 0 0;
}

.canva-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.canva-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px 1fr 300px;
}

.canva-left,
.canva-right {
  background: #111620;
  border-right: 1px solid #334155;
  padding: 12px;
  overflow: auto;
}

.canva-right {
  border-right: 0;
  border-left: 1px solid #334155;
}

.canva-left h3,
.canva-right h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #cbd5e1;
  margin: 14px 0 8px;
}

.canva-left button,
.canva-design-list button,
.layer-row {
  width: 100%;
  justify-content: flex-start;
  margin: 4px 0;
  background: #242b38;
}

.canva-design-list button.active,
.layer-row.active {
  background: #6674ff;
}

.canva-centre {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #0b0e14;
}

.canva-toolbar {
  height: 42px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  color: #cbd5e1;
  font-size: 13px;
}

.canva-stage-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 32px;
  display: grid;
  place-items: start center;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    #0b0e14;
  background-size: 28px 28px;
}

.canva-stage {
  position: relative;
  padding: 24px;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}

.canva-paper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.canva-el {
  position: absolute;
  box-sizing: border-box;
  cursor: move;
  user-select: none;
  overflow: hidden;
  line-height: 1.35;
  color: #111827;
}

.canva-el.selected {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.canva-el img {
  max-width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.resize-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 9px;
  height: 9px;
  background: #38bdf8;
  border-radius: 50%;
  display: none;
}

.canva-el.selected .resize-dot {
  display: block;
}

.canva-preview-button {
  display: inline-block;
  color: #fff;
  padding: 10px 14px;
  font-weight: 800;
}

.canva-pill {
  display: inline-block;
  color: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
}

.image-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: #e5e7eb;
  color: #475569;
  border-radius: 8px;
}

.layers-box {
  max-height: 230px;
  overflow: auto;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 6px;
  background: #0d1017;
}

.layer-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-size: 12px;
}

.layer-row small {
  color: #cbd5e1;
  opacity: .75;
}

.props-box {
  margin-top: 12px;
  background: #0d1017;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px;
}

.props-box label {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  margin: 8px 0;
}

.props-box textarea {
  min-height: 86px;
}

.prop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.danger-btn {
  background: #991b1b;
  width: 100%;
  margin-top: 10px;
}

@media (max-width: 1000px) {
  .canva-grid {
    grid-template-columns: 1fr;
  }

  .canva-left,
  .canva-right {
    border: 0;
    border-bottom: 1px solid #334155;
    max-height: 280px;
  }

  .canva-shell {
    height: auto;
    min-height: calc(100vh - 44px);
  }
}

.designer-modal {
  overflow: auto !important;
  overscroll-behavior: contain;
  padding-bottom: 80px !important;
}

.canva-shell {
  height: auto !important;
  min-height: calc(100vh - 44px) !important;
  max-height: none !important;
  overflow: visible !important;
}

.canva-grid {
  min-height: 820px !important;
}

.canva-left,
.canva-right {
  max-height: calc(100vh - 145px) !important;
  overflow: auto !important;
}

.canva-stage-wrap {
  min-height: 760px !important;
  overflow: auto !important;
}

.custom-mega-modal,
.custom-apply-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(0,0,0,.74);
  overflow: auto;
  padding: 22px;
}

.custom-mega-card,
.custom-apply-card {
  width: min(1180px, 100%);
  margin: 0 auto 60px;
  background: #181c25;
  border: 1px solid #334155;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 30px 100px rgba(0,0,0,.55);
}

.pro-custom-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.pro-custom-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr .6fr .6fr 1fr;
  gap: 8px;
}

.pro-custom-grid label,
.pro-split label,
.apply-fields label {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
}

.pro-split {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 12px;
  margin: 12px 0;
}

.pro-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 900;
  color: #dbeafe;
  margin-bottom: 8px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr .8fr 1fr auto;
  gap: 6px;
  margin-bottom: 6px;
}

#proTemplate {
  min-height: 300px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.custom-tools {
  display: grid;
  gap: 6px;
}

.custom-pro-list {
  margin-top: 8px;
  display: grid;
  gap: 7px;
  max-height: 520px;
  overflow: auto;
}

.custom-pro-card {
  background: #101620;
  border: 1px solid #334155;
  border-left: 5px solid #0891b2;
  border-radius: 12px;
  padding: 7px;
}

.custom-main {
  width: 100%;
  background: transparent;
  padding: 0;
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  text-align: left;
}

.custom-main:hover {
  filter: none;
}

.custom-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #1e293b;
  border-radius: 9px;
}

.custom-main b,
.custom-main small,
.custom-main em {
  display: block;
}

.custom-main small {
  color: #94a3b8;
  font-size: 11px;
  margin-top: 2px;
}

.custom-main em {
  color: #cbd5e1;
  font-size: 11px;
  font-style: normal;
  margin-top: 4px;
}

.custom-card-actions {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}

.custom-card-actions button {
  padding: 5px 7px;
  font-size: 11px;
  background: #263244;
}

.apply-fields {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.sheet-write,
.script-block.sheet-update {
  background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
}

.script-block.sheet-update {
  color: #fff;
}

.script-block.sheet-update .tiny-help {
  color: rgba(255,255,255,.78);
  font-size: 12px;
  margin-top: 8px;
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mini-remove {
  padding: 4px 7px;
  font-size: 11px;
  background: rgba(0,0,0,.22);
}

@media (max-width: 950px) {
  .pro-custom-grid,
  .pro-split,
  .field-row,
  .mini-grid {
    grid-template-columns: 1fr;
  }

  .canva-left,
  .canva-right {
    max-height: none !important;
  }
}

.editor-warning-modal {
  position: fixed;
  inset: 0;
  z-index: 15000;
  display: none;
  place-items: center;
  background: rgba(0,0,0,.75);
  padding: 22px;
}

.editor-warning-modal.show {
  display: grid;
}

.editor-warning-card {
  width: min(560px, 100%);
  background: #171c26;
  border: 1px solid #f59e0b;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 30px 100px rgba(0,0,0,.6);
  color: #f8fafc;
}

.editor-warning-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: rgba(245,158,11,.16);
  border: 1px solid rgba(245,158,11,.45);
  border-radius: 14px;
  font-size: 24px;
  margin-bottom: 10px;
}

.editor-warning-card h2 {
  margin: 0 0 8px;
}

.editor-warning-box {
  background: #0d1017;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 12px;
  margin: 12px 0;
}

.editor-warning-box ol {
  margin: 8px 0 10px 20px;
  padding: 0;
}

.editor-warning-box code {
  display: block;
  white-space: nowrap;
  overflow: auto;
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 9px;
  color: #bfdbfe;
}

.editor-warning-small {
  color: #cbd5e1;
  font-size: 13px;
}

.editor-warning-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}

.editor-access-tip {
  margin-top: 10px;
  background: rgba(245,158,11,.11);
  border: 1px solid rgba(245,158,11,.35);
  border-radius: 12px;
  padding: 10px;
  color: #fde68a;
  font-size: 12px;
  display: grid;
  gap: 3px;
}

.editor-access-tip b {
  color: #fbbf24;
}
