.cpb-dashboard-shell {
  --cpb-bg: #f6f7f8;
  --cpb-surface: #ffffff;
  --cpb-surface-2: #f3f4f6;
  --cpb-ink: #101114;
  --cpb-muted: #626975;
  --cpb-soft: #8a919c;
  --cpb-line: #e5e7eb;
  --cpb-line-strong: #d4d8df;
  --cpb-radius: 18px;
  --cpb-radius-sm: 12px;
  --cpb-shadow: 0 10px 26px rgba(15, 23, 42, .055);
  width: 100vw;
  max-width: 100vw;
  min-height: 100vh;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  display: grid;
  grid-template-columns: 260px minmax(520px, 1fr) 390px;
  gap: 20px;
  padding: 22px;
  background: var(--cpb-bg);
  color: var(--cpb-ink);
  overflow-x: hidden;
}
.cpb-dashboard-shell,
.cpb-dashboard-shell * { box-sizing: border-box; }
.cpb-dashboard-shell a { color: inherit; text-decoration: none; }
.cpb-dashboard-sidebar,
.cpb-builder-main,
.cpb-preview-panel { min-width: 0; }
.cpb-dashboard-sidebar,
.cpb-preview-panel {
  position: sticky;
  top: 22px;
  height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid var(--cpb-line);
  border-radius: 22px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--cpb-shadow);
}
.cpb-dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}
.cpb-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.cpb-sidebar-brand span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .06em;
}
.cpb-logo {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.055em;
}
.cpb-dashboard-sidebar p {
  margin: 0;
  color: var(--cpb-muted);
  font-size: 13px;
}
.cpb-dashboard-sidebar .cpb-btn { width: 100%; }
.cpb-dashboard-sidebar .cpb-ad-slot { width: 100%; margin: 0; padding: 0; }
.cpb-upgrade-box,
.cpb-plan-box {
  display: grid;
  gap: 9px;
  padding: 15px;
  border: 1px solid #e4e0d1;
  border-radius: 16px;
  background: #fffdf3;
  color: #42340d;
}
.cpb-plan-box { border-color: #dbe7dd; background: #f4fbf6; color: #17351f; }
.cpb-upgrade-box strong,
.cpb-plan-box strong { display: block; line-height: 1.2; }
.cpb-upgrade-box p,
.cpb-plan-box p { margin: 0; color: inherit; opacity: .78; }
.cpb-upgrade-actions { display: grid; gap: 9px; margin-top: 2px; }
.cpb-upgrade-actions form { display: grid; gap: 6px; margin: 0; }
.cpb-upgrade-actions small { color: inherit; opacity: .72; font-size: 12px; font-weight: 700; line-height: 1.35; }
.cpb-checkout-notice {
  grid-column: 1 / -1;
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid var(--cpb-line);
  background: #fff;
  color: var(--cpb-ink);
  font-weight: 750;
  box-shadow: var(--cpb-shadow);
}
.cpb-checkout-success { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
.cpb-checkout-warning { border-color: #fde68a; background: #fffbeb; color: #713f12; }
.cpb-checkout-error { border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }

.cpb-builder-main { padding: 0 0 50px; }
.cpb-builder-head,
.cpb-builder-section {
  border: 1px solid var(--cpb-line);
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  padding: 22px;
  margin-bottom: 14px;
  box-shadow: var(--cpb-shadow);
}
.cpb-builder-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.cpb-builder-head h1 {
  max-width: 620px;
  margin: 8px 0 8px;
  font-size: clamp(30px, 3.1vw, 42px);
  line-height: 1.02;
  letter-spacing: -.055em;
  text-wrap: balance;
}
.cpb-builder-head p,
.cpb-builder-section-head p {
  max-width: 760px;
  margin: 0;
  color: var(--cpb-muted);
  font-size: 15px;
  line-height: 1.55;
}
.cpb-save-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.cpb-save-status.is-saving { background: #92400e; }
.cpb-save-status.is-saved { background: #166534; }
.cpb-save-status.is-error { background: #991b1b; }
.cpb-builder-section h2 {
  margin: 0 0 7px;
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: -.045em;
}
.cpb-builder-section-head { margin-bottom: 16px; }
.cpb-builder-form label {
  display: grid;
  gap: 7px;
  color: #424955;
  font-size: 13px;
  font-weight: 750;
}
.cpb-builder-form input[type="text"],
.cpb-builder-form input[type="email"],
.cpb-builder-form input[type="url"],
.cpb-builder-form input[type="file"],
.cpb-builder-form select,
.cpb-builder-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--cpb-line-strong);
  border-radius: var(--cpb-radius-sm);
  background: #fff;
  color: var(--cpb-ink);
  padding: 11px 12px;
  font: inherit;
  outline: none;
}
.cpb-builder-form textarea { resize: vertical; min-height: 96px; }
.cpb-builder-form input:focus,
.cpb-builder-form select:focus,
.cpb-builder-form textarea:focus {
  border-color: #111827;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, .08);
}
.cpb-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.cpb-form-grid .cpb-wide { grid-column: 1 / -1; }
.cpb-case-row,
.cpb-faq-row { margin-bottom: 13px; }
.cpb-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 13px;
}
.cpb-check-grid label,
.cpb-publish-row label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--cpb-line);
  border-radius: var(--cpb-radius-sm);
  background: #fafafa;
}
.cpb-check-grid input,
.cpb-publish-row input { width: 16px; height: 16px; accent-color: #111827; }

.cpb-template-select-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.cpb-template-option {
  position: relative;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--cpb-line);
  border-radius: 18px;
  background: #fff;
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.cpb-template-option:hover { transform: translateY(-1px); border-color: #111827; }
.cpb-template-option.is-active { border-color: #111827; box-shadow: 0 0 0 3px rgba(17,24,39,.075); }
.cpb-template-option.is-locked { opacity: .62; cursor: not-allowed; }
.cpb-template-option .cpb-template-thumb { height: 92px; border-radius: 14px; }
.cpb-template-meta { min-width: 0; }
.cpb-template-meta h3 { margin: 7px 0 4px; font-size: 18px; line-height: 1.08; letter-spacing: -.035em; }
.cpb-template-meta p { margin: 0 0 6px; color: var(--cpb-muted); font-size: 13px; line-height: 1.45; }
.cpb-template-meta small { color: var(--cpb-soft); font-weight: 700; }
.cpb-template-option > .cpb-btn { min-height: 36px; padding: 9px 12px; font-size: 13px; white-space: nowrap; }
.cpb-template-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--cpb-surface-2);
  color: var(--cpb-muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.cpb-publish-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.cpb-publish-row label { margin: 0; }

.cpb-preview-panel { padding: 16px; }
.cpb-preview-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.cpb-preview-toggle span {
  margin-right: auto;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--cpb-muted);
}
.cpb-preview-toggle .cpb-btn { min-height: 34px; padding: 8px 10px; font-size: 12px; }
.cpb-live-preview {
  min-height: calc(100vh - 112px);
  border: 1px solid var(--cpb-line);
  border-radius: 20px;
  background: #f9fafb;
  overflow: auto;
  padding: 14px;
}
.cpb-live-preview:empty:before {
  content: "Live preview will appear after editing or applying a preset.";
  display: grid;
  place-items: center;
  min-height: 300px;
  color: var(--cpb-muted);
  text-align: center;
  font-weight: 750;
}
.cpb-live-preview.is-mobile {
  width: min(100%, 390px);
  margin: 0 auto;
}
.cpb-live-preview .cpb-template-hero,
.cpb-live-preview .cpb-public-section,
.cpb-live-preview .cpb-metrics-grid {
  width: 100%;
  max-width: none;
}
.cpb-live-preview .cpb-template-hero { margin-top: 0; padding: 20px; border-radius: 18px; }
.cpb-live-preview .cpb-public-section { padding: 28px 0; }
.cpb-live-preview .cpb-metrics-grid { padding: 0; }
.cpb-live-preview h1 { font-size: 36px; }
.cpb-live-preview h2 { font-size: 28px; }

.cpb-preview-mini {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--cpb-line);
  border-radius: 18px;
  background: #fff;
}
.cpb-preview-avatar {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: #e5e7eb;
  object-fit: cover;
}
.cpb-preview-mini h3 {
  margin: 0;
  font-size: 28px;
  line-height: 1.02;
  letter-spacing: -.052em;
}
.cpb-preview-mini p { margin: 0; color: var(--cpb-muted); }
.cpb-preview-card {
  padding: 13px;
  border: 1px solid var(--cpb-line);
  border-radius: 14px;
  background: #fafafa;
}
.cpb-preview-card strong { display: block; margin-bottom: 5px; }
.cpb-preview-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.cpb-preview-chips span {
  padding: 7px 10px;
  border: 1px solid var(--cpb-line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.cpb-admin-wrap { max-width: 1180px; margin: 24px 20px 24px 0; }
.cpb-admin-grid,
.cpb-admin-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1280px) {
  .cpb-dashboard-shell { grid-template-columns: 248px minmax(0, 1fr); }
  .cpb-preview-panel { position: static; grid-column: 2; height: auto; min-height: 420px; }
  .cpb-live-preview { min-height: 360px; }
}
@media (max-width: 980px) {
  .cpb-dashboard-shell { display: block; padding: 14px; }
  .cpb-dashboard-sidebar,
  .cpb-preview-panel { position: static; height: auto; margin-bottom: 14px; border-radius: 20px; }
  .cpb-dashboard-sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cpb-sidebar-brand { grid-column: 1 / -1; }
  .cpb-builder-head { display: block; }
  .cpb-save-status { margin-top: 14px; }
}
@media (max-width: 760px) {
  .cpb-dashboard-shell { padding: 10px; }
  .cpb-dashboard-sidebar,
  .cpb-builder-head,
  .cpb-builder-section,
  .cpb-preview-panel { padding: 15px; border-radius: 18px; }
  .cpb-dashboard-sidebar,
  .cpb-form-grid,
  .cpb-check-grid,
  .cpb-template-option,
  .cpb-publish-row,
  .cpb-admin-grid,
  .cpb-admin-template-grid { grid-template-columns: 1fr; }
  .cpb-template-option { align-items: stretch; }
  .cpb-template-option .cpb-template-thumb { height: 150px; }
  .cpb-publish-row { display: grid; }
  .cpb-btn { width: 100%; }
}
