:root {
  --bg: #e9ebee;
  --bg2: #f3f4f6;
  --card: #ffffff;
  --line: #e2e4e8;
  --ink: #15161a;
  --ink2: #5b6070;
  --ink3: #8b90a0;
  --pink: #d63a8f;
  --pink2: #e6519f;
  --pink-soft: #fde4f1;
  --pink-ink: #9b1f60;
  --ok: #138a4b;
  --ok-soft: #dff5e8;
  --warn: #9a6400;
  --warn-soft: #fbf0d7;
  --bad: #b3263b;
  --bad-soft: #fbe2e6;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 22, 30, 0.04), 0 6px 20px rgba(20, 22, 30, 0.05);
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: linear-gradient(180deg, #e3e5e9 0%, var(--bg2) 60%); }
body { font-size: 14px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; border-right: 1px solid var(--line); background: rgba(255,255,255,0.55); backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; padding: 4px 8px; color: var(--pink); }
.brand span { color: var(--ink); }
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink2); font-weight: 500; }
#nav a i { font-style: normal; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); font-size: 12px; }
#nav a:hover { background: #fff; color: var(--ink); }
#nav a.active { background: var(--pink); color: #fff; }
#nav a.active i { background: rgba(255,255,255,0.2); border-color: transparent; color: #fff; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--ink3); padding: 8px; }
main { padding: 24px 28px 80px; min-width: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.head { display: flex; align-items: center; gap: 16px; }
.head .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--pink); color: #fff; display: grid; place-items: center; font-size: 20px; flex: none; }
.head h1 { font-size: 22px; margin: 0; }
.head p { margin: 0; color: var(--ink2); font-size: 13px; max-width: 640px; }
.head .right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h2 { font-size: 17px; margin: 0 0 4px; }
h3 { font-size: 15px; margin: 0 0 4px; }
.muted { color: var(--ink2); }
.small { font-size: 12px; }
.tiny { font-size: 11px; color: var(--ink3); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 9px 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #cfd2d8; }
.btn.primary { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn.primary:hover { background: var(--pink2); }
.btn.soft { background: var(--pink-soft); border-color: transparent; color: var(--pink-ink); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 10px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.iconbtn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: inline-grid; place-items: center; cursor: pointer; }
.iconbtn.pink { background: var(--pink); color: #fff; border-color: var(--pink); }

.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: #f6f7f9; border-radius: 12px; padding: 10px 12px; outline: none; }
.input:focus { border-color: var(--pink); background: #fff; box-shadow: 0 0 0 3px var(--pink-soft); }
textarea.input { resize: vertical; min-height: 72px; }
label.lbl { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; }

.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; }
.seg button { border: 0; background: transparent; border-radius: 10px; padding: 7px 12px; cursor: pointer; font-weight: 600; color: var(--ink2); font-size: 13px; }
.seg button.on { background: var(--pink); color: #fff; }
.seg.outline button.on { background: var(--pink-soft); color: var(--pink-ink); outline: 1.5px solid var(--pink); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg2); color: var(--ink2); }
.chip.pink { background: var(--pink-soft); color: var(--pink-ink); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.solid { background: var(--pink); color: #fff; }

.toggle { position: relative; width: 40px; height: 22px; border-radius: 999px; background: #d5d8de; border: 0; cursor: pointer; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.toggle.on { background: var(--pink); }
.toggle.on::after { left: 21px; background: #1f1f24; }

.slider { display: flex; flex-direction: column; gap: 6px; }
.slider .top { display: flex; justify-content: space-between; font-size: 13px; }
.slider .top b { font-weight: 500; color: var(--ink2); font-size: 12px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 6px; background: #e6e8ec; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--pink); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--pink); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--pink); border: 2px solid #fff; }

/* ViceScrap */
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 16px; }
.post { position: relative; border-radius: 14px; overflow: hidden; background: #111; aspect-ratio: 9/14; cursor: pointer; border: 2px solid transparent; }
.post img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post.sel { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
.post .stats { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; background: linear-gradient(transparent, rgba(0,0,0,0.85)); color: #fff; font-size: 11px; display: flex; gap: 8px; flex-wrap: wrap; }
.post .check { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 8px; background: rgba(255,255,255,0.9); display: grid; place-items: center; font-weight: 700; color: var(--pink); }
.post.sel .check { background: var(--pink); color: #fff; }
.post .badge { position: absolute; top: 8px; left: 8px; }

/* Templates */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; }
.tcard { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.tcard .thumb { position: relative; border-radius: 12px; overflow: hidden; background: #111; aspect-ratio: 9/16; }
.tcard .thumb canvas, .tcard .thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.tcard .thumb .st { position: absolute; top: 10px; left: 10px; }
.tcard .foot { display: flex; align-items: center; gap: 8px; padding: 0 4px 4px; }
.tcard .foot .name { font-weight: 700; }

.modal-back { position: fixed; inset: 0; background: rgba(15,16,20,0.45); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 22px; padding: 22px 24px; max-width: 920px; width: 100%; max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,0.25); }
.modal.narrow { max-width: 520px; }
.modal h2 { margin-bottom: 14px; }
.choose { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.choose .opt { background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.choose .opt canvas { width: 100%; aspect-ratio: 9/16; border-radius: 12px; display: block; }
.choose .opt .t { text-align: center; font-weight: 600; }

/* Wizard */
.wiz-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.steps { display: flex; gap: 4px; padding: 5px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; margin-left: auto; flex-wrap: wrap; }
.steps button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--ink2); font-size: 13px; }
.steps button.on { background: var(--pink); color: #fff; }
.steps button:disabled { color: #b5b9c3; cursor: default; }
.namebox { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: #fff; }
.namebox input { border: 0; outline: none; background: transparent; font-weight: 600; width: 180px; }
.wiz { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; margin-top: 16px; align-items: start; }
.preview { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.preview canvas { width: 100%; max-width: 340px; aspect-ratio: 9/16; border-radius: 18px; background: #000; box-shadow: 0 12px 40px rgba(0,0,0,0.18); }
.zone-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg2); }
.zone-row .num { width: 28px; height: 28px; border-radius: 50%; background: var(--pink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.zone-row .handle { cursor: grab; color: var(--ink3); user-select: none; }
.zone-add { border: 1.5px dashed #cfd2d8; border-radius: 14px; padding: 12px; text-align: center; cursor: pointer; color: var(--ink2); background: transparent; width: 100%; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.preset { display: flex; gap: 12px; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; background: #fff; text-align: left; }
.preset.on { border-color: var(--ink); }
.preset .mini { width: 52px; height: 92px; border-radius: 8px; border: 1px solid var(--line); flex: none; display: flex; flex-direction: column; overflow: hidden; }
.preset .mini div { flex: 1; background: var(--pink2); border-top: 1px solid #fff; }
.preset .mini div.img { background: #c2307b; }
.preset .mini div.top { flex: 0 0 18px; background: #fff; }
.preset h4 { margin: 0 0 4px; font-size: 13px; }
.preset p { margin: 0; font-size: 11.5px; color: var(--ink2); }
.phrase { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.phrase.added { background: var(--pink-soft); border-color: #f5b8d8; }
.phrase .txt { flex: 1; }
.media-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto; padding-right: 4px; }
.media-list.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.media-item { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.media-item.sel { border-color: var(--pink); background: #fff8fc; }
.media-item img, .media-item .ph { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: #222; flex: none; }
.media-list.grid .media-item { flex-direction: column; align-items: stretch; }
.media-list.grid .media-item img { width: 100%; height: 120px; }
.trim { position: relative; height: 34px; border-radius: 8px; background: #f0f1f4; margin: 6px 0 2px; }
.trim .bar { position: absolute; top: 0; bottom: 0; background: var(--pink2); border-radius: 6px; }
.trim .h { position: absolute; top: -2px; bottom: -2px; width: 10px; background: #111; border-radius: 4px; cursor: ew-resize; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sw { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.sw.on { outline: 2px solid var(--pink); outline-offset: 2px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.opt-tile { position: relative; border-radius: 12px; overflow: hidden; border: 1.5px solid var(--line); cursor: pointer; background: #fff; }
.opt-tile img { width: 100%; height: 76px; object-fit: cover; display: block; background: #222; }
.opt-tile .lb { padding: 6px 8px; font-size: 12px; font-weight: 600; }
.opt-tile .ck { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 6px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; }
.opt-tile.on { border-color: var(--ink); }
.opt-tile.on .ck { background: #111; color: #fff; border-color: #111; }
.checkline { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.checkline.on { border-color: var(--ink); }
.cb { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #9aa0ad; display: grid; place-items: center; font-size: 11px; flex: none; }
.checkline.on .cb { background: #111; border-color: #111; color: #fff; }

.progress { height: 8px; border-radius: 99px; background: #e6e8ec; overflow: hidden; }
.progress div { height: 100%; background: var(--pink); width: 0; transition: width 0.4s; }
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 16px; }
.rcard { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.rcard .media { aspect-ratio: 9/16; background: #121214; position: relative; display: grid; place-items: center; color: #b9bcc6; text-align: center; font-size: 12px; }
.rcard .media video, .rcard .media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rcard .cap { position: absolute; left: 10px; right: 10px; bottom: 10px; text-align: left; color: #fff; font-size: 11px; }
.rcard .actions { display: flex; gap: 8px; padding: 10px; }
.rcard .actions .btn { flex: 1; justify-content: center; }
.palm { font-size: 34px; color: var(--pink); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.4; transform: scale(0.92); } }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; color: var(--ink3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }

.integr { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.integr .card { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.integr .card.dim { opacity: 0.55; }

.blocks { display: flex; flex-direction: column; gap: 10px; }
.block { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; display: grid; grid-template-columns: 32px 1fr; gap: 10px; }
.block .n { width: 28px; height: 28px; border-radius: 9px; background: var(--bg2); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.block textarea { min-height: 54px; }
.block .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
pre.log { background: #111; color: #cfd2d8; border-radius: 12px; padding: 12px; max-height: 240px; overflow: auto; font-size: 11px; white-space: pre-wrap; }

#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #15161a; color: #fff; padding: 11px 14px; border-radius: 12px; max-width: 420px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); white-space: pre-wrap; }
.toast.err { background: var(--bad); }
.toast.ok { background: var(--ok); }
.empty { text-align: center; padding: 40px 20px; color: var(--ink2); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.lib-item { position: relative; border-radius: 12px; overflow: hidden; background: #fff; border: 1.5px solid var(--line); cursor: pointer; }
.lib-item img, .lib-item .ph { width: 100%; height: 150px; object-fit: cover; display: block; background: #1b1c20; }
.lib-item .ph { display: grid; place-items: center; color: #9aa0ad; font-size: 26px; }
.lib-item .info { padding: 6px 8px; font-size: 11px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item.on { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
.lib-item .kind { position: absolute; top: 6px; left: 6px; }
.lib-item .del { position: absolute; top: 6px; right: 6px; }

@media (max-width: 1100px) {
  .wiz { grid-template-columns: 1fr; }
  .preview { position: static; }
  .presets, .choose, .integr, .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow: auto; }
  #nav { flex-direction: row; }
  .grid2, .presets, .choose, .integr, .grid3 { grid-template-columns: 1fr; }
}

/* login e status do PC */
body.logged-out .shell { display: none; }
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: linear-gradient(180deg, #e3e5e9, #f3f4f6); }
.pc { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink2); }
.pc .dot { width: 9px; height: 9px; border-radius: 50%; background: #c3c7cf; }
.pc.on { color: var(--ok); }
.pc.on .dot { background: #1fb565; box-shadow: 0 0 0 3px #d4f3e1; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice .opt2 { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.choice .opt2 h4 { margin: 0; font-size: 13px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
