/* Studio de Propostas — usa os tokens do design system da Vibe
   (design-propostas-vibe): cálido + espresso + laranja, Inter + Plus Jakarta. */
:root {
  --bg: #faf7f2;
  --bg-elevated: #ffffff;
  --bg-secondary: #f5f0e8;
  --text: #1f1b16;
  --text-secondary: #6b6052;
  --text-tertiary: #a89b86;
  --text-on-accent: #fffdfa;
  --border: #e8dfd2;
  --border-subtle: #f0e7da;
  --accent: #ea6a1f;
  --accent-hover: #d85b0f;
  --accent-text: #c44d0a;
  --accent-soft: rgba(234, 106, 31, 0.1);
  --accent-border: rgba(234, 106, 31, 0.3);
  --dark-bg: #0d0a07;
  --dark-bg-2: #1f1812;
  --dark-text: #f7f2ea;
  --dark-text-2: #b5ab99;
  --ok: #166534;
  --err: #b91c1c;
  /* rampa das etapas (yellow -> espresso) */
  --s1: #f59e0b;
  --s2: #f97316;
  --s3: #ea6a1f;
  --s4: #c84a0a;
  --s5: #9a3412;
  --s6: #6b2410;
}

* {
  box-sizing: border-box;
}

/* modo embutido (dentro da extensão): sem topbar, layout enxuto */
.embed .topbar {
  display: none;
}
.embed .studio {
  padding: 12px;
  gap: 14px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2 {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  margin: 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--accent-text);
}

.muted {
  color: var(--text-tertiary);
}

.oculto {
  display: none !important;
}

/* ============ TOPBAR ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(160deg, var(--dark-bg) 0%, var(--dark-bg-2) 100%);
  color: var(--dark-text);
  border-bottom: 1px solid rgba(247, 242, 234, 0.08);
}

.topbar-in {
  max-width: 1500px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--text-on-accent);
  background: linear-gradient(135deg, var(--accent) 0%, #fb923c 100%);
}

.brand strong {
  display: block;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.15;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--dark-text-2);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============ BOTÕES ============ */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: 0 8px 20px rgba(234, 106, 31, 0.28);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: inherit;
  border-color: currentColor;
  opacity: 0.85;
}

.btn-ghost:hover {
  opacity: 1;
  background: rgba(127, 127, 127, 0.08);
}

.preview-actions .btn-ghost {
  color: var(--accent-text);
  border-color: var(--accent-border);
}

.btn-add {
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px dashed var(--accent-border);
  width: 100%;
  margin-top: 4px;
}

.btn-add:hover {
  background: rgba(234, 106, 31, 0.16);
}

.btn-remove {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.btn-remove:hover {
  background: #fdecec;
  border-color: #f5c2c2;
  color: var(--err);
}

/* ============ LAYOUT STUDIO ============ */
.studio {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 1080px) {
  .studio {
    grid-template-columns: 1fr;
  }
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ============ PAINÉIS ============ */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.05), 0 8px 20px rgba(60, 40, 20, 0.04);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.panel-hint {
  margin: 6px 0 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.counter {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 3px 9px;
  border-radius: 999px;
}

/* ============ CAMPOS ============ */
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-2 > .col-2 {
  grid-column: 1 / -1;
}

.panel > label {
  margin-bottom: 12px;
}

@media (max-width: 560px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ============ REPEATERS / CARDS ============ */
.repeater {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 6px 0 12px;
}

.repeater-flat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 10px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--bg);
  border-left: 4px solid var(--accent);
}

.etapa[data-step="1"] {
  border-left-color: var(--s1);
}
.etapa[data-step="2"] {
  border-left-color: var(--s2);
}
.etapa[data-step="3"] {
  border-left-color: var(--s3);
}
.etapa[data-step="4"] {
  border-left-color: var(--s4);
}
.etapa[data-step="5"] {
  border-left-color: var(--s5);
}
.etapa[data-step="6"] {
  border-left-color: var(--s6);
}

.sub-card {
  background: var(--bg-secondary);
  border-left-width: 3px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.card-tag {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.step-tag {
  color: var(--accent-text);
}

.reco-toggle,
.bloco-treino-toggle,
.chk {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.bloco-treino-toggle {
  display: flex;
  margin: 12px 0;
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

/* linhas compactas (feature, item, pill) */
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row.item {
  flex-wrap: wrap;
}

.row .f-nome {
  flex: 2 1 180px;
}

.row .f-descricao {
  flex: 3 1 200px;
}

.row .f-valor {
  flex: 1 1 120px;
}

.row.feature .f-texto {
  flex: 1;
}

.row.pill .f-destaque {
  flex: 0 0 90px;
}

.row.pill .f-texto {
  flex: 1;
}

.chk {
  display: inline-flex;
  white-space: nowrap;
}

/* ============ COLUNA DE PREVIEW ============ */
.preview-col {
  position: sticky;
  top: 88px;
}

@media (max-width: 1080px) {
  .preview-col {
    position: static;
  }
}

.preview-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.05), 0 12px 28px rgba(60, 40, 20, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.preview-head strong {
  font-family: "Plus Jakarta Sans", sans-serif;
}

.preview-actions {
  display: flex;
  gap: 8px;
}

.preview-frame {
  position: relative;
  background: var(--bg-secondary);
  height: calc(100vh - 230px);
  min-height: 460px;
}

.preview-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.preview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  padding: 24px;
  color: var(--text-secondary);
}

.preview-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
}

.status {
  font-size: 0.82rem;
  min-height: 1.1em;
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--err);
}
