/* Folio PDF — UI das ferramentas */
:root { --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }
body { font-family: var(--ui); }
h1, h2, .section-title, .brand { font-family: var(--font); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* header */
.nav { font-size: 14px; }

/* ---------- home */
.home-hero { padding: 64px 0 20px; text-align: center; background: radial-gradient(1200px 400px at 50% -10%, #e6eeff 0%, transparent 70%); }
.home-hero h1 { font-size: clamp(32px, 5vw, 54px); font-weight: 600; letter-spacing: -.02em; }
.home-hero .lede { color: var(--muted); font-size: 18px; max-width: 640px; margin: 16px auto 28px; }
.search { display: flex; align-items: center; gap: 10px; max-width: 560px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 0 20px; box-shadow: var(--shadow-sm); color: var(--muted); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px #dbe6ff; }
.search input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 16px; padding: 15px 0; background: transparent; color: var(--text); }
.cat-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px; font: 500 14px var(--ui); cursor: pointer; color: #333; transition: .15s; display: inline-block; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }

.tool-grid-sec { padding: 28px 0 70px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tool-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px 20px 44px; transition: transform .15s, box-shadow .15s, border-color .15s; }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.tc-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); margin-bottom: 14px; }
.tool-card strong { display: block; font-size: 17px; font-weight: 650; margin-bottom: 6px; }
.tool-card p { color: var(--muted); font-size: 14px; line-height: 1.45; }
.tc-where { position: absolute; left: 20px; bottom: 16px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; padding: 3px 9px; border-radius: 999px; }
.tc-where.browser { background: #ecfdf3; color: #15803d; }
.tc-where.server { background: #f1f5f9; color: #475569; }
.grid-empty { text-align: center; color: var(--muted); padding: 40px 0; }

.why { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.why-card { border: 1px solid var(--line); border-radius: 16px; padding: 26px; background: var(--bg); }
.why-ic { font-size: 28px; margin-bottom: 10px; }
.why-card strong { display: block; font-size: 18px; margin-bottom: 8px; }
.why-card p { color: var(--muted); font-size: 15px; }

/* ---------- tela da ferramenta */
.tv { padding: 28px 0 80px; min-height: 70vh; }
.tv-back { display: inline-block; color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.tv-back:hover { color: var(--brand); }
.tv-head { display: flex; gap: 16px; align-items: center; margin-bottom: 26px; }
.tv-icon { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 15px; flex: none; background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); }
.tv-head h1 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 600; }
.tv-head p { color: var(--muted); margin-top: 4px; }

.upload { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 300px; border: 2px dashed color-mix(in srgb, var(--c) 35%, var(--line)); border-radius: 22px; background: color-mix(in srgb, var(--c) 4%, #fff); cursor: pointer; transition: .15s; text-align: center; padding: 30px; }
.upload:hover, .upload.drag { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, #fff); }
.up-btn { background: var(--c); color: #fff; font-weight: 650; font-size: 19px; padding: 18px 40px; border-radius: 14px; box-shadow: 0 10px 24px -10px var(--c); }
.up-or { color: var(--muted); }
.upload small { color: var(--muted); font-size: 13px; }
.where-note { display: block; text-align: center; color: var(--muted); font-size: 13px; margin-top: 14px; }

.work { display: grid; grid-template-columns: 1fr 330px; gap: 24px; align-items: start; }
.work-main { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; min-height: 380px; min-width: 0; }
.work-side { position: sticky; top: 90px; }
.side-box { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.side-box h3 { font-size: 18px; margin-bottom: 16px; }
.side-box .where-note { text-align: left; margin-top: 14px; }

.field { display: block; margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: #333; }
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.field input[type=text], .field input[type=number], .field input[type=password], .field input[type=url], .field select {
  width: 100%; font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: 0; }
.field input:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px #dbe6ff; }
.field input[type=color] { width: 56px; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
.field.check { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.radios { display: grid; gap: 8px; }
.radio { display: flex; flex-direction: column; border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 12px; cursor: pointer; font-size: 14px; transition: .12s; }
.radio input { display: none; }
.radio small { margin-top: 1px !important; }
.radio.on { border-color: var(--brand); background: #f3f7ff; }
.range { display: flex; gap: 10px; align-items: center; }
.range input { flex: 1; accent-color: var(--brand); }
.range output { font-size: 13px; color: var(--muted); min-width: 44px; text-align: right; }

.run-btn { width: 100%; padding: 15px; font-size: 16px; border-radius: 12px; background: var(--c); box-shadow: 0 8px 20px -10px var(--c); margin-top: 6px; }
.run-btn:hover { background: color-mix(in srgb, var(--c) 85%, #000); }
.progress { margin-top: 14px; }
.progress .bar { height: 8px; background: #eef1f6; border-radius: 99px; overflow: hidden; position: relative; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.progress .bar.indet span { width: 35% !important; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.progress p { font-size: 13px; color: var(--muted); margin-top: 8px; }
.err-msg { margin-top: 12px; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; padding: 10px 12px; border-radius: 10px; font-size: 14px; }

/* cards de arquivo */
.fc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.fc-head strong { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-more { cursor: pointer; }
.fc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.fc { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: var(--bg); transition: .12s; }
.fc.sortable { cursor: grab; user-select: none; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; opacity: .9; box-shadow: var(--shadow-lg); transform-origin: 0 0; }
.armed { outline: 2px solid var(--brand); }
.fc.dragging { opacity: .4; }
.fc-thumb { height: 170px; display: grid; place-items: center; background: #fff; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.fc-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.fc-ph { color: #9aa3b2; font-size: 30px; }
.fc-name { font-size: 13px; font-weight: 600; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-meta { font-size: 12px; color: var(--muted); }
.fc-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: #111827cc; color: #fff; cursor: pointer; z-index: 2; font-size: 15px; line-height: 1; opacity: 0; transition: .12s; }
.fc:hover .fc-del { opacity: 1; }
@media (hover: none) { .fc-del { opacity: 1; } }
.drop-before { box-shadow: -4px 0 0 var(--brand); }
.drop-after { box-shadow: 4px 0 0 var(--brand); }

/* grade de páginas */
.hint { color: var(--muted); font-size: 14px; margin: -4px 0 14px; }
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 14px; }
.pg { position: relative; border: 2px solid transparent; border-radius: 12px; padding: 8px; background: var(--bg); text-align: center; transition: .12s; user-select: none; }
.pg-img { height: 150px; display: grid; place-items: center; }
.pg-img img { max-width: 100%; max-height: 140px; box-shadow: 0 1px 4px rgba(0,0,0,.15); background: #fff; transition: transform .2s; pointer-events: none; min-width: 60px; min-height: 80px; }
.pg-n { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.pg-grid.select .pg { cursor: pointer; }
.pg-grid.select .pg:hover { border-color: #c7d4ee; }
.pg-check { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 13px; color: transparent; }
.pg.sel { border-color: var(--brand); background: #eef4ff; }
.pg.sel .pg-check { background: var(--brand); border-color: var(--brand); color: #fff; }
.pg-grid.organize .pg { cursor: grab; }
.pg.dragging { opacity: .4; }
.pg-tools { display: flex; justify-content: center; gap: 4px; margin-top: 6px; }
.pg-tools button { border: 1px solid var(--line); background: #fff; border-radius: 7px; width: 30px; height: 28px; cursor: pointer; font-size: 14px; }
.pg-tools button:hover { border-color: var(--brand); color: var(--brand); }
.pg-tools button[data-a=x]:hover { border-color: #dc2626; color: #dc2626; }

.loading { padding: 60px; text-align: center; color: var(--muted); }
.load-err { padding: 50px 20px; text-align: center; }
.load-err p { color: var(--muted); margin: 8px 0 18px; }
.url-hero { display: grid; place-items: center; text-align: center; gap: 16px; padding: 70px 20px; color: var(--muted); }
.url-hero svg { color: #ea580c; }

/* editor */
.work-editor { grid-template-columns: 1fr 300px; }
.ed-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; position: sticky; top: 72px; z-index: 5; background: #fff; padding: 6px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.ed-tool { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 12px; font: 500 14px var(--ui); cursor: pointer; }
.ed-tool:hover { border-color: var(--brand); }
.ed-tool.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.ed-props { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 8px 12px; background: #f6f8fc; border-radius: 10px; margin-bottom: 10px; font-size: 13px; }
.ed-props label { display: flex; align-items: center; gap: 6px; }
.ed-props input[type=number] { width: 62px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 7px; }
.ed-props select { padding: 5px 6px; border: 1px solid var(--line); border-radius: 7px; }
.ed-props input[type=color] { width: 34px; height: 26px; border: 1px solid var(--line); border-radius: 6px; padding: 1px; }
.ed-hint { font-size: 13px; color: #1e40af; background: #eff6ff; border-radius: 9px; padding: 8px 12px; margin-bottom: 12px; }
.ed-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; background: #eef1f6; border-radius: 12px; padding: 18px 0; overflow-x: auto; }
.ed-page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); flex: none; touch-action: none; }
.ed-page canvas { width: 100%; height: 100%; display: block; }
.ed-pnum { position: absolute; bottom: -16px; right: 0; font-size: 11px; color: var(--muted); }
.ed-pages:not([data-tool=select]) .ed-page { cursor: crosshair; }
.ed-item { position: absolute; border: 1.5px dashed transparent; cursor: move; touch-action: none; }
.ed-item:hover { border-color: #93b4f5; }
.ed-item.selected { border-color: var(--brand); }
.ed-item img { width: 100%; height: 100%; display: block; pointer-events: none; }
.ed-text { white-space: pre; line-height: 1.25; padding: 2px; outline: 0; min-width: 20px; min-height: 1.25em; cursor: text; }
.ed-text:empty::before { content: "Digite aqui"; color: #9aa3b2; }
.ed-k-whiteout { background: #fff; border-color: #cbd5e1; }
.ed-k-rect { border: 2px solid #dc2626 !important; }
.ed-k-rect.selected { outline: 1.5px dashed var(--brand); outline-offset: 3px; }
.ed-x { position: absolute; top: -11px; right: -11px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #dc2626; color: #fff; font-size: 14px; line-height: 1; cursor: pointer; display: none; z-index: 3; }
.ed-rs { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: var(--brand); border: 2px solid #fff; border-radius: 3px; cursor: nwse-resize; display: none; }
.ed-item.selected .ed-x, .ed-item.selected .ed-rs { display: block; }

/* assinatura */
.sig-dialog { border: 0; border-radius: 18px; padding: 0; max-width: 620px; width: calc(100% - 24px); box-shadow: var(--shadow-lg); }
.sig-dialog::backdrop { background: rgba(15,17,22,.5); }
.sig-box { padding: 24px; }
.sig-box h3 { font-size: 20px; margin-bottom: 14px; }
.sig-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.sig-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 14px; font: 500 14px var(--ui); cursor: pointer; }
.sig-tabs button.active { background: var(--text); color: #fff; border-color: var(--text); }
#sigCanvas { width: 100%; height: auto; aspect-ratio: 560/200; border: 1.5px dashed #c5cede; border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }
.sig-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; }
.sig-color { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.sig-color.active { box-shadow: 0 0 0 2px var(--brand); }
.sig-row .btn { margin-left: auto; }
#sigText { width: 100%; font: inherit; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; }
.sig-preview { font-family: 'Dancing Script', cursive; font-size: 54px; min-height: 100px; display: grid; place-items: center; border: 1.5px dashed #c5cede; border-radius: 12px; margin-top: 10px; color: #111827; overflow: hidden; white-space: nowrap; }
#sigUploadPreview { max-width: 100%; max-height: 160px; margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; }
.sig-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* resultado */
.result { text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 50px 24px; }
.res-check { width: 70px; height: 70px; border-radius: 50%; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); display: grid; place-items: center; font-size: 34px; font-weight: 800; margin: 0 auto 18px; }
.result h2 { font-size: 30px; font-weight: 600; margin-bottom: 18px; }
.res-dl { font-size: 18px; padding: 17px 38px; border-radius: 14px; background: var(--c); box-shadow: 0 10px 24px -10px var(--c); }
.res-dl:hover { background: color-mix(in srgb, var(--c) 85%, #000); }
.res-name { color: var(--muted); font-size: 13px; margin-top: 10px; word-break: break-all; }
.res-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.res-next { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.res-next p { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.res-next div { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.saving { display: inline-flex; gap: 12px; align-items: center; background: #ecfdf3; color: #166534; border-radius: 12px; padding: 10px 18px; margin-bottom: 22px; }
.saving b { font-size: 26px; }
.saving.neutral { background: #f1f5f9; color: #475569; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 999; box-shadow: var(--shadow-lg); transition: opacity .4s, transform .4s; max-width: 90vw; }
.toast.err { background: #b91c1c; }
.toast.out { opacity: 0; transform: translate(-50%, 10px); }

/* responsivo */
@media (max-width: 960px) {
  .work, .work-editor { grid-template-columns: 1fr; }
  .work-side { position: static; order: -1; }
  .work-editor .work-side { order: 0; }
  .why-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
}
@media (max-width: 560px) {
  .tool-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tool-card { padding: 16px 14px 40px; }
  .tool-card p { display: none; }
  .tc-where { left: 14px; }
  .work-main { padding: 12px; }
  .fc-grid { grid-template-columns: 1fr 1fr; }
  .pg-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
