/* =========================================================================
   GERAÇÃO DIGITAL — Editor de Propostas (builder)
   ========================================================================= */
:root {
  --bg: #0a0a0c;
  --panel: #111114;
  --panel-2: #17171b;
  --line: rgba(255, 255, 255, 0.08);
  --ink: #f2f2f0;
  --muted: #9a9aa2;
  --faint: #6b6b74;
  --c1: #e6177e; --c3: #c21469; --c5: #eab556;
  --grad: linear-gradient(120deg, #e6177e, #c21469);
  --ok: #34d399;
  --font: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
::selection { background: #d81e8c; color: #fff; }

/* ---- app shell ---- */
.app { display: flex; flex-direction: column; height: 100vh; height: 100svh; }

/* ---- topbar ---- */
.topbar { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel); flex-shrink: 0; }
.topbar__brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; }
.topbar__brand svg, .topbar__brand img { width: 26px; height: 26px; }
.topbar__brand b { font-weight: 700; }
.topbar__brand span { color: var(--muted); font-weight: 400; }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* ---- buttons ---- */
.b { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.9rem; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font: inherit; font-size: 0.82rem; font-weight: 500; cursor: pointer; transition: border-color 0.2s, background 0.2s, transform 0.1s; white-space: nowrap; }
.b:hover { border-color: rgba(255,255,255,0.25); }
.b:active { transform: translateY(1px); }
.b--primary { background: var(--grad); color: #170a12; border: none; font-weight: 600; }
.b--primary:hover { filter: brightness(1.05); }
.b--ghost { background: transparent; }
.b svg { width: 15px; height: 15px; }

/* ---- layout ---- */
.main { flex: 1; display: grid; grid-template-columns: minmax(360px, 460px) 1fr; min-height: 0; }
.form { overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); padding: 0.5rem 0 4rem; }
.preview { position: relative; background: #050506; min-width: 0; }
.preview__bar { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.9rem; border-bottom: 1px solid var(--line); background: var(--panel); font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.preview__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grad); }
.preview__frames { display: flex; gap: 0.35rem; margin-left: auto; }
.preview__frames button { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 7px; padding: 0.25rem 0.6rem; font: inherit; font-size: 0.7rem; cursor: pointer; }
.preview__frames button.is-on { color: var(--ink); border-color: rgba(255,255,255,0.3); }
.preview__stage { position: absolute; inset: 42px 0 0; display: grid; place-items: center; overflow: auto; padding: 0; }
.preview__stage.pad { padding: 1.5rem; }
#frame { border: 0; background: #050506; width: 100%; height: 100%; display: block; }
#frame.mobile { width: 390px; height: 100%; max-height: 100%; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px -20px #000; }

/* ---- form groups ---- */
.group { border-bottom: 1px solid var(--line); }
.group > summary { list-style: none; cursor: pointer; padding: 0.95rem 1.1rem; display: flex; align-items: center; gap: 0.6rem; font-weight: 600; font-size: 0.9rem; user-select: none; }
.group > summary::-webkit-details-marker { display: none; }
.group > summary::before { content: "›"; color: var(--muted); font-size: 1.1rem; transition: transform 0.2s; }
.group[open] > summary::before { transform: rotate(90deg); }
.group__num { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }
.group__body { padding: 0.2rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.85rem; }

.field { display: flex; flex-direction: column; gap: 0.32rem; }
.field label { font-size: 0.76rem; color: var(--muted); font-weight: 500; }
.field .hint { font-size: 0.68rem; color: var(--faint); }
.field input, .field textarea { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font: inherit; padding: 0.6rem 0.7rem; resize: vertical; transition: border-color 0.15s; }
.field input:focus, .field textarea:focus { outline: none; border-color: #e6177e; }
.field textarea { min-height: 68px; line-height: 1.5; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }

/* ---- serviços ---- */
.svc { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.svc__head { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.7rem; cursor: pointer; }
.svc__head input[type=checkbox] { width: 17px; height: 17px; accent-color: #e6177e; cursor: pointer; flex-shrink: 0; }
.svc__name { font-weight: 500; font-size: 0.85rem; flex: 1; }
.svc__toggle { color: var(--faint); font-size: 0.7rem; font-family: var(--mono); }
.svc.off { opacity: 0.5; }
.svc__body { padding: 0 0.7rem 0.7rem; display: none; flex-direction: column; gap: 0.5rem; }
.svc.edit .svc__body { display: flex; }
.svc__body input, .svc__body textarea { background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; color: var(--ink); font: inherit; padding: 0.5rem 0.6rem; width: 100%; }
.svc__body textarea { min-height: 60px; line-height: 1.45; resize: vertical; }
.svc__remove { align-self: flex-start; background: none; border: none; color: var(--c1); font: inherit; font-size: 0.75rem; cursor: pointer; padding: 0; }
.svc-add { border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 10px; padding: 0.7rem; cursor: pointer; font: inherit; font-size: 0.82rem; }
.svc-add:hover { border-color: rgba(255,255,255,0.3); color: var(--ink); }

/* ---- branding em ação (mockups) ---- */
.switch { display: flex; align-items: center; gap: 0.55rem; font-size: 0.85rem; cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: #e6177e; cursor: pointer; }
.mock-add { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mock-add button { border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 8px; padding: 0.45rem 0.6rem; cursor: pointer; font: inherit; font-size: 0.76rem; }
.mock-add button:hover { border-color: rgba(230,23,126,0.5); color: var(--ink); }
#mockList { display: flex; flex-direction: column; gap: 0.4rem; }
.mockrow { display: flex; align-items: center; gap: 0.5rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.5rem; }
.mockrow--empty { color: var(--faint); font-size: 0.78rem; justify-content: center; }
.mockrow__type { font-size: 0.8rem; font-weight: 500; white-space: nowrap; }
.mockrow__src { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font: inherit; font-size: 0.76rem; padding: 0.35rem 0.5rem; }
.mockrow__spacer { flex: 1; }
.mockrow__actions { display: flex; gap: 0.2rem; }
.mockrow__actions button { width: 24px; height: 24px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 6px; cursor: pointer; font-size: 0.85rem; line-height: 1; }
.mockrow__actions button:hover { color: var(--ink); border-color: rgba(255,255,255,0.25); }
.mockrow__actions button[data-mv="rm"]:hover { color: var(--c1); border-color: var(--c1); }

/* ---- saved list ---- */
.saved { position: relative; }
.saved__menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-width: 220px; padding: 0.4rem; z-index: 30; box-shadow: 0 18px 50px -20px #000; display: none; max-height: 320px; overflow-y: auto; }
.saved.open .saved__menu { display: block; }
.saved__item { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.5rem; border-radius: 7px; cursor: pointer; }
.saved__item:hover { background: var(--panel-2); }
.saved__item span { flex: 1; font-size: 0.82rem; }
.saved__item small { color: var(--faint); font-size: 0.68rem; }
.saved__item button { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 0.9rem; padding: 0 0.2rem; }
.saved__item button:hover { color: var(--c1); }
.saved__empty { padding: 0.6rem; color: var(--faint); font-size: 0.78rem; text-align: center; }
.saved__foot { display: flex; gap: 0.4rem; margin-top: 0.4rem; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.saved__foot button { flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); border-radius: 7px; padding: 0.45rem 0.4rem; font: inherit; font-size: 0.74rem; cursor: pointer; }
.saved__foot button:hover { color: var(--ink); border-color: rgba(255,255,255,0.25); }

/* ---- toast ---- */
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 1.1rem; font-size: 0.85rem; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; z-index: 100; display: flex; align-items: center; gap: 0.5rem; box-shadow: 0 18px 50px -20px #000; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

/* ---- responsivo: empilha em telas estreitas ---- */
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
  .form { border-right: none; border-bottom: 1px solid var(--line); max-height: 46vh; }
  .preview { min-height: 54vh; }
  .topbar__brand span { display: none; }
}
