
/* Editor de checkout: barra superior de 64px, preview + painel direito de 360px. Só layout; dados e handlers intactos. */
#checkoutView { background:var(--bg); }
#checkoutView .co-bar {
  position:static; height:64px; padding:0 16px; gap:16px; background:var(--card);
  border-bottom:1px solid rgba(255,255,255,.08); display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center;
}
.co-bar-l { display:flex; align-items:center; gap:12px; min-width:0; }
.co-bar .mv-back { width:40px; height:40px; padding:0; justify-content:center; border-radius:6px; flex-shrink:0; }
.co-bar .mv-back span { display:none; }
.co-bar .mv-back:hover { background:rgba(255,255,255,.06); }
.co-bar-ttl { display:flex; flex-direction:column; min-width:0; line-height:1.3; }
.co-bar-name { font-size:14px; font-weight:700; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.co-bar-prod { font-size:12px; color:var(--text-2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.co-bar .cob-select { height:36px; max-width:200px; padding:0 12px; font-size:13px; border-radius:6px; }
.co-bar .cob-dev-top { gap:4px; }
.co-bar .cob-dev-btn { width:44px; height:44px; padding:0; border:0; border-radius:6px; background:transparent; transition:background-color .15s; }
.co-bar .cob-dev-btn:hover { background:rgba(255,255,255,.06); }
.co-bar .cob-dev-btn.active { background:rgba(184,246,253,.16); }
.co-bar .cob-dev-btn.active svg { stroke:#B8F6FD; }
.co-bar .mv-actions { margin-left:0; justify-self:end; gap:8px; }
.co-btn-1, .co-btn-2 {
  height:36px; display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:0 16px; border-radius:6px;
  font:600 14px/1 inherit; font-family:inherit; cursor:pointer; white-space:nowrap; transition:background-color .15s, border-color .15s;
}
.co-btn-1 { min-width:75px; background:#B8F6FD; color:#121635; border:0; }
.co-btn-1:hover { background:var(--accent-hover); }
.co-btn-2 { background:transparent; color:#fff; border:1px solid rgba(145,158,171,.32); }
.co-btn-2:hover { background:rgba(255,255,255,.06); border-color:rgba(145,158,171,.56); }
.co-bar-prev { min-width:109px; }
.co-btn-2 .ncic { width:16px; height:16px; }
.co-savest { font-size:12px; color:#919eab; white-space:nowrap; }
.co-savest.is-error { color:#f87171; }
.co-retry { height:28px; padding:0 10px; border-radius:6px; border:1px solid rgba(248,113,113,.48); background:transparent; color:#f87171; font:600 12px/1 inherit; font-family:inherit; cursor:pointer; white-space:nowrap; }
.co-retry:hover { background:rgba(248,113,113,.12); }
.co-retry[hidden] { display:none; }
/* três áreas: barra, prévia (rolagem própria, fundo #f1f1f1) e painel direito de 360px */
@media (min-width:901px) {
  #checkoutView { overflow:hidden; height:100vh; height:100dvh; }
  #checkoutView .cob-layout { display:flex; flex-direction:row; gap:0; padding:0; overflow:hidden; min-height:0; }
  #checkoutView .cob-preview-col { order:1; flex:1 1 auto; min-width:0; overflow:hidden; }
  #checkoutView .cob-grid {
    order:2; flex:0 0 360px; width:360px; max-width:360px; min-width:0; display:flex; flex-direction:column; gap:16px;
    overflow-y:auto; overflow-x:hidden; padding:0 16px 24px; background:var(--card); border-left:1px solid rgba(255,255,255,.08);
  }
  #checkoutView .cob-preview-stage { flex:1; height:auto; min-height:0; padding:0; background:#f1f1f1; overflow:auto; }
  #checkoutView .cob-preview-frame { border-radius:0; box-shadow:none; background:#fff; }
  /* desktop: largura total da prévia (sem reduzir um PC de 1280px por escala) */
  #checkoutView .cob-preview-frame.dev-desktop {
    position:static !important; width:100% !important; max-width:100% !important; height:100% !important; transform:none !important;
  }
  /* celular: moldura simples de 390px centralizada */
  #checkoutView .cob-preview-frame.dev-mobile {
    width:390px; max-width:390px; height:calc(100% - 48px); margin:24px auto; padding:0; border-radius:8px; background:#fff;
    box-shadow:0 8px 24px rgba(0,0,0,.16);
  }
  #checkoutView .cob-preview-frame.dev-mobile::before, #checkoutView .cob-preview-frame.dev-mobile::after { display:none; }
  #checkoutView .cob-preview-frame.dev-mobile iframe { border-radius:0; }
}
/* painel direito: abas de 48px (ativa em #B8F6FD com indicador de 2px) e tiles de componentes 154x112 */
#checkoutView .cob-tabs {
  position:sticky; top:0; z-index:5; margin:0 -16px 0; padding:0 16px; gap:0; height:48px; border-radius:0;
  background:var(--card); border-bottom:1px solid rgba(255,255,255,.08); flex-shrink:0;
}
#checkoutView .cob-tab {
  flex:1; height:48px; min-height:48px; padding:0 8px; border-radius:0; background:transparent; color:#919eab;
  font-size:14px; font-weight:600; position:relative; transition:color .15s;
}
#checkoutView .cob-tab:hover { color:#cfd8e0; }
#checkoutView .cob-tab.active { background:transparent; color:#B8F6FD; box-shadow:inset 0 -2px 0 #B8F6FD; }
#checkoutView .cob-pane { gap:16px; padding-top:16px; }
#checkoutView .cmp-sec-title { font-size:12px; font-weight:700; color:#919eab; letter-spacing:.5px; margin-bottom:0; }
#checkoutView .cp-hint-sm { font-size:12px; color:#919eab; }
#checkoutView .cmp-grid { grid-template-columns:repeat(2,154px); gap:8px; justify-content:center; }
#checkoutView .cmp-btn, #checkoutView .cmp-x {
  width:154px; min-height:112px; height:112px; padding:12px 8px; gap:8px; border:1px solid rgba(145,158,171,.24); border-radius:6px;
  background:transparent; color:#fff; font-size:13px; font-weight:600; justify-content:center;
  transition:background-color .15s, border-color .15s, transform .15s;
}
#checkoutView .cmp-btn:hover, #checkoutView .cmp-x:hover { background:rgba(255,255,255,.04); border-color:rgba(145,158,171,.48); transform:none; }
#checkoutView .cmp-btn svg, #checkoutView .cmp-x-ico svg { width:32px; height:32px; }
#checkoutView .cmp-x.on { border-color:#B8F6FD; background:rgba(184,246,253,.08); }
#checkoutView .cmp-x { height:auto; min-height:112px; gap:4px; }
#checkoutView .cmp-x-lbl { font-size:13px; }
/* aba Linhas: ainda sem suporte a linhas/colunas, entao os 3 cards ficam desabilitados */
.co-row-card {
  width:100%; max-width:327px; height:118px; margin:0 auto; padding:12px; display:flex; flex-direction:column; gap:8px;
  border:1px solid rgba(145,158,171,.24); border-radius:6px; opacity:.5; cursor:not-allowed; user-select:none;
}
.co-row-prev { flex:1; display:flex; gap:8px; min-height:0; }
.co-row-prev i { display:block; border-radius:4px; background:rgba(145,158,171,.24); }
.co-row-lbl { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:13px; font-weight:600; color:#fff; }
.co-row-soon { font-size:12px; font-weight:500; color:#919eab; }
/* aba Configuracoes: grupos, controles de 40px, swatch 25x25 e toggles 33x20 */
#checkoutView .co-card { background:transparent; border:1px solid rgba(145,158,171,.24); border-radius:6px; padding:16px; }
#checkoutView .co-section-title { font-size:14px; font-weight:700; margin-bottom:12px; padding-bottom:12px; border-bottom:1px solid rgba(255,255,255,.08); }
#checkoutView .cp-label, #checkoutView .cob-label { font-size:14px; font-weight:500; color:#fff; margin-bottom:8px; }
#checkoutView .cp-input, #checkoutView .cob-select, #checkoutView .cob-input { height:40px; min-height:40px; padding:0 12px; border-radius:6px; font-size:14px; }
#checkoutView .cob-field { margin-bottom:16px; }
#checkoutView .toggle-row { font-size:14px; color:#fff; padding:8px 0; border-bottom:1px solid rgba(255,255,255,.08); gap:12px; }
#checkoutView .toggle-row .ncic { width:16px; height:16px; margin-right:8px; vertical-align:-3px; color:#919eab; }
#checkoutView .toggle-row .toggle-sw { margin-left:auto; }
#checkoutView .toggle-sw { width:33px; height:20px; flex-shrink:0; }
#checkoutView .toggle-sl { background:rgba(145,158,171,.48); border-radius:6px; transition:background-color .15s; }
#checkoutView .toggle-sl:before { width:14px; height:14px; left:3px; bottom:3px; border-radius:50%; transition:transform .15s; }
#checkoutView .toggle-sw input:checked + .toggle-sl { background:#B8F6FD; }
#checkoutView .toggle-sw input:checked + .toggle-sl:before { transform:translateX(13px); background:#121635; }
#checkoutView .cob-color-row { gap:12px; }
#checkoutView .cob-color-row input[type=color] { width:25px; height:25px; padding:0; border:0; border-radius:6px; background:none; overflow:hidden; cursor:pointer; flex-shrink:0; }
#checkoutView .cob-color-row input[type=color]::-webkit-color-swatch-wrapper { padding:0; }
#checkoutView .cob-color-row input[type=color]::-webkit-color-swatch { border:1px solid rgba(255,255,255,.24); border-radius:6px; }
#checkoutView .cob-color-row input[type=color]::-moz-color-swatch { border:1px solid rgba(255,255,255,.24); border-radius:6px; }
.co-hex { font-size:14px; font-weight:500; color:#fff; font-variant-numeric:tabular-nums; }
#checkoutView .co-field-row { font-size:14px; }
#checkoutView .co-field-chk { font-size:13px; }
/* o Salvar fica na barra superior */
#checkoutView .co-savebar { display:none; }
/* até 900px: barra continua, painel vira gaveta aberta pelo botão "Personalizar" e a prévia ocupa a tela */
.co-drawer-btn { display:none; }
@media (max-width:900px) {
  #checkoutView .co-bar { grid-template-columns:minmax(0,1fr) auto auto; gap:8px; padding:0 12px; }
  .co-bar-prod, .co-bar-ofpv span, .co-bar .cob-select { display:none; }
  .co-bar-ofpv { padding:0 10px; }
  #checkoutView { overflow:hidden; height:100vh; height:100dvh; }
  #checkoutView .cob-layout { display:flex; flex-direction:row; gap:0; padding:0; overflow:hidden; min-height:0; }
  #checkoutView .cob-preview-col { order:1; flex:1 1 auto; min-width:0; overflow:hidden; }
  #checkoutView .cob-preview-stage { flex:1; height:auto; min-height:0; padding:0; background:#f1f1f1; overflow:auto; }
  #checkoutView .cob-preview-frame { border-radius:0; box-shadow:none; background:#fff; }
  #checkoutView .cob-preview-frame.dev-desktop {
    position:static !important; width:100% !important; max-width:100% !important; height:100% !important; transform:none !important;
  }
  #checkoutView .cob-preview-frame.dev-mobile {
    width:min(390px,100%); max-width:390px; height:calc(100% - 32px); margin:16px auto; padding:0; border-radius:8px;
    box-shadow:0 8px 24px rgba(0,0,0,.16);
  }
  #checkoutView .cob-preview-frame.dev-mobile::before, #checkoutView .cob-preview-frame.dev-mobile::after { display:none; }
  #checkoutView .cob-preview-frame.dev-mobile iframe { border-radius:0; }
  #checkoutView .cob-grid {
    position:fixed; top:64px; right:0; bottom:0; z-index:130; width:min(360px,100vw); max-width:100vw; display:flex; flex-direction:column; gap:16px;
    overflow-y:auto; overflow-x:hidden; padding:0 16px 88px; background:var(--card); border-left:1px solid rgba(255,255,255,.08);
    transform:translateX(100%); visibility:hidden; transition:transform .2s, visibility 0s .2s; order:2;
  }
  #checkoutView .cob-grid.drawer-open { transform:none; visibility:visible; transition:transform .2s; }
  #checkoutView .cmp-grid { grid-template-columns:repeat(2,minmax(0,154px)); }
  #checkoutView .cmp-btn, #checkoutView .cmp-x { width:100%; }
  .co-drawer-btn {
    position:fixed; right:16px; bottom:16px; z-index:140; height:44px; padding:0 20px; display:inline-flex; align-items:center; justify-content:center;
    border:0; border-radius:22px; background:#B8F6FD; color:#121635; font:700 14px/1 inherit; font-family:inherit; cursor:pointer;
    box-shadow:0 8px 24px rgba(0,0,0,.4);
  }
}
@media (max-width:560px) {
  .co-savest { display:none; }
  .co-savest.is-error { display:inline; }
  .co-bar-prev { min-width:0; padding:0 10px; font-size:0; gap:0; }
  .co-bar-prev .ncic { width:16px; height:16px; }
  .co-bar .mv-actions { gap:6px; }
  .co-bar .cob-dev-top { display:none; }
  #checkoutView .co-bar { grid-template-columns:minmax(0,1fr) auto; }
}
