/**
 * Publish wizard (step 4): layout, tokens, charcoal workspace (matches step 3 builder tone).
 * card-ui.css redefines :root — these props on body restore readable marketing/footer tokens.
 */
body.step4-page {
  --bg: #f3f5fb;
  --bg-subtle: #eef1f8;
  --bg-elevated: #ffffff;
  --ink: #070b14;
  --muted: #5b6474;
  --line: rgba(15, 23, 42, 0.07);
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --accent-strong: #3730a3;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  --ui-radius: 14px;
  --ui-radius-card: 20px;
  --ui-input-h: 48px;
  --ui-speed: 0.24s ease;
  --ui-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
  --ui-shadow-hover: 0 18px 34px rgba(79, 70, 229, 0.14);
}

body.step4-page .builder-flow-hero {
  position: relative;
}

body.step4-page .builder-top-right {
  position: absolute;
  top: 0.9rem;
  right: 0.95rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  z-index: 6;
  pointer-events: auto;
}

body.step4-page .builder-flow-hero .builder-flow-icon-nav {
  position: static;
  margin-top: 0;
  display: flex;
  width: 100%;
  justify-content: center;
  gap: 0.35rem;
}

body.step4-page .builder-top-actions {
  position: static;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.28rem;
}

body.step4-page .builder-top-actions__buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.65rem;
}

body.step4-page .builder-top-actions__buttons .btn {
  width: auto;
  max-width: 100%;
  flex: 0 0 auto;
}

body.step4-page .builder-top-actions .helper-top {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted, #5b6474);
  text-align: right;
  max-width: 16rem;
}

body.step4-page .wrap {
  width: min(980px, 92vw);
  margin: 0 auto 2rem;
  padding-top: clamp(0.5rem, 1.5vw, 1rem);
}

body.step4-page .wrap > section.card {
  border-radius: var(--ui-radius-card);
  border: 1px solid rgba(248, 250, 252, 0.12);
  background: #0c0c0f;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  padding: 1.4rem;
  transition: box-shadow var(--ui-speed), border-color var(--ui-speed);
}

body.step4-page .wrap > section.card:hover {
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.42);
  border-color: rgba(129, 140, 248, 0.22);
  transform: none;
}

body.step4-page .grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.1fr 0.9fr;
}

body.step4-page .publish-grid {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 1.25rem;
  align-items: start;
}

body.step4-page .publish-preview-wrap {
  position: sticky;
  top: 5.5rem;
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

body.step4-page .publish-preview-label {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

body.step4-page #publish-card-preview {
  margin-top: 0;
  min-height: 360px;
  width: 100%;
  display: grid;
  place-items: start center;
}

body.step4-page #publish-card-preview .pub-card,
body.step4-page #publish-card-preview .bc-card {
  margin: 0 auto;
  width: 100%;
  max-width: min(100%, 440px);
  transform: scale(0.98);
  transform-origin: top center;
}

body.step4-page .preview.publish-details {
  border: 1px solid rgba(248, 250, 252, 0.1);
  border-radius: var(--ui-radius);
  padding: 1rem;
  background: #141418;
  color: #e2e8f0;
  transition: box-shadow var(--ui-speed), border-color var(--ui-speed);
}

body.step4-page .preview.publish-details:hover {
  border-color: rgba(129, 140, 248, 0.28);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

body.step4-page .publish-details h3 {
  color: #f8fafc;
}

body.step4-page .publish-details #pv-title {
  color: #94a3b8 !important;
}

body.step4-page .meta p {
  margin: 0.4rem 0;
  color: #cbd5e1;
}

body.step4-page .btn {
  min-height: var(--ui-input-h);
  border: none;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  padding: 0.7rem 1rem;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #4338ca 100%);
  transition: transform var(--ui-speed), box-shadow var(--ui-speed), filter var(--ui-speed);
}

body.step4-page .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(79, 70, 229, 0.28);
  filter: saturate(1.04);
}

body.step4-page .btn-secondary {
  background: #1e1e26;
  color: #e2e8f0;
  border: 1px solid rgba(248, 250, 252, 0.16);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.step4-page .btn-secondary:hover {
  border-color: rgba(129, 140, 248, 0.45);
  color: #f8fafc;
}

body.step4-page .actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

body.step4-page .share {
  margin-top: 1rem;
  padding: 0.8rem;
  border: 1px solid rgba(248, 250, 252, 0.12);
  border-radius: var(--ui-radius);
  background: #101014;
  color: #e2e8f0;
}

body.step4-page .share a {
  color: #a5b4fc;
}

body.step4-page .qr-card {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--ui-radius-card);
  border: 1px solid rgba(248, 250, 252, 0.1);
  background: #121218;
  text-align: center;
  color: #e2e8f0;
}

body.step4-page #qr {
  margin: 0.6rem auto 0;
  width: 132px;
  min-height: 132px;
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: var(--ui-radius);
  padding: 8px;
}

body.step4-page .btn-ghost {
  min-height: 44px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  padding: 0.55rem 1rem;
  background: #1a1a22;
  color: #e2e8f0;
  border: 1px solid rgba(248, 250, 252, 0.14);
  transition: transform var(--ui-speed), box-shadow var(--ui-speed), border-color var(--ui-speed);
}

body.step4-page .btn-ghost:hover {
  transform: translateY(-2px);
  border-color: rgba(129, 140, 248, 0.4);
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.15);
}

body.step4-page .profile-menu {
  position: relative;
}

body.step4-page .profile-trigger {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: #1a1a22;
  min-height: 38px;
  padding: 0.3rem 0.62rem;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: #e2e8f0;
}

body.step4-page .mini-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

body.step4-page .profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 170px;
  border-radius: 12px;
  border: 1px solid rgba(248, 250, 252, 0.12);
  background: #141418;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.45);
  padding: 0.35rem;
  display: none;
  z-index: 20;
}

body.step4-page .profile-dropdown.open {
  display: block;
}

body.step4-page .profile-dropdown a,
body.step4-page .profile-dropdown button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  font-size: 0.82rem;
  color: #e2e8f0;
  text-decoration: none;
  cursor: pointer;
}

body.step4-page .profile-dropdown a:hover,
body.step4-page .profile-dropdown button:hover {
  background: rgba(99, 102, 241, 0.18);
  color: #f8fafc;
}

body.step4-page .builder-flow-hint {
  margin: 0.75rem 0 0;
  max-width: 44rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #5b6474;
}

@media (max-width: 900px) {
  body.step4-page .grid {
    grid-template-columns: 1fr;
  }
  body.step4-page .publish-grid {
    grid-template-columns: 1fr;
  }
  body.step4-page .publish-preview-wrap {
    position: static;
    order: 2;
  }
}

@media (max-width: 760px) {
  body.step4-page .builder-flow-hero {
    padding-right: 1.05rem;
  }
  body.step4-page .builder-top-right {
    position: static;
    margin-top: 0.9rem;
    align-items: stretch;
    gap: 0.55rem;
  }
  body.step4-page .builder-flow-icon-nav {
    justify-content: center;
  }
  body.step4-page .builder-top-actions {
    align-items: stretch;
  }
  body.step4-page .builder-top-actions__buttons {
    flex-wrap: wrap;
    justify-content: stretch;
    gap: 0.55rem;
  }
  body.step4-page .builder-top-actions__buttons .btn {
    flex: 1 1 auto;
    min-width: min(100%, 9.5rem);
    white-space: normal;
    text-align: center;
  }
  body.step4-page .builder-top-actions .helper-top {
    text-align: left;
    max-width: none;
  }
}

/* Keep charcoal publish workspace when site dark theme is on (panel-theme .card / .preview overrides). */
html[data-theme="dark"] body.step4-page .wrap > section.card {
  background: #0c0c0f !important;
  border-color: rgba(248, 250, 252, 0.12) !important;
}

html[data-theme="dark"] body.step4-page .preview.publish-details {
  background: #141418 !important;
  border-color: rgba(248, 250, 252, 0.1) !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] body.step4-page .publish-details h3 {
  color: #f8fafc !important;
}

html[data-theme="dark"] body.step4-page .meta p {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] body.step4-page .share {
  background: #101014 !important;
  border-color: rgba(248, 250, 252, 0.12) !important;
  color: #e2e8f0 !important;
}

html[data-theme="dark"] body.step4-page .qr-card {
  background: #121218 !important;
  border-color: rgba(248, 250, 252, 0.1) !important;
}
