/* Farangbazar Builder — medical teal UI (ui-ux-pro-max / Trust & Authority) */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #0B4F6C;
  --primary-dark: #083B52;
  --secondary: #1A8A9D;
  --cta: #059669;
  --accent: #C4A35A;
  --bg: #F0F7F8;
  --sidebar: #0A2540;
  --card: #FFFFFF;
  --border: #D7E5EA;
  --text: #134E4A;
  --muted: #5B7A80;
  --success: #059669;
  --danger: #B91C1C;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(10, 37, 64, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; }
button, .btn, .nav-link, .palette-item, .template-card, .mood-card, .site-card, .tpl-tile-hit, .family-pill, .preview-tab, .preview-device, .idea-chip { cursor: pointer; }
.hidden { display: none !important; }
.fb-icon { display: inline-flex; width: 1.1em; height: 1.1em; align-items: center; justify-content: center; line-height: 0; }
.fb-icon svg { width: 100%; height: 100%; display: block; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #0A2540 0%, #0B4F6C 100%);
  color: #E8F4F6;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 1.25rem;
  font-weight: 800;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-sub { display: block; font-size: 0.75rem; opacity: 0.72; font-weight: 400; margin-top: 0.25rem; }
.sidebar-nav { flex: 1; padding: 0.5rem 0; overflow-y: auto; }
.nav-link {
  display: block; width: 100%; text-align: right;
  padding: 0.75rem 1.25rem; background: none; border: none;
  color: #E8F4F6; font-size: 0.95rem; transition: background .2s var(--ease);
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.1); }
.nav-link.active { border-right: 3px solid var(--accent); }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.1); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: white; border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem; display: flex; justify-content: space-between;
  align-items: center; gap: 1rem; flex-wrap: wrap;
}
.topbar h1 { font-size: 1.15rem; font-weight: 800; color: var(--primary); }
.topbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.content { flex: 1; padding: 1.5rem; overflow: auto; }

.btn {
  padding: 0.65rem 1.1rem; border-radius: 10px; border: none;
  font-size: 0.9rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; transition: transform .2s var(--ease), background .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 8px 20px rgba(11,79,108,.25); }
.btn-primary:hover { background: var(--secondary); }
.btn-ghost { background: white; border: 1px solid var(--border); color: var(--text); }
.btn-success { background: var(--cta); color: white; }
.btn-ghost-light {
  background: transparent; border: 1px solid rgba(255,255,255,0.25);
  color: #E8F4F6; width: 100%; padding: 0.65rem; border-radius: 10px;
}

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.grid-sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.site-card {
  background: white; border: 1px solid var(--border); border-radius: 14px;
  padding: 1.25rem; transition: box-shadow .2s, transform .2s;
}
.site-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.site-card h3 { margin-bottom: 0.35rem; font-weight: 800; }
.site-card .tag { color: var(--muted); font-size: 0.85rem; direction: ltr; text-align: right; }
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge-draft { background: #FEF3C7; color: #B45309; }
.badge-published { background: #D1FAE5; color: var(--success); }

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(26,138,157,.25), transparent 40%),
    linear-gradient(145deg, #0A2540 0%, #0B4F6C 55%, #1A8A9D 100%);
  padding: 1rem;
}
.login-box { background: white; border-radius: 18px; padding: 2rem; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.login-box h2 { text-align: center; margin-bottom: 0.25rem; color: var(--primary); font-weight: 800; }
.login-box .subtitle { text-align: center; color: var(--muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

.wizard { max-width: 1100px; margin: 0 auto; }
.wizard-content { padding: 1.25rem 1.5rem 2rem; }
.wizard-shell .wizard-side-tip {
  margin: 1rem; padding: 1rem; border-radius: 12px;
  background: rgba(255,255,255,.08); font-size: .82rem; line-height: 1.65;
}
.wizard-shell .wizard-side-tip strong { display: block; margin-bottom: .35rem; color: #F3E6C0; }
.wizard-progress {
  height: 6px; background: #D9E6EB; border-radius: 999px; overflow: hidden; margin-bottom: 1rem;
}
.wizard-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 999px; transition: width .35s var(--ease); }
.wizard-step-card { border: 1px solid var(--border); box-shadow: var(--shadow); }
.domain-field label { display: block; font-weight: 700; margin-bottom: .5rem; color: var(--primary); }
.domain-input-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; }
.domain-input-row input {
  flex: 1; min-width: 180px; padding: .75rem 1rem; border: 1px solid var(--border);
  border-radius: 10px; font-size: .95rem; text-transform: lowercase;
}
.domain-status { margin-top: .65rem; font-size: .88rem; font-weight: 600; padding: .55rem .75rem; border-radius: 10px; }
.domain-status.is-ok { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; }
.domain-status.is-bad { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.domain-status.is-pending { background: #FEF9C3; color: #A16207; border: 1px solid #FDE68A; }
.domain-status:not(.is-ok):not(.is-bad):not(.is-pending) { background: #F7FBFC; color: var(--muted); }

.wizard-steps { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.wizard-step {
  flex: 1; min-width: 120px; text-align: center; padding: 0.75rem;
  border-radius: 10px; background: white; border: 1px solid var(--border);
  font-size: 0.85rem; color: var(--muted); font-weight: 600;
}
.wizard-step.active { border-color: var(--primary); color: var(--primary); background: #E6F4F7; }
.wizard-step.done { border-color: var(--success); color: var(--success); }
.wizard-step-num {
  display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem;
  border-radius: 999px; background: #E2E8F0; color: #475569; font-size: 0.75rem; margin-left: 0.35rem;
}
.wizard-step.active .wizard-step-num { background: var(--primary); color: white; }

.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.template-card {
  border: 2px solid var(--border); border-radius: 14px; overflow: hidden;
  background: white; text-align: right; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.template-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.template-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,79,108,0.18); }
.template-preview { height: 120px; display: flex; align-items: center; justify-content: center; color: white; overflow: hidden; position: relative; }
.template-preview img { width: 100%; height: 100%; object-fit: cover; }
.template-info { padding: 0.85rem; }
.template-info h4 { font-size: 0.95rem; margin-bottom: 0.25rem; font-weight: 800; }
.template-info p { font-size: 0.8rem; color: var(--muted); }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: 10px; background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(26,138,157,.18);
}
.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.wizard-actions { display: flex; justify-content: space-between; margin-top: 1.5rem; gap: 1rem; }

.editor-panel { background: white; border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.editor-panel-header { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); font-weight: 700; background: #F7FBFC; font-size: 0.9rem; color: var(--primary); }
.editor-panel-body { padding: 0.75rem; overflow-y: auto; flex: 1; }
.preview-frame { width: 100%; height: 100%; min-height: 560px; border: none; background: white; }
.repeater-item { border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; margin-bottom: 0.5rem; background: #F7FBFC; }
.empty { color: var(--muted); text-align: center; padding: 2rem; font-size: 0.9rem; }
.toast {
  position: fixed; bottom: 24px; left: 24px; background: var(--sidebar); color: white;
  padding: 0.8rem 1.25rem; border-radius: 10px; z-index: 9999; animation: fadeIn .3s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.boot-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; color: var(--muted); }
.boot-spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-inline { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 2rem; color: var(--muted); }
.loading-inline .boot-spinner { width: 24px; height: 24px; }
.error-box { background: #FEF2F2; border: 1px solid #FECACA; color: var(--danger); padding: 1rem; border-radius: 10px; margin: 1rem 0; font-size: 0.9rem; }

.creative-wizard { max-width: 1100px; }
.wizard-hero-card { background: white; border: 1px solid var(--border); border-radius: 18px; padding: 1.5rem; box-shadow: var(--shadow); }
.wizard-eyebrow { font-size: 0.75rem; color: var(--secondary); font-weight: 800; margin-bottom: 0.5rem; }
.wizard-hero-card h2 { font-size: 1.45rem; margin-bottom: 0.5rem; font-weight: 800; color: var(--primary); }
.wizard-lead { color: var(--muted); margin-bottom: 1.25rem; font-size: 0.95rem; }
.wizard-idea-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.idea-chip { border: 1px dashed var(--border); background: #F7FBFC; border-radius: 999px; padding: 0.4rem 0.9rem; font-size: 0.8rem; font-weight: 600; }
.mood-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; }
.mood-card {
  border: 2px solid var(--border); border-radius: 14px; padding: 1rem; background: white;
  text-align: right; display: flex; flex-direction: column; gap: 0.35rem; transition: border-color .2s, box-shadow .2s;
}
.mood-card.selected { border-color: var(--mood, var(--primary)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mood, var(--primary)) 22%, transparent); background: var(--mood-soft, #E6F4F7); }
.mood-swatch { width: 100%; height: 36px; border-radius: 8px; background: linear-gradient(90deg, var(--mood), color-mix(in srgb, var(--mood) 55%, white)); }
.mood-card small { color: var(--muted); font-size: 0.75rem; }
.launch-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
.launch-summary div { background: #F7FBFC; border-radius: 10px; padding: 0.75rem; border: 1px solid var(--border); }
.launch-summary span { display: block; font-size: 0.75rem; color: var(--muted); }

/* Template picker with live preview */
.template-picker { display: grid; grid-template-columns: 300px 1fr; gap: 1rem; min-height: 480px; }
.template-list { display: flex; flex-direction: column; gap: 0.55rem; max-height: 560px; overflow: auto; }
.template-list-item {
  display: grid; grid-template-columns: 72px 1fr; gap: 0.65rem; align-items: center;
  border: 1px solid var(--border); border-radius: 12px; padding: 0.55rem; background: #fff; text-align: right;
}
.template-list-item img { width: 72px; height: 56px; object-fit: cover; border-radius: 8px; }
.template-list-item.selected { border-color: var(--primary); background: #E6F4F7; box-shadow: inset 3px 0 0 var(--primary); }
.template-list-item strong { display: block; font-size: 0.88rem; }
.template-list-item small { color: var(--muted); font-size: 0.72rem; }
.template-live-preview {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #E2E8F0;
  display: flex; flex-direction: column; min-height: 480px;
}
.template-live-preview .preview-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .65rem .85rem; background: #fff; border-bottom: 1px solid var(--border); font-size: .82rem; font-weight: 700;
}
.template-live-stage {
  flex: 1; overflow: auto; background: var(--bg, #F3F7F9);
  transform-origin: top center;
}
.template-live-stage .landing-canvas-root,
.template-live-stage > div { pointer-events: none; }
.template-live-stage .hero-bleed { min-height: 320px; }
.template-live-stage .hero-bleed h1 { font-size: 1.6rem; }
.template-live-stage .section { padding: 2rem 1rem; }

.editor-shell .content.editor-content { padding: 0.75rem; min-height: 0; }
.elementor-layout, .wpb-layout {
  display: grid; grid-template-columns: 220px 1fr 320px; gap: 0.75rem;
  min-height: calc(100vh - 110px); align-items: stretch;
}
.canvas-panel {
  flex: 1; min-height: 0; min-height: 62vh;
  display: flex; flex-direction: column;
}
.canvas-panel > .editor-panel-header { flex-shrink: 0; }
.canvas-pane-wrap, .live-pane-wrap {
  flex: 1; min-height: 360px; display: flex; flex-direction: column;
  background: #D9E6EB; overflow: hidden;
}
.canvas-pane-wrap.hidden, .live-pane-wrap.hidden { display: none !important; }
.canvas-scroll-inner {
  flex: 1; overflow: auto; padding: 1rem;
  max-width: 900px; width: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: 0.85rem;
}
.live-pane-wrap .preview-frame { flex: 1; min-height: 420px; width: 100%; border: none; }
.palette-panel .editor-panel-body { padding: 0.5rem; }
.palette-item {
  width: 100%; display: flex; align-items: center; gap: 0.65rem;
  border: 1px solid var(--border); background: white; border-radius: 12px;
  padding: 0.6rem 0.7rem; margin-bottom: 0.45rem; text-align: right; transition: border-color .2s, background .2s;
}
.palette-item:hover, .palette-item.is-active { border-color: var(--primary); background: #E6F4F7; }
.palette-item.is-on-page { box-shadow: inset 3px 0 0 var(--success); }
.palette-icon {
  width: 34px; height: 34px; border-radius: 9px; color: white;
  display: grid; place-items: center; flex-shrink: 0; background: var(--w, var(--primary));
}
.palette-icon .fb-icon { width: 18px; height: 18px; }
.palette-meta { flex: 1; min-width: 0; }
.palette-meta strong { display: block; font-size: 0.85rem; }
.palette-meta small { color: var(--muted); font-size: 0.7rem; }
.palette-add { color: var(--primary); }
.palette-add .fb-icon { width: 14px; height: 14px; }

.canvas-scroll { background: #D9E6EB; }
#editorCanvas { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.85rem; padding-bottom: 2rem; }

/* WPBakery-like rows */
.wpb-row {
  background: #fff; border: 2px solid transparent; border-radius: 14px; overflow: hidden;
  box-shadow: 0 6px 20px rgba(10,37,64,.08); transition: border-color .2s, box-shadow .2s;
}
.wpb-row.is-collapsed .wpb-viewport { display: none; }
.wpb-row.is-expanded .wpb-viewport { display: block; }
.wpb-row.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,79,108,.16); }
.wpb-row.is-dragging { opacity: .55; }
.wpb-row.drag-over { border-color: var(--success); }
.wpb-controls {
  display: flex; align-items: center; gap: .5rem; padding: .45rem .65rem;
  background: linear-gradient(90deg, #0B4F6C, #1A8A9D); color: #fff; font-size: .82rem;
}
.wpb-label { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.wpb-label strong { font-weight: 700; }
.wpb-label em { opacity: .7; font-style: normal; font-size: .7rem; direction: ltr; margin-right: .25rem; }
.wpb-icon {
  width: 26px; height: 26px; border-radius: 7px; background: var(--w, rgba(255,255,255,.2));
  color: #fff; display: grid; place-items: center;
}
.wpb-icon.lg { width: 36px; height: 36px; border-radius: 10px; }
.wpb-icon .fb-icon { width: 14px; height: 14px; }
.wpb-icon.lg .fb-icon { width: 18px; height: 18px; }
.wpb-actions { margin-right: auto; display: flex; gap: .3rem; }
.wpb-btn {
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff;
  border-radius: 8px; min-height: 32px; padding: .25rem .55rem; display: inline-flex; align-items: center; gap: .25rem;
  font-size: .75rem; font-weight: 600;
}
.wpb-btn:hover { background: rgba(255,255,255,.22); }
.wpb-btn.drag-handle { cursor: grab; user-select: none; touch-action: none; }
.wpb-btn.drag-handle:active { cursor: grabbing; }
.wpb-edit { background: #fff !important; color: var(--primary) !important; border-color: #fff !important; min-width: 40px; }
.wpb-viewport { background: var(--bg); max-height: none; overflow: auto; border-top: 1px solid rgba(10,37,64,.06); }
.wpb-viewport .site-header { position: static; }
.canvas-empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.canvas-empty-icon { width: 48px; height: 48px; margin: 0 auto .75rem; color: var(--primary); }
.canvas-empty-icon .fb-icon { width: 48px; height: 48px; }

.inspector-head { display: flex; gap: 0.75rem; align-items: flex-start; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.inspector-head .muted { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.inspector-actions { margin-top: 1rem; }
.inspector-actions .btn { width: 100%; }
.seg-toggle { display: inline-flex; background: #E8F1F3; border-radius: 10px; padding: 3px; }
.seg-toggle button { border: none; background: transparent; padding: 0.45rem 0.8rem; border-radius: 8px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.seg-toggle button.active { background: white; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.muted { color: var(--muted); font-size: 0.8rem; font-weight: 400; }

@media (max-width: 1100px) {
  .elementor-layout, .wpb-layout, .template-picker { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .launch-summary { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Mavis wizard — template pick + theme */
.mavis-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  max-height: 52vh;
  overflow-y: auto;
  padding: 0.25rem;
}
.mavis-template-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.65rem;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 0.55rem;
  background: #fff;
  text-align: right;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.mavis-template-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.mavis-template-card.selected { border-color: var(--card-accent, var(--primary)); box-shadow: 0 0 0 3px rgba(8,145,178,.15); }
.mavis-card-thumb { height: 56px; border-radius: 10px; }
.mavis-card-body strong { display: block; font-size: 0.86rem; }
.mavis-card-body small { color: var(--muted); font-size: 0.72rem; }
.mavis-badge {
  display: inline-block;
  font-style: normal;
  font-size: 0.65rem;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
  margin-bottom: 0.2rem;
}
.template-family-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.family-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #E8F1F3;
  color: var(--muted);
}
.family-pill.active { background: var(--primary); color: #fff; }
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.55rem;
}
.palette-swatch {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem;
  background: #fff;
  cursor: pointer;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: border-color .2s;
}
.palette-swatch i {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
}
.palette-swatch span { font-size: 0.75rem; font-weight: 700; color: var(--text); }
.palette-swatch.selected { border-color: var(--sw, var(--primary)); box-shadow: 0 0 0 2px rgba(8,145,178,.2); }
.theme-label { display: block; font-weight: 800; font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--primary); }
.theme-section { margin-bottom: 1.25rem; }
.mode-toggle { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem; }
@media (min-width: 900px) { .mode-toggle { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) { .mode-toggle { grid-template-columns: 1fr; } }
.theme-live-stage .preview-live-frame {
  width: 100%;
  min-height: 520px;
  height: 100%;
  border: 0;
  background: #fff;
}
.mode-btn {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fff;
  text-align: right;
  cursor: pointer;
}
.mode-btn strong { display: block; font-size: 0.9rem; }
.mode-btn small { color: var(--muted); font-size: 0.72rem; }
.mode-btn.selected { border-color: var(--primary); background: #E6F4F7; }
.theme-mini-preview {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.theme-mini-bar { height: 8px; }
.theme-mini-body {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
}
.theme-mini-body i { width: 48px; height: 8px; border-radius: 4px; display: block; }
.mode-preview-light { background: #F3F7F9; color: #134E4A; }
.mode-preview-dim { background: #1C3044; color: #E8F1F5; }
.mode-preview-dark { background: #071521; color: #E8F1F5; }

.builder-version-pill {
  margin: 0 1rem 0.75rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  font-size: 0.72rem;
  font-weight: 700;
  color: #A7F3D0;
  line-height: 1.5;
  text-align: center;
}

/* ═══ Premium wizard shell ═══ */
.wizard-shell-premium .main {
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(26, 138, 157, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(11, 79, 108, 0.08), transparent),
    var(--bg);
}
.wizard-premium { max-width: 1280px; }
.wizard-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.wizard-step-head h2 { margin-bottom: 0.35rem; }
.template-family-tabs .family-pill {
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, color .2s, transform .2s;
}
.template-family-tabs .family-pill:hover { transform: translateY(-1px); }

.premium-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  max-height: 58vh;
  overflow-y: auto;
  padding: 0.25rem;
}
.premium-tpl-card {
  border: 2px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 0;
  overflow: hidden;
  text-align: right;
  cursor: pointer;
  transition: border-color .25s, box-shadow .25s, transform .25s;
  box-shadow: 0 4px 20px rgba(10,37,64,.06);
}
.premium-tpl-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(10,37,64,.12); }
.premium-tpl-card.selected {
  border-color: var(--accent, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, var(--primary)) 25%, transparent);
}
.tpl-browser-chrome {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border);
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 700;
}
.tpl-browser-chrome i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}
.tpl-browser-chrome i:first-child { background: #f87171; }
.tpl-browser-chrome i:nth-child(2) { background: #fbbf24; }
.tpl-browser-chrome i:nth-child(3) { background: #34d399; }
.tpl-browser-chrome span { margin-right: auto; direction: ltr; opacity: .7; }
.tpl-browser-view {
  height: 140px;
  background-size: cover;
  background-position: center top;
  position: relative;
}
.tpl-browser-view::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(255,255,255,.9));
}
.tpl-card-meta {
  padding: 0.75rem 0.85rem;
  position: relative;
}
.tpl-card-meta strong { display: block; font-size: 0.9rem; font-weight: 800; }
.tpl-card-meta small { color: var(--muted); font-size: 0.72rem; }
.mavis-badge {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.wizard-theme-split {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 1rem;
  align-items: stretch;
}
@media (max-width: 960px) {
  .wizard-theme-split { grid-template-columns: 1fr; }
}
.wizard-theme-controls { margin: 0; }
.palette-grid--compact {
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
}
.palette-grid--compact .palette-swatch {
  padding: 0.35rem;
  justify-content: center;
}
.palette-grid--compact .palette-swatch i {
  width: 100%;
  height: 32px;
  border-radius: 8px;
}
.palette-grid--compact .palette-swatch span { display: none; }
.palette-active-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 0.5rem;
}
.wizard-live-theme-panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: #e2e8f0;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  box-shadow: var(--shadow);
}
.live-panel-toolbar {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
  font-size: 0.85rem;
}
.theme-live-stage {
  flex: 1;
  overflow: auto;
  transform-origin: top center;
}
.theme-preview-root .site-header { position: relative; }
.theme-preview-root .mavis-hero { min-height: 280px; }
.theme-preview-root .hero-bleed h1 { font-size: 1.35rem; }
.theme-preview-root .stats-bar { margin-top: 0; }
.theme-preview-root .mavis-partners { display: none; }

.template-card-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
.template-card-wrap.selected .premium-tpl-card { box-shadow: 0 0 0 3px rgba(11,79,108,0.2); }
.btn-template-preview {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  width: 100%; padding: 0.55rem 0.75rem; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; color: var(--text); font-family: inherit;
  font-size: 0.85rem; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.btn-template-preview:hover { border-color: var(--primary); background: #E6F4F7; }
.template-preview-modal {
  position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; padding: 1rem;
}
.template-preview-modal.open { display: flex; }
.template-preview-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,0.55); }
.template-preview-dialog {
  position: relative; width: min(1100px, 96vw); height: min(85vh, 900px);
  background: #fff; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
}
.template-preview-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); background: #f8fafc;
}
.template-preview-actions { display: flex; gap: 0.5rem; }
.template-preview-dialog iframe { flex: 1; width: 100%; border: none; background: #fff; }
.btn-sm { font-size: 0.8rem; padding: 0.4rem 0.75rem; }

/* ═══ Wizard flow v2 — step-by-step install ═══ */
.wizard-flow { display: flex; flex-direction: column; gap: 1rem; }
.wizard-topbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.25rem 1.5rem; border-radius: 20px;
  background: linear-gradient(135deg, #fff 0%, #f0fdfa 100%);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.wizard-kicker {
  display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em;
  color: var(--secondary); margin-bottom: 0.35rem;
}
.wizard-topbar-title { font-size: 1.55rem; font-weight: 800; color: var(--primary); margin-bottom: 0.25rem; }
.wizard-topbar-sub { color: var(--muted); font-size: 0.92rem; max-width: 36rem; }
.wizard-topbar-progress { position: relative; width: 56px; height: 56px; flex-shrink: 0; }
.wizard-fraction {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; color: var(--primary); font-size: 1rem;
}
.wizard-fraction small { font-size: 0.72rem; color: var(--muted); font-weight: 700; }
.wizard-ring { width: 56px; height: 56px; transform: rotate(-90deg); }
.wizard-ring-bg { fill: none; stroke: #d9e6eb; stroke-width: 3; }
.wizard-ring-fill {
  fill: none; stroke: var(--secondary); stroke-width: 3; stroke-linecap: round;
  transition: stroke-dasharray .35s var(--ease);
}

.wizard-stepper { margin-bottom: 0.25rem; overflow-x: auto; padding-bottom: 0.25rem; }
.wizard-stepper-list {
  display: flex; align-items: stretch; gap: 0; min-width: min(100%, 920px);
  list-style: none; margin: 0; padding: 0;
}
.wizard-stepper-item {
  flex: 1; min-width: 108px; position: relative; display: flex; flex-direction: column;
  align-items: center; text-align: center; gap: 0.55rem; padding: 0 0.35rem 0.5rem;
}
.wizard-stepper-item:not(:last-child)::after {
  content: ''; position: absolute; top: 18px; left: calc(50% + 18px); width: calc(100% - 36px);
  height: 2px; background: #d9e6eb; z-index: 0;
}
.wizard-stepper-item.done:not(:last-child)::after { background: linear-gradient(90deg, var(--success), #6ee7b7); }
.wizard-stepper-item.active:not(:last-child)::after {
  background: linear-gradient(90deg, var(--secondary), #d9e6eb);
}
.wizard-stepper-node {
  position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 999px;
  display: grid; place-items: center; background: #fff; border: 2px solid #d9e6eb;
  color: var(--muted); font-weight: 800; font-size: 0.82rem;
  transition: border-color .25s, background .25s, color .25s, box-shadow .25s;
}
.wizard-stepper-item.active .wizard-stepper-node {
  border-color: var(--primary); color: #fff; background: var(--primary);
  box-shadow: 0 8px 20px rgba(11, 79, 108, 0.22);
}
.wizard-stepper-item.done .wizard-stepper-node {
  border-color: var(--success); background: #ecfdf5; color: var(--success);
}
.wizard-stepper-check svg { width: 18px; height: 18px; }
.wizard-stepper-copy strong { display: block; font-size: 0.78rem; font-weight: 800; color: var(--text); }
.wizard-stepper-copy small { display: block; font-size: 0.68rem; color: var(--muted); line-height: 1.35; }
.wizard-stepper-item.pending .wizard-stepper-copy strong { color: var(--muted); }

.wizard-body { min-height: 200px; }
.wizard-body-enter { animation: wizardStepIn .35s var(--ease); }
@keyframes wizardStepIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wizard-body-enter { animation: none; }
  .wizard-stepper-node, .wizard-progress i, .wizard-ring-fill { transition: none; }
}

.wizard-step-banner {
  display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1rem;
  padding-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.wizard-step-banner-icon {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center; color: var(--primary);
  background: linear-gradient(135deg, #e6f4f7, #f0fdfa);
  border: 1px solid var(--border);
}
.wizard-step-banner-icon svg { width: 24px; height: 24px; }
.wizard-step-banner .wizard-eyebrow { margin-bottom: 0.25rem; }
.wizard-step-banner h2 { font-size: 1.25rem; margin-bottom: 0.15rem; }
.wizard-step-banner .wizard-lead { margin-bottom: 0; font-size: 0.88rem; }
.wizard-subcopy { color: var(--muted); margin: -0.35rem 0 1.15rem; font-size: 0.92rem; }

.wizard-chips-label {
  display: block; width: 100%; font-size: 0.72rem; font-weight: 700; color: var(--muted); margin-bottom: 0.45rem;
}
.idea-chip {
  transition: border-color .2s, background .2s, transform .2s;
}
.idea-chip:hover { border-color: var(--secondary); background: #e6f4f7; transform: translateY(-1px); }
.idea-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.segment-card {
  flex-direction: row; align-items: center; gap: 0.75rem; min-height: 64px;
}
.segment-card-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; color: var(--primary);
  background: #f0fdfa; border: 1px solid var(--border);
}
.segment-card-icon svg { width: 22px; height: 22px; }
.segment-card.selected .segment-card-icon {
  background: var(--primary); color: #fff; border-color: transparent;
}

.wizard-actions-bar {
  position: sticky; bottom: 0; z-index: 5;
  margin-top: 0.5rem; padding: 1rem 1.25rem;
  border-radius: 16px; background: rgba(255,255,255,0.92);
  border: 1px solid var(--border); backdrop-filter: blur(10px);
  box-shadow: 0 -8px 30px rgba(10, 37, 64, 0.06);
  align-items: center;
}
.wizard-actions-center { flex: 1; text-align: center; padding: 0 0.75rem; }
.wizard-actions-center .form-hint { margin: 0; min-height: 1.2em; }
.btn-wizard-next { min-width: 160px; }

.wizard-sidebar .sidebar-nav { margin-top: auto; }
.wizard-side-progress { padding: 0 1rem 1rem; }
.wizard-side-progress-label {
  display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 0.4rem;
  color: rgba(255,255,255,0.75);
}
.wizard-side-progress-label strong { color: #a7f3d0; }
.wizard-side-progress-bar {
  height: 6px; border-radius: 999px; background: rgba(255,255,255,0.12); overflow: hidden;
}
.wizard-side-progress-bar i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #34d399, #6ee7b7);
  transition: width .35s var(--ease);
}
.wizard-side-steps {
  list-style: none; margin: 0 0 1rem; padding: 0 0.75rem; display: flex; flex-direction: column; gap: 0.35rem;
}
.wizard-side-step {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 0.55rem; align-items: center;
  padding: 0.55rem 0.65rem; border-radius: 12px; border: 1px solid transparent;
  transition: background .2s, border-color .2s;
}
.wizard-side-step.active {
  background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.14);
}
.wizard-side-step.done { opacity: 0.85; }
.wizard-side-step-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255,255,255,0.08); color: #cbd5e1;
}
.wizard-side-step.active .wizard-side-step-icon { background: rgba(52, 211, 153, 0.2); color: #6ee7b7; }
.wizard-side-step.done .wizard-side-step-icon { color: #86efac; }
.wizard-side-step-icon svg { width: 18px; height: 18px; }
.wizard-side-step-text strong { display: block; font-size: 0.78rem; color: #e8f4f6; }
.wizard-side-step-text small { display: block; font-size: 0.65rem; color: rgba(255,255,255,0.55); line-height: 1.35; }
.wizard-side-step-done svg { width: 16px; height: 16px; color: #6ee7b7; }

@media (max-width: 1024px) {
  .wizard-shell-premium .sidebar.wizard-sidebar { display: none; }
  .wizard-stepper-copy small { display: none; }
}
@media (max-width: 768px) {
  .wizard-topbar { flex-direction: column; padding: 1rem; border-radius: 16px; }
  .wizard-topbar-progress { align-self: flex-end; }
  .wizard-stepper-item { min-width: 72px; }
  .wizard-stepper-copy strong { font-size: 0.68rem; }
  .wizard-step-banner { flex-direction: column; }
  .wizard-actions-bar { flex-wrap: wrap; gap: 0.75rem; }
  .wizard-actions-center { order: 3; width: 100%; }
  .btn-wizard-next { width: 100%; }
  .launch-summary { grid-template-columns: 1fr 1fr; }
  .template-picker { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .wizard-stepper-copy { display: none; }
  .wizard-stepper-item { min-width: 44px; }
}

/* ═══ Marketplace onboarding (v20260910) ═══ */
.wizard-marketplace { max-width: 1280px; }
.wizard-marketplace .wizard-topbar {
  background: linear-gradient(135deg, #ffffff 0%, #f4fbfc 55%, #f7f4ea 100%);
}
.wizard-marketplace .wizard-stepper-copy small { display: none; }
.wiz-focus { max-width: 720px; margin: 0 auto; }
.wiz-wide { width: 100%; }
.wiz-name-field input {
  font-size: 1.25rem; font-weight: 700; min-height: 56px; padding: 0.9rem 1.1rem;
}
.brand-live {
  margin: 1.25rem 0 1rem; padding: 1.5rem 1.35rem;
  border-radius: 18px; color: #fff; text-align: right;
  background:
    linear-gradient(135deg, rgba(11,79,108,.92), rgba(26,138,157,.88)),
    radial-gradient(circle at 80% 20%, rgba(196,163,90,.45), transparent 42%);
  box-shadow: 0 16px 40px rgba(10,37,64,.16);
}
.brand-live-kicker {
  display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: .04em;
  opacity: .8; margin-bottom: .5rem;
}
.brand-live h3 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; line-height: 1.35; margin: 0 0 .4rem; }
.brand-live p { margin: 0; opacity: .85; font-size: .9rem; }
.seg-group { margin-bottom: 1.5rem; }
.seg-group-title {
  font-size: .78rem; font-weight: 800; color: var(--muted);
  margin: 0 0 .75rem; letter-spacing: .02em;
}
.segment-card { position: relative; transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease); }
.segment-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.segment-card.selected { border-color: var(--primary); background: #e8f6f8; }
.seg-check {
  margin-right: auto; width: 22px; height: 22px; color: var(--success);
  display: grid; place-items: center;
}
.seg-check svg { width: 18px; height: 18px; }

.tpl-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem;
  margin-bottom: 1.25rem;
}
.tpl-toolbar-copy { margin: 0; max-width: 28rem; }
.tpl-showcase {
  margin-bottom: 1.75rem;
}
.tpl-showcase-head h3 { font-size: 1.05rem; font-weight: 800; color: var(--primary); margin: 0 0 .2rem; }
.tpl-showcase-head p { margin: 0 0 1rem; color: var(--muted); font-size: .88rem; }
.tpl-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.tpl-gallery-title { font-size: .95rem; font-weight: 800; color: var(--primary); margin: 0 0 .85rem; }
.wizard-marketplace .premium-template-grid,
.wizard-step-premium .premium-template-grid,
.wizard-step-premium .tpl-gallery-grid,
.tpl-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  max-height: none;
  overflow: visible;
  padding: 0;
  width: 100%;
}
.wizard-step-premium .tpl-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}
.tpl-tile {
  position: relative;
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  background: #fff; border: 2px solid var(--border);
  box-shadow: 0 10px 28px rgba(10,37,64,.07);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
  animation: tplIn .4s var(--ease) both;
  min-width: 0;
}
.tpl-tile:nth-child(1) { animation-delay: .02s; }
.tpl-tile:nth-child(2) { animation-delay: .06s; }
.tpl-tile:nth-child(3) { animation-delay: .1s; }
.tpl-tile:nth-child(4) { animation-delay: .14s; }
.tpl-tile:nth-child(5) { animation-delay: .18s; }
.tpl-tile:nth-child(6) { animation-delay: .22s; }
.tpl-tile:hover { transform: translateY(-4px); box-shadow: 0 18px 44px rgba(10,37,64,.14); }
.tpl-tile.selected {
  border-color: var(--accent, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, var(--primary)) 28%, transparent), 0 18px 44px rgba(10,37,64,.12);
}
.tpl-tile-hit {
  display: block; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; text-align: right; color: inherit;
  position: relative;
}
.tpl-tile-media {
  position: relative; overflow: hidden; background: linear-gradient(160deg, var(--accent, #0B4F6C), #0A2540);
  aspect-ratio: 16 / 10;
}
.tpl-tile.lead .tpl-tile-media { aspect-ratio: 4 / 3; min-height: 220px; }
.tpl-tile-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: center top;
  display: block; transition: transform .35s var(--ease);
}
.tpl-tile:hover .tpl-tile-media img { transform: scale(1.06); }
.tpl-tile-media img.is-missing { display: none; }
.tpl-tile-overlay {
  position: absolute; inset: auto 0 0 0; padding: 1.1rem 1rem .95rem;
  background: linear-gradient(180deg, transparent, rgba(8, 28, 40, .88));
  color: #fff; text-align: right;
  pointer-events: none;
  z-index: 1;
}
.tpl-tile-overlay strong { display: block; font-size: 1rem; font-weight: 800; line-height: 1.4; }
.tpl-tile.lead .tpl-tile-overlay strong { font-size: 1.15rem; }
.tpl-tile-overlay small { display: block; opacity: .85; font-size: .75rem; margin-top: .15rem; }
.tpl-pack-badge {
  display: inline-block; margin-bottom: .4rem; padding: .15rem .55rem;
  border-radius: 999px; font-style: normal; font-size: .68rem; font-weight: 800;
  background: #C4A35A; color: #1a1408; letter-spacing: .02em;
}
.tpl-tile-bar {
  flex-shrink: 0; position: relative; z-index: 2;
  padding: .55rem .7rem .7rem; background: #fff; border-top: 1px solid var(--border);
}
.tpl-tile-bar .btn-template-preview {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  width: 100%; min-height: 44px; border-radius: 10px;
  border: 1px solid var(--border); background: #e8f6f8; color: var(--primary);
  font-family: inherit; font-size: .82rem; font-weight: 700;
  transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.tpl-tile-bar .btn-template-preview:hover {
  border-color: var(--primary); background: #E6F4F7;
}
.tpl-tile-bar .btn-template-preview svg { width: 16px; height: 16px; }
.tpl-tile-preview-fab {
  position: absolute; top: .65rem; left: .65rem; z-index: 3;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .65rem; border-radius: 999px; border: 0;
  background: rgba(255,255,255,.94); color: var(--primary);
  font-family: inherit; font-size: .72rem; font-weight: 800;
  box-shadow: 0 8px 22px rgba(10,37,64,.18);
  opacity: 1; transform: translateY(0);
  transition: opacity .2s var(--ease), transform .2s var(--ease), background .2s var(--ease);
}
.tpl-tile-preview-fab svg { width: 14px; height: 14px; }
.tpl-tile-preview-fab:hover { background: #fff; transform: translateY(-1px); }
.tpl-tile-preview-fab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tpl-tile:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }

.wiz-empty {
  text-align: center; padding: 3rem 1.25rem; background: #fff; border: 1px dashed var(--border);
  border-radius: 18px; color: var(--muted);
}
.wiz-empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto .75rem; color: var(--primary); background: #e8f6f8; border-radius: 16px; }
.wiz-empty-icon svg { width: 28px; height: 28px; }
.wiz-empty strong { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: .35rem; }
.wiz-empty p { margin: 0 0 1rem; }
.wiz-footer-meta { margin: .15rem 0 0; font-size: .78rem; font-weight: 700; color: var(--primary); min-height: 1.1em; }
.btn-wizard-next { min-width: 200px; gap: .4rem; }
.btn-wizard-next svg { width: 18px; height: 18px; }
.btn-wizard-next.btn-success { box-shadow: 0 8px 22px rgba(5,150,105,.28); }
.btn-wizard-next:focus-visible, .btn:focus-visible, .family-pill:focus-visible,
.segment-card:focus-visible, .idea-chip:focus-visible, input:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}

.preview-studio {
  display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 1rem; align-items: stretch;
  min-height: 520px;
}
.preview-meta {
  background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 1.1rem;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .65rem;
}
.preview-meta-thumb {
  border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 10;
  background: linear-gradient(160deg, var(--accent, #0B4F6C), #0A2540);
}
.preview-meta-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.preview-meta-thumb img.is-missing { display: none; }
.preview-meta h3 { font-size: 1.05rem; font-weight: 800; color: var(--primary); margin: 0; }
.preview-facts { list-style: none; margin: .25rem 0; padding: 0; display: grid; gap: .45rem; }
.preview-facts li {
  display: flex; justify-content: space-between; gap: .5rem; padding: .45rem .55rem;
  background: #F7FBFC; border-radius: 10px; border: 1px solid var(--border); font-size: .82rem;
}
.preview-facts span { color: var(--muted); }
.preview-reassure { font-size: .82rem; color: var(--muted); line-height: 1.65; margin: 0; }
.preview-stage {
  background: #d7e3e8; border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column; min-height: 480px; box-shadow: var(--shadow);
}
.preview-stage .preview-toolbar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .65rem .85rem; background: #fff; border-bottom: 1px solid var(--border);
}
.preview-tabs { display: inline-flex; background: #E8F1F3; border-radius: 10px; padding: 3px; }
.preview-tab {
  border: 0; background: transparent; padding: .4rem .8rem; border-radius: 8px;
  font-size: .8rem; font-weight: 700; color: var(--muted); font-family: inherit;
  transition: background .2s, color .2s;
}
.preview-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.preview-devices { display: inline-flex; gap: .25rem; margin-right: auto; }
.preview-device {
  width: 40px; height: 40px; border: 1px solid var(--border); background: #fff; border-radius: 10px;
  color: var(--muted); display: grid; place-items: center;
}
.preview-device svg { width: 18px; height: 18px; }
.preview-device.active { border-color: var(--primary); color: var(--primary); background: #e8f6f8; }
.preview-viewport {
  flex: 1; min-height: 420px; background: #0b1c24; display: flex; justify-content: center; overflow: auto;
}
.preview-viewport.is-mobile { padding: 1rem 0; }
.preview-shot, .preview-live-frame {
  width: 100%; min-height: 420px; border: 0; background: #fff; display: block;
}
.preview-shot img { width: 100%; display: block; object-fit: cover; object-position: top center; min-height: 420px; }
.preview-viewport.is-mobile .preview-shot,
.preview-viewport.is-mobile .preview-live-frame {
  width: min(390px, 100%); border-radius: 16px; overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,.28);
}

.launch-ticket {
  background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--shadow);
}
.launch-url {
  display: flex; align-items: baseline; justify-content: center; gap: .15rem; flex-wrap: wrap;
  margin: .25rem 0 1.25rem; padding: 1rem 1.1rem; border-radius: 14px;
  background: #0A2540; color: #E8F4F6; font-size: 1.05rem;
}
.launch-url span { opacity: .55; font-weight: 600; }
.launch-url strong { font-weight: 800; word-break: break-all; color: #F3E6C0; }
.launch-ticket .launch-summary { grid-template-columns: 1fr 1fr; }

.device-frame { position: relative; }

@keyframes tplIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1024px) {
  .tpl-showcase-grid,
  .wizard-step-premium .tpl-showcase-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tpl-tile.lead .tpl-tile-media { min-height: 180px; }
  .preview-studio { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .wiz-name-field input { font-size: 1.05rem; }
  .brand-live { padding: 1.15rem 1rem; }
  .tpl-showcase-grid,
  .wizard-step-premium .tpl-showcase-grid,
  .tpl-gallery-grid,
  .wizard-marketplace .premium-template-grid,
  .wizard-step-premium .tpl-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .launch-url { font-size: .92rem; }
  .btn-wizard-next { width: 100%; min-width: 0; }
}
@media (max-width: 560px) {
  .tpl-showcase-grid,
  .wizard-step-premium .tpl-showcase-grid,
  .tpl-gallery-grid,
  .wizard-marketplace .premium-template-grid,
  .wizard-step-premium .tpl-gallery-grid {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tpl-tile, .wizard-body-enter { animation: none; }
  .tpl-tile:hover, .segment-card:hover { transform: none; }
  .tpl-tile:hover .tpl-tile-media img { transform: none; }
}

/* ——— Owner mode (Phase 3) ——— */
.owner-shell {
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 2rem;
  background: var(--bg, #f8fafc);
}
.owner-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--border, #e2e8f0);
  position: sticky;
  top: 0;
  z-index: 10;
}
.owner-topbar-title { text-align: center; flex: 1; }
.owner-topbar-title small { display: block; color: var(--muted); font-size: 0.75rem; }
.owner-site-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.75rem 1rem;
  padding: 0.65rem 0.85rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border, #e2e8f0);
}
.owner-intro { padding: 0 1rem 0.75rem; color: var(--muted); font-size: 0.9rem; }
.owner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 0 1rem;
}
.owner-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 1rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  background: #fff;
  text-align: right;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.owner-tile:hover { border-color: var(--primary, #0891b2); box-shadow: 0 4px 16px rgba(8, 145, 178, 0.12); }
.owner-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.owner-tile-icon { font-size: 1.4rem; color: var(--primary); }
.owner-tile small { color: var(--muted); font-size: 0.78rem; }
.owner-sheet { padding: 0 1rem 1.5rem; }
.owner-sheet-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.owner-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0.65rem 0 0.25rem;
}
.owner-form input,
.owner-form textarea {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  font-family: inherit;
  box-sizing: border-box;
}
.owner-repeater {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 1px dashed var(--border, #cbd5e1);
  border-radius: 12px;
  background: #fff;
}
.owner-repeater-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}
.owner-add-btn { width: 100%; margin-top: 0.5rem; }
.owner-save-btn { width: 100%; margin-top: 1.25rem; }
.owner-save-msg { min-height: 1.25rem; font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }
.site-card-wrap { display: flex; flex-direction: column; gap: 0.35rem; }
.site-card-cta { display: block; margin-top: 0.65rem; font-size: 0.82rem; color: var(--primary); font-weight: 600; }
.site-card-link-alt { font-size: 0.78rem; color: var(--muted); text-align: center; }
@media (max-width: 380px) { .owner-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .owner-tile { transition: none; } }
