/* Root container for the /web-elements route */
/*from app css*/
/* Web Elements preview card */
.we-preview-card {
  height: 88.5vh;
  display: flex;
  flex-direction: column;
}

/* main preview container */
.preview-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

/* URL bar above iframe */
.we-url-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.we-url-bar input[type="url"] {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 40vw;
  border-radius: 7px;
  background: var(--bgblur);
  padding: 2px 5px;
}

/* iframe stage */
.we-preview-stage {
  position: relative;
  flex: 1 1 auto;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.we-preview-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* device modes */
.preview-wrap[data-device="mobile"] .we-preview-stage iframe {
  width: 390px;
  height: 720px;
  max-width: 100%;
  max-height: 100%;
}

.preview-wrap[data-device="desktop"] .we-preview-stage iframe {
  width: 100%;
  height: 100%;
  zoom: 0.9;
  scrollbar-width: thin;
}

/* overlay container (only visible when expanded) */
.we-overlay {
  pointer-events: all;
  inset: 0;
}

.preview-wrap:not(.expanded) .we-overlay {
  display: none;
}

/* pill with site name */
.we-site-pill {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  z-index: 2;
  backdrop-filter: blur(8px);
}

/* overlay card stack (right side) */
.we-overlay-panel-stack {
  position: absolute;
  top: 12px;
  right: 25px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: calc(100% - 24px);
}

/* base card style */
.we-overlay-card:hover {
  pointer-events: auto;
  background: var(--primary-faded);
  border-radius: 12px;
  opacity:1;
  padding: 10px 12px;
  backdrop-filter: blur(5px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  transition: opacity .5s ease;
  color: var(--text);
  min-width: 220px;
}
.we-overlay-card {
  pointer-events: all;
  background: var(--primary-faded);
  opacity:.12;
  border-radius: 12px;
  padding: 10px 12px;
  backdrop-filter: blur(5px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  color: var(--text);
  min-width: 220px;
  transition: opacity 3s ease-out;
  transition-delay:2000ms;
}
.we-elements-card{min-height:35vh}

.we-overlay-card header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

/* status card */
.we-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(148,163,184,0.4);
  color: #e2e8f0;
  justify-content: space-between;
}

.we-status-pill[data-status="up"] {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}

.we-status-pill[data-status="down"] {
  background: rgba(248, 113, 113, 0.25);
  color: #fecaca;
}

.we-status-pill[data-status="degraded"] {
  background: rgba(251, 191, 36, 0.25);
  color: #fef3c7;
}

.we-uptime-days {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.we-day-pill {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(148,163,184,0.4);
}

.we-day-pill[data-level="ok"] {
  background: rgba(22, 163, 74, 0.5);
}

.we-day-pill[data-level="warn"] {
  background: rgba(245, 158, 11, 0.30);
}

.we-day-pill[data-level="bad"] {
  background: rgba(239, 68, 68, 0.30);
}

/* visitors card sparkline */
.we-sparkline svg {
  display: block;
  width: 100%;
  height: 48px;
}

.we-sparkline path {
  fill: none;
  stroke-width: 1px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke: white;
}

.we-sparkline polygon {
  opacity: 0.85;
}

/* elements list card */
.we-elements-card {
  max-height: 280px;
  overflow-y: auto;
}

.we-elements-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.we-el-item {
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 12px;
}

.we-el-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 4px;
}

.we-el-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.we-el-item-meta-row {
  display: flex;
  justify-content: space-between;
}


/*original*/


.we-route {
  --gap: 16px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* Top headers (per page) */
.we-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 3px;
  padding-top: 2px;
  margin-top: -2px;
}

.we-header-main {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 30px;
  gap: 2px;
  align-items: center;
  justify-content: space-between;
  padding-right: 3px;
}

.we-header-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.we-header-meta {
  font-size: 0.78rem;
  color: var(--muted, #888);
}

.we-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Device toggle button */
.toggle-btn[aria-selected="true"],
.toggle-btn[data-active="true"] {
  background: var(--primary);
  color: #fff;
}

/* Layout grid modes */
.we-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.we-grid[data-device="desktop"] {
  grid-template-columns: 1fr;
}

.we-grid[data-device="tablet"] {
  grid-template-columns: minmax(0, 3fr) minmax(0, 1.5fr);
  gap: 5px;
}

.we-grid[data-device="mobile"] {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 3fr);
  gap: 5px;
}

/* Panels for this route (separate from global .panel) */
.side {
  background: var(--surface);
  border: 1px solid var(--line, #262b33);
  border-radius: 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-faded) transparent;
  height: 91vh;
}
.we-active-grid .side{height:85vh}
.we-iframe-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 0 0 20px 20px;
}
.side.we-sandbox, .side.we-editor{ height:85.1vh}

/* Iframe space (browser-like) */
.we-iframe-side .we-subheader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line, #262b33);
  background: var(--panel-1, #070a10);
}

.we-iframe-side .we-url {
  flex: 1 1 auto;
  min-width: 160px;
  border-radius: 999px;
  border: 1px solid var(--line, #262b33);
  padding: 6px 10px;
  background: #05070c;
  color: inherit;
  font-size: 0.86rem;
}

.we-page-select {
  min-width: 120px;
  max-width: 180px;
  border-radius: 10px;
  border: 1px solid var(--line, #262b33);
  padding: 6px 5px;
  background: var(--surface);
  color: inherit;
  font-size: 0.7rem;
}
.we-grid[data-device="mobile"]{
  .we-page-select{display:none}
  .we-subheader{grid-template-columns: 30px 1fr 40px;}
}
.we-device-toggle{font-size: 20px;display: flex;justify-content: center;}
.we-frame-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 83vh;
  background: #000;
}
.we-site-viewer{height:84.5vh}
.we-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--surface);
  overflow: auto !important;
  scale: .999;
}

/* Shield to make iframe non-interactive */
.we-frame-shield {
  display: none;
  inset: 0;
  z-index: 2;
  background: transparent;
  scrollbar-width: thin;
}

/* Loading dots overlay */
.we-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0.9));
}
.we-preview-loading[hidden]{display:none}
/* Metrics overlay for desktop */
.we-overlay {
  position: absolute;
  top: 2px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: min(240px, 40vw);
  margin: 5px 0 0;
  z-index: 4;
  overflow: auto;
  scrollbar-width: none;
}
.we-browser{display:flex;flex-direction:column;gap: 0;height: 91vh;}
.we-site-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.75);
  font-size: 0.75rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.we-subheader {
    width: 100%;
    display: grid;
    grid-template-columns: 30px 1fr 140px 40px;
    justify-content: space-between;
    gap: 5px;
    border-radius: 20px 20px 0 0;
    background: var(--surface);
    padding: 2px;
    align-items: center;
}
#weUrlInput{background:var(--bg);border-radius:10px;padding: 0 5px;height: 30px;}
input:-internal-autofill-selected{background-color: var(--bg) !important;color: var(--text);font-size: inherit;background: var(--bg) !important;}
/* Overlay metric cards */
.we-card {
  background: var(--primary-faded);
  border:  var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  transition: backdrop-filter 5s ease;
  transition-delay: 2s;
}
.we-card .label, .we-card {color:white !important}
.we-card[hidden]{display:none}
.we-card:hover{
  backdrop-filter: blur(5px) brightness(0.5);
  transition: backdrop-filter 0.52s ease-out;
}

.we-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.we-card-headbar{
  display:flex;
  align-items:center;
  gap: 0;
  flex-wrap: nowrap;
  margin-bottom: 20px;
  justify-content: space-between;
  flex-direction: column;
}
.we-status-headbar{
  display:flex;
  gap:8px;
  flex-wrap: wrap;
  justify-content: space-between;
  flex-direction: row;
  align-items: center;
}
.we-status-header{
  display:flex;
  gap:2px;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.we-status-bottom{
  display:flex;
  justify-content:space-between;
  width: 100%;
  align-items: center;
}
.we-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 5px;
  height: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.58rem;
}

.we-status-pill .label {
  opacity: 0.7;
  font-size: 0.72rem;
}

.we-status-pill .value {
  font-weight: 600;
}

.we-status-pill[data-status="up"] {
  background: rgba(0,180,90,0.5);
  color: #7cffb2;
}

.we-status-pill[data-status="down"] {
  background: rgba(255,60,60,0.2);
  color: #ff9b9b;
}

.we-status-pill[data-status="degraded"] {
  background: rgba(255,200,60,0.2);
  color: #ffe08a;
}

.we-uptime-days {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 6px;
}

.we-day-pill {
  padding: 2px 2px;
  border-radius: 6px;
  font-size: 0.6rem;
  line-height: 1.5;
  background: rgba(255,255,255,0.03);
}

.we-day-pill[data-level="bad"] {
  background: rgba(255,60,60,0.5);
}

.we-day-pill[data-level="warn"] {
  background: rgba(255,200,60,0.5);
}

.we-loadtime {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8rem;
  margin-top: 6px;
}

.we-loadtime .mono {
  opacity: 0.7;
}

.we-loadtime .value {
  font-variant-numeric: tabular-nums;
}

/* Visitors sparkline */
.we-sparkline svg {
  width: 100%;
  height: 40px;
}

/* SEO card */
.we-seo-score {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.we-seo-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.8rem;
}

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

.seo-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.dot-organic {
  background: #4caf50;
}

.dot-social {
  background: #2196f3;
}

.dot-direct {
  background: #9c27b0;
}

/* Inline elements list */
.we-elements-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
}

.we-el-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.we-el-row .badge{height: 40px;background: var(--surface);border-radius: 8px;padding: 4px;color: var(--text);width: 100%;}
.we-el-row-name {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Details side (tablet/mobile) */
.we-details-side {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}

.we-details-card {
  background: var(--primary-faded);
  border-radius: 10px;
  border: var(--line, #262b33);
  padding: 10px;
}

.we-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* KPI grid */
.we-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}

.kpi {
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.04);
  padding: 8px 10px;
}

.kpi-label {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-bottom: 3px;
}

.kpi-num {
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
}

/* PAGE 2: Active Elements */
.we-active-grid {
  display: grid;
  gap: 5px;
  grid-template-columns: minmax(0,3fr) minmax(0,2fr); /* 3fr : 2fr */
}

.we-section-header {
  padding: 1px 12px 0px;
  border-bottom: 1px solid var(--line, #262b33);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.we-el-grid,
.we-lib-grid {
  padding: 10px 12px 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* Active element cards */
.we-el-card {
  position: relative;
  border-radius: 10px;
  border: var(--line);
  background: var(--surface);
  padding: 10px 10px 32px;
  overflow: hidden;
}

.we-el-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.we-el-card-name {
  font-weight: 500;
  font-size: 0.9rem;
}

.we-el-card-meta {
  font-size: 0.75rem;
  opacity: 0.8;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
}

.we-el-card-meta span:first-child {
  opacity: 0.7;
}

/* Hover actions at the bottom */
.we-el-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 6px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.16s ease-out, opacity 0.16s ease-out;
}

.we-el-card:hover .we-el-actions {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Library cards */
.we-lib-card {
  border-radius: 10px;
  border: 1px solid var(--line, #262b33);
  background: var(--surface);
  padding: 8px 10px;
  cursor: pointer;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.we-lib-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

.we-lib-title {
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.we-lib-desc {
  font-size: 0.8rem;
  opacity: 0.75;
}

/* Modal base */
.we-modal {
  position: fixed;
  inset: 0;
  top: 25%;
  left: 40%;
  width: 40vw;
  height: 40vh;
  background: var(--muted);
  border-radius: 20px;
  z-index: 1050;
  display: none;
}

.we-modal[open],
.we-modal[aria-hidden="false"],
.we-modal:not([hidden]) {
  display: block;
  align-content: center;
}

.we-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}

.we-modal-dialog {
  position: relative;
  max-width: 480px;
  margin: 10vh auto;
  background: var(--bg);
  border-radius: 12px;
  border: var(--line, #262b33);
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  overflow: hidden;
}

.we-modal-header,
.we-modal-footer {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line, #262b33);
}
.we-modal-header{height: 5vh;padding: 5px 12px;}
.we-modal-footer {
  border-top: 1px solid var(--line, #262b33);
  border-bottom: 0;
}

.we-modal-body {
  padding: 10px 14px 14px;
  font-size: 0.86rem;
}
.we-modal p{margin: -5px 0 30px 0;}
/* Space options */
.we-space-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.space-opt {
  flex: 1 1 30%;
  padding: 6px 8px;
  font-size: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--line, #262b33);
  background: var(--panel-1, #070a10);
}

.space-opt[data-selected="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.8);
}

/* PAGE 3: Builder layout */
.we-builder-grid {
  display: grid;
  gap: 3px;
  grid-template-columns: minmax(0,2fr) minmax(0,2fr); /* 2fr : 2fr */
}

/* Sandbox */
.we-sandbox-body {
  padding: 10px;
  background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 12px 12px;
  height: 70vh;
  align-content: center;
}

.we-sandbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  gap: 8px;
}

.we-sandbox-cell {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.we-sandbox-cell {
  animation: weHoverFloat 3s ease-in-out infinite;
}

/* Console */
.we-console-footer {
  padding: 8px 10px;
  border-top: 1px solid var(--line, #262b33);
  position: sticky;
  bottom: 0;
  width: 100%;
}

.we-console {
  max-height: 160px;
  overflow-y: auto;
  border-top: 1px solid var(--line, #262b33);
  background: #05070c;
}

.we-console-body {
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
}

/* Builder editor body tweaks */
/* Ensure the editor body takes up all available space in the flex container */
.we-builder-card .editor-body {
  flex: 1; /* Grow to fill space */
  padding: 10px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  min-height: 0; /* Firefox flexbox overflow fix */
}

/* Ensure the back face textareas also scroll/fit */
.we-face.back textarea {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--line, #262b33);
  color: #fff;
  font-family: monospace;
  font-size: 12px;
  resize: none; /* Let flex handle size */
}
.we-face.back label {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-bottom: 8px;
}
.we-face.back label:last-child {
  margin-bottom: 0;
}
.we-face.back label textarea {
  flex: 1;
}

/* Loading dots used inside this route */
.dots-loader {
  display: inline-flex;
  gap: 6px;
}

.dots-loader > span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #fff;
  opacity: 0.8;
  animation: weDot 1.2s infinite ease-in-out;
}

.dots-loader > span:nth-child(2) {
  animation-delay: 0.1s;
}

.dots-loader > span:nth-child(3) {
  animation-delay: 0.2s;
}

@keyframes weDot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Page switching */
.we-page[hidden] {
  display: none !important;
}

.we-route[data-view="preview"]  .we-page[data-page="preview"]  {
  display: block;
}

.we-route[data-view="active"]   .we-page[data-page="active"]   {
  display: block;
  animation: weScaleIn .16s ease-out;
}

.we-route[data-view="builder"]  .we-page[data-page="builder"]  {
  display: block;
  animation: weScaleIn .16s ease-out;
}

@keyframes weScaleIn {
  from { transform: scale(0.98); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Animations */
@keyframes weHoverFloat {
  0%   { transform: translateY(0); box-shadow: 0 12px 30px rgba(0,0,0,0.4); }
  50%  { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0,0,0,0.6); }
  100% { transform: translateY(0); box-shadow: 0 12px 30px rgba(0,0,0,0.4); }
}

/* Responsive tweaks */
.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

@media (max-width: 900px) {
  .desktop-only {
    display: none;
  }
  .mobile-only {
    display: flex;
  }
  .we-active-grid,
  .we-builder-grid {
    grid-template-columns: 1fr;
  }
}
/* Element Builder “sandbox grid” + add buttons */
.we-sandbox-grid{display:grid;gap:12px;width: fit-content;}
.we-sandbox-grid[data-layout="1x1"]{ grid-template-columns:repeat(1, minmax(0,1fr)); }
.we-sandbox-grid[data-layout="1x2"]{ grid-template-columns:repeat(2, minmax(0,1fr)); }
.we-sandbox-grid[data-layout="1x3"]{ grid-template-columns:repeat(3, minmax(0,1fr)); }
.we-sandbox-grid[data-layout="1x4"]{ grid-template-columns:repeat(4, minmax(0,1fr)); }
.we-sandbox-grid[data-layout="2x2"]{ grid-template-columns:repeat(2, minmax(0,1fr)); }
.we-sandbox-grid[data-layout="2x3"]{ grid-template-columns:repeat(3, minmax(0,1fr)); }
.we-sandbox-grid[data-layout="3x3"]{ grid-template-columns:repeat(3, minmax(0,1fr)); }
.we-sandbox-cell{ position:relative; min-height:160px; border:1px dashed var(--line-color,#2a2f3a); border-radius:10px; background:var(--card); display:flex; align-items:center; justify-content:center; }
.we-add-btn{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:auto; }
.we-add-btn button{ border:1px solid var(--line-color,#2a2f3a); background:transparent; border-radius:999px; padding:10px 14px; font-weight:600; cursor:pointer; }
.we-add-btn button:hover{ background:rgba(255,255,255,.06); }

/* Code mode flip */
/* Code mode flip */
.we-builder-wrap { 
  perspective: 1000px; 
  position: relative; 
}

.we-builder-card { 
  /* Removed background from here, moved to faces to prevent transparency issues */
  height: 85.1vh; 
  position: relative; /* Required so children can be absolute */
  border-radius: 15px; 
  transform-style: preserve-3d; 
  transition: transform .36s ease; 
}
/* Keep the builder header interactive above any overlays */
.we-page[data-page="builder"] .we-header {
  position: sticky;
  top: 0;
  z-index: 1000;
}

.we-builder-card[data-mode="code"] { 
  transform: rotateY(180deg); 
}
.we-el-card-preview,
.we-lib-prev { border: 1px solid var(--line, #e5e7eb); border-radius: 10px; overflow: hidden; background: #fff; }
.we-el-card-preview iframe,
.we-lib-prev iframe { width: 100%; height: 220px; display: block; border: 0; }

.we-face { 
  position: absolute; 
  inset: 0; /* Top, left, right, bottom: 0 */
  width: 100%; 
  height: 100%; 
  backface-visibility: hidden; 
  -webkit-backface-visibility: hidden; /* Safari support */
  background: var(--surface); 
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  overflow: hidden; 
  /* CRITICAL FIXES END */
}
.we-face.back { 
  transform: rotateY(180deg); 
  padding: 15px; /* Add padding for the code inputs */
}

.we-sandbox-cell {
  position: relative;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.we-add-btn { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }
.we-add-btn button { cursor:pointer; border-radius:999px; padding:10px 14px; }

/* child element inside a grid slot (not the original) */
.we-child {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px dashed var(--line-color, #2a2f3a);
  border-radius: 10px;
}
.we-remove-child {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; line-height: 24px; text-align: center;
  border: 0; border-radius: 999px; background: rgba(0,0,0,.45); color: #fff; cursor: pointer;
}
.we-remove-child:hover { background: rgba(0,0,0,.65); }

.we-style-group { display: grid; gap: 10px; }
.we-style-card { border: 1px solid var(--line, #262b33); border-radius: 10px; padding: 10px; background: var(--panel-1, #070a10); }

/* Selector Mode Modal */
#weSelectorModal[hidden] { display: none; }
#weSelectorModal {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; grid-template-columns: 240px 1fr; background: rgba(0,0,0,0.6);
}
.we-selector-panel {
  background: var(--panel-1, #0b0f16); padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.we-selector-header { display:flex; align-items:center; justify-content:space-between; }
.we-selector-nav { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; overflow: auto; max-height: calc(100vh - 140px); }
.we-selector-nav li button.link { width: 100%; text-align: left; background: transparent; border: 1px solid var(--line, #262b33); border-radius: 8px; padding: 8px; cursor: pointer; }
.we-selector-nav li button.link:hover { background: rgba(255,255,255,0.06); }
.we-selector-view { position: relative; background: #fff; }
.we-selector-view iframe { width: 100%; height: 100%; border: 0; display:block; cursor: crosshair; }
#weSelectorLoading { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }
#weSelectorLoading[hidden]{ display:none; }

/* Weekly % pill */
.we-percent-pill { display:inline-flex; align-items:center; gap:6px; padding:4px 8px; border-radius:999px; background: rgba(255,255,255,0.08); font-variant-numeric: tabular-nums; }
.we-plugin-fields { display:flex; flex-direction:column; gap:8px; }
.we-plugin-row { display:flex; align-items:center; gap:8px; }
.we-plugin-row .icon { width:28px; display:inline-flex; justify-content:center; }
.we-plugin-row .code { flex:1 1 auto; height:32px; padding:6px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.we-details-card .icon-btn[disabled]{ opacity:.5; cursor:not-allowed; }