/* Páginas organizar / editar / formulário — complementa styles.css */
.studio { padding-bottom: 40px; }
.studio .dropzone { max-width: 880px; margin: 0 auto; }
.st-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); position: sticky; top: 72px; z-index: 5; }
.st-spacer { flex: 1; }
.st-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.st-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.st-field input[type=number] { width: 58px; height: 32px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); color: var(--ink); padding: 0 6px; font: inherit; }
.st-field input[type=color] { width: 34px; height: 30px; border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; background: var(--bg); cursor: pointer; }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio > section > .muted.small { margin: 10px 4px; }

/* ---- Organizar ---- */
.pg-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.pg { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; cursor: grab; transition: box-shadow .15s, transform .15s, opacity .15s; }
.pg:hover { box-shadow: var(--shadow-lg); }
.pg.dragging { opacity: .4; outline: 2px dashed var(--accent); }
.pg-thumb { height: 200px; display: grid; place-items: center; background: var(--bg); border-radius: 8px; overflow: hidden; }
.pg-thumb img { max-width: 100%; max-height: 200px; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #fff; }
.pg-blank { width: 70%; aspect-ratio: 1 / 1.414; background: #fff; border: 1px dashed var(--line-2); display: grid; place-items: center; font-size: 12px; color: var(--muted); }
.pg-loading { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.pg-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 4px; }
.pg-num { font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.pg-src { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pg-src.s0 { background: var(--pdf); } .pg-src.s1 { background: var(--vid); } .pg-src.s2 { background: var(--img); } .pg-src.s3 { background: var(--aud); } .pg-src.s4 { background: var(--accent); } .pg-src.s5 { background: var(--ink); }
.pg-actions { display: flex; gap: 1px; }
.pg-actions button { width: 26px; height: 26px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.pg-actions button:hover { background: var(--bg-2); color: var(--ink); }
.pg-actions .danger:hover { background: var(--pdf-soft); color: var(--pdf); }

/* ---- Editor ---- */
.ed-toolbar button[data-tool] { border: 1px solid transparent; background: transparent; padding: 7px 10px; border-radius: 9px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.ed-toolbar button[data-tool]:hover { background: var(--bg-2); color: var(--ink); }
.ed-toolbar button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.ed-pages { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 40px; }
.ed-label { font-size: 12px; color: var(--muted); margin-top: 12px; }
.ed-page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); max-width: 100%; }
.ed-page canvas { display: block; }
.ed-layer { position: absolute; inset: 0; }
.ed-pages:not([data-tool="select"]) .ed-page { cursor: crosshair; }
.ed-item { position: absolute; border: 1px dashed transparent; touch-action: none; cursor: move; }
.ed-item:hover, .ed-item.sel { border-color: var(--accent); }
.ed-item img { width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; }
.ed-text { width: 100%; height: 100%; outline: none; font-family: Helvetica, Arial, sans-serif; line-height: 1.2; white-space: pre; cursor: text; overflow: visible; }
.ed-handle { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); cursor: nwse-resize; display: none; }
.ed-del { position: absolute; top: -12px; right: -12px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); font-size: 11px; cursor: pointer; display: none; }
.ed-item.sel .ed-handle, .ed-item.sel .ed-del { display: block; }
.sig-dialog { border: 0; border-radius: 20px; padding: 22px; width: min(640px, calc(100% - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.sig-dialog::backdrop { background: rgba(10, 10, 15, .5); }
.sig-dialog h3 { margin: 0 0 12px; font-family: var(--display); }
.sig-dialog .seg { margin-bottom: 12px; }
.sig-dialog .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 1px var(--line); }
#sigPad { width: 100%; aspect-ratio: 3 / 1; background: #fff; border: 1px dashed var(--line-2); border-radius: 12px; touch-action: none; cursor: crosshair; display: block; margin-bottom: 8px; }
#sigName { width: 100%; height: 90px; border: 1px dashed var(--line-2); border-radius: 12px; background: #fff; color: #1a3a8a; font: 600 52px 'Caveat', cursive; padding: 0 16px; outline: none; }
.sig-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.sig-dialog .st-field { margin-top: 10px; }

/* ---- Formulário ---- */
.ff-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.ff-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
.ff-panel .st-bar { position: static; box-shadow: none; border: 0; padding: 0; justify-content: space-between; }
#fields { display: flex; flex-direction: column; gap: 12px; }
.ff { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); border: 0; padding: 0; margin: 0; }
.ff input:not([type=checkbox]):not([type=radio]), .ff select, .ff textarea { height: 40px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--ink); padding: 0 10px; font: 400 14px var(--font); outline: none; }
.ff textarea { height: auto; padding: 8px 10px; resize: vertical; }
.ff input:focus, .ff select:focus, .ff textarea:focus { border-color: var(--accent); }
.ff legend { margin-bottom: 4px; }
.ff-check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.ff-check input { width: 17px; height: 17px; accent-color: var(--accent); }
.ff-preview { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.ff-preview canvas { box-shadow: 0 2px 10px rgba(0,0,0,.15); max-width: 100%; height: auto !important; }
.empty { padding: 20px; border-radius: 12px; background: var(--bg); color: var(--ink-2); font-size: 14px; text-align: center; }
.empty a { color: var(--accent); }

@media (max-width: 860px) {
  .ff-layout { grid-template-columns: 1fr; }
  .ff-panel { position: static; max-height: none; }
  .st-bar { top: 64px; }
}
@media (max-width: 640px) {
  .pg-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pg-thumb { height: 150px; }
  .pg-thumb img { max-height: 150px; }
  .ed-toolbar button[data-tool] { padding: 6px 8px; font-size: 12.5px; }
  .ellipsis { display: none; }
}
#repeatAll { border: 1px dashed var(--line-2); background: transparent; padding: 7px 10px; border-radius: 9px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent); }
#repeatAll:disabled { color: var(--muted); cursor: not-allowed; opacity: .6; }
#repeatAll:not(:disabled):hover { background: var(--accent-soft); }
.rubrica-hint { margin: 12px 0 0; padding: 12px 16px 12px 34px; border-radius: 14px; background: var(--accent-soft); font-size: 14px; display: grid; gap: 4px; }
