/* Editor de artes (aba Design): estilo de programa de imagem, usando as cores do painel (claro e escuro). */
.de { --de-ws: color-mix(in srgb, var(--text) 9%, var(--bg)); --de-acc: #2b7fff; --de-acc-t: color-mix(in srgb, #2b7fff 16%, transparent);
  position: relative; isolation: isolate; /* menus, dicas e painel lateral (z 40-80) ficam presos aqui e não passam por cima do cabeçalho do painel ao rolar */ display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; height: calc(100vh - 150px); min-height: 560px;
  background: var(--card); color: var(--text); border-radius: var(--r-lg); box-shadow: 0 0 0 var(--hair) var(--line); overflow: hidden; font-size: var(--t-md, .8125rem); user-select: none; }
.de.full { position: fixed; inset: 0; height: auto; border-radius: 0; z-index: 900; }
.de button { font: inherit; color: inherit; }
.de input, .de select, .de textarea { font: inherit; color: var(--text); }
.de .grow { flex: 1; }

/* menu */
.de-menubar { display: flex; align-items: center; gap: 2px; padding: 4px 8px; border-bottom: var(--hair) solid var(--line); background: var(--card); }
.de-mtop { background: none; border: 0; padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.de-mtop:hover, .de-mtop[aria-expanded="true"] { background: var(--fill); }
.de-dd { position: absolute; z-index: 50; min-width: 250px; padding: 5px; background: var(--card); border-radius: 10px; box-shadow: 0 0 0 var(--hair) var(--line2, var(--line)), 0 14px 40px -10px rgba(0,0,0,.35); display: flex; flex-direction: column; }
.de-dd button { display: flex; justify-content: space-between; gap: 18px; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.de-dd button:hover, .de-dd button:focus-visible { background: var(--de-acc); color: #fff; outline: none; }
.de-dd kbd { font: inherit; opacity: .6; font-size: .75rem; }
.de-dd hr { border: 0; border-top: var(--hair) solid var(--line); margin: 4px 6px; }
.de-label { margin: 0 8px; }
.de-label button { padding: 5px 10px; font-size: .75rem; }

/* barra de opções */
.de-opts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 12px; min-height: 40px; border-bottom: var(--hair) solid var(--line); background: var(--fill); }
.de-tname { font-weight: 600; margin-right: 4px; }
.de-o { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.de-o input[type=range] { width: 100px; }
.de-o output { min-width: 42px; font-variant-numeric: tabular-nums; color: var(--text); }
.de-o.grp { gap: 3px; }
.de-o select { padding: 3px 6px; border-radius: 6px; border: var(--hair) solid var(--line); background: var(--card); }
.de-hint { color: var(--text-2); font-size: .75rem; line-height: 1.4; }
.de-warn { color: var(--warn); background: var(--warn-bg); padding: 6px 9px; border-radius: 8px; font-size: .75rem; line-height: 1.4; }

/* área principal */
.de-main { display: grid; grid-template-columns: 48px minmax(0, 1fr) 312px; min-height: 0; }
.de-tools { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border-right: var(--hair) solid var(--line); overflow-y: auto; scrollbar-width: none; }
.de-tools hr { width: 26px; border: 0; border-top: var(--hair) solid var(--line); margin: 5px 0; }
.de-tool { width: 36px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 0; background: none; cursor: pointer; color: var(--text-2); flex: none; }
.de-tool:hover { background: var(--fill); color: var(--text); }
.de-tool[aria-pressed="true"] { background: var(--de-acc-t); color: var(--de-acc); }
.de-swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.de-fgbg { position: relative; width: 36px; height: 36px; }
.de-fgbg span { position: absolute; width: 22px; height: 22px; border-radius: 5px; overflow: hidden; box-shadow: 0 0 0 1.5px var(--card), 0 0 0 2.5px var(--line2, var(--line)); }
.de-fgbg .fg { left: 0; top: 0; z-index: 1; } .de-fgbg .bg { right: 0; bottom: 0; }
.de-fgbg input { width: 40px; height: 40px; margin: -9px; border: 0; padding: 0; cursor: pointer; }
.de-center { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.de-view { position: relative; overflow: hidden; background: var(--de-ws); min-height: 0; }
.de-canvas { position: absolute; inset: 0; touch-action: none; outline: none; }
.de.drop .de-view::after { content: "Solte a imagem para abrir como camada"; position: absolute; inset: 12px; border: 2px dashed var(--de-acc); border-radius: 14px; display: grid; place-items: center; color: var(--de-acc); font-weight: 600; background: var(--de-acc-t); pointer-events: none; }

/* páginas */
.de-pages { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-top: var(--hair) solid var(--line); overflow-x: auto; min-height: 48px; }
.de-page { position: relative; display: grid; place-items: center; padding: 2px; border-radius: 6px; border: 0; background: none; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.de-page canvas { width: 28px; height: 35px; display: block; }
.de-page span { position: absolute; right: 2px; bottom: 1px; font-size: 10px; font-weight: 600; color: #fff; text-shadow: 0 0 2px #000; }
.de-page.on { box-shadow: 0 0 0 2px var(--de-acc); }

/* lateral */
.de-side { display: grid; grid-template-rows: minmax(0, 1.7fr) minmax(150px, 1fr); border-left: var(--hair) solid var(--line); min-height: 0; }
.de-panel { display: flex; flex-direction: column; min-height: 0; }
.de-panel-layers { border-top: var(--hair) solid var(--line); }
.de-panel-layers header { padding: 8px 12px 4px; }
.de-ptabs { flex: none; display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: var(--hair) solid var(--line); overflow-x: auto; scrollbar-width: none; }
.de-ptabs button { background: none; border: 0; padding: 6px 8px 7px; border-bottom: 2px solid transparent; cursor: pointer; color: var(--text-2); white-space: nowrap; font-size: .75rem; }
.de-ptabs button.on { color: var(--text); border-bottom-color: var(--de-acc); font-weight: 600; }
.de-panel-body { overflow-y: auto; padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 7px; user-select: text; }
.de-panel-body h4 { margin: 10px 0 0; font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.de-title { display: flex; gap: 6px; align-items: center; }
.de-name { flex: 1; min-width: 0; font-weight: 600; padding: 5px 7px; border-radius: 6px; border: var(--hair) solid transparent; background: none; }
.de-name:hover, .de-name:focus { border-color: var(--line); background: var(--fill); }
.de-kind { font-size: .6875rem; color: var(--text-3); }
.de-row { display: grid; grid-template-columns: 98px minmax(0, 1fr) 40px; align-items: center; gap: 8px; color: var(--text-2); }
.de-row output { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-size: .75rem; }
.de-row input[type=range], .de-rng input { width: 100%; accent-color: var(--de-acc); }
.de-field { display: flex; flex-direction: column; gap: 3px; color: var(--text-2); font-size: .75rem; min-width: 0; }
.de-field.chk, .de .chk { flex-direction: row; align-items: center; gap: 7px; display: flex; }
.de-field input:not([type=checkbox]):not([type=color]):not([type=range]), .de-field select, .de-field textarea, .de-textarea { width: 100%; padding: 6px 8px; border-radius: 7px; border: var(--hair) solid var(--line2, var(--line)); background: var(--card); }
.de-textarea { resize: vertical; min-height: 60px; }
.de-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.de-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.de-btnrow { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.de-btnrow.end { justify-content: flex-end; margin-top: 8px; }
.de-btn { padding: 5px 10px; border-radius: 7px; border: var(--hair) solid var(--line2, var(--line)); background: var(--card); cursor: pointer; white-space: nowrap; }
.de-btn:hover { background: var(--fill); }
.de-btn.primary { background: var(--de-acc); border-color: var(--de-acc); color: #fff; }
.de-mini { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 6px; border: 0; background: none; cursor: pointer; color: var(--text-2); }
.de-mini:hover { background: var(--fill); color: var(--text); }
.de-mini.on { color: var(--de-acc); }
.de-color { display: flex; align-items: center; gap: 6px; }
.de-color input[type=color] { width: 40px; height: 26px; border: var(--hair) solid var(--line); border-radius: 6px; padding: 1px; background: var(--card); }
.de-fx { border-radius: 8px; box-shadow: 0 0 0 var(--hair) var(--line); padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; }
.de-fx.on { background: var(--fill); }
.de-face { font-size: .75rem; align-items: flex-start !important; }
.de-empty { color: var(--text-3); text-align: center; padding: 20px 6px; }
.de-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.de-hist button { width: 100%; text-align: left; border: 0; background: none; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.de-hist button.on { background: var(--de-acc-t); color: var(--de-acc); font-weight: 600; }
.de-hist button.future { opacity: .45; }
.de-hist button:hover { background: var(--fill); }

/* camadas */
.de-layers { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.de-llist { list-style: none; margin: 0; padding: 4px 6px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.de-layer { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 8px; cursor: pointer; }
.de-layer:hover { background: var(--fill); }
.de-layer.on { background: var(--de-acc-t); }
.de-layer.off .nm, .de-layer.off canvas { opacity: .45; }
.de-layer.dropto { box-shadow: inset 0 2px 0 var(--de-acc); }
.de-layer canvas { width: 30px; height: 30px; border-radius: 4px; flex: none; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 10px 10px; box-shadow: 0 0 0 var(--hair) var(--line); }
.de-maskthumb canvas { width: 20px; height: 20px; }
.de-layer .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de-badge { color: var(--warn); display: inline-flex; }
.de-lacts { display: flex; justify-content: space-around; padding: 4px; border-top: var(--hair) solid var(--line); }

/* IA */
.de-aistatus { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; background: var(--fill); }
.de-aistatus .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.de-aistatus.on .dot { background: #2e9e5b; } .de-aistatus.off .dot { background: #d93a2f; }
.de-aistatus span:nth-child(2) { flex: 1; }
.de-ailist { display: flex; flex-direction: column; gap: 4px; }
.de-aibtn { display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 8px 9px; border-radius: 9px; border: var(--hair) solid var(--line); background: var(--card); cursor: pointer; }
.de-aibtn:hover:not(:disabled) { border-color: var(--de-acc); background: var(--de-acc-t); }
.de-aibtn:disabled { opacity: .5; cursor: wait; }
.de-aibtn svg { flex: none; margin-top: 1px; color: var(--de-acc); }
.de-aibtn span { display: flex; flex-direction: column; gap: 1px; } .de-aibtn small { color: var(--text-2); font-size: .6875rem; line-height: 1.35; }
.de code { font-size: .75rem; background: var(--fill); padding: 1px 5px; border-radius: 4px; }

/* status, aviso e diálogos */
.de-status { display: flex; gap: 16px; padding: 4px 12px; border-top: var(--hair) solid var(--line); color: var(--text-2); font-size: .6875rem; font-variant-numeric: tabular-nums; background: var(--fill); }
.de-brand { font-weight: 600; color: var(--text); }
.de-toast { position: absolute; left: 50%; bottom: 46px; transform: translate(-50%, 12px); max-width: min(560px, 90%); background: color-mix(in srgb, var(--text) 92%, transparent); color: var(--card); padding: 9px 14px; border-radius: 10px; font-size: .8125rem; line-height: 1.4; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; }
.de-toast.on { opacity: 1; transform: translate(-50%, 0); }
.de-modal { position: absolute; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0,0,0,.35); padding: 16px; }
.de-card { width: min(560px, 100%); max-height: 100%; overflow-y: auto; background: var(--card); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.5); user-select: text; }
.de-card h3 { margin: 0 0 2px; font-size: 1.0625rem; }
.de-rng { display: grid; grid-template-columns: 1fr 44px; gap: 8px; align-items: center; } .de-rng output { text-align: right; color: var(--text); }
.de-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.de-preset { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 10px; border: var(--hair) solid var(--line); background: var(--card); cursor: pointer; }
.de-preset:hover { border-color: var(--de-acc); background: var(--de-acc-t); }
.de-preset i { display: block; height: 46px; max-width: 70px; background: var(--fill); border: 1.5px solid var(--text-3); border-radius: 3px; }
.de-preset span { color: var(--text-3); font-size: .6875rem; }
.de-drafts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.de-draft { display: flex; flex-direction: column; gap: 4px; font-size: .75rem; } .de-draft img { width: 100%; border-radius: 8px; background: var(--fill); } .de-draft span { color: var(--text-3); }
.de-drop { border: 1.5px dashed var(--line2, var(--line)); border-radius: 10px; padding: 18px; text-align: center; color: var(--text-2); cursor: pointer; }
.de-drop.on, .de-drop:hover { border-color: var(--de-acc); background: var(--de-acc-t); }
.de-shots { display: flex; gap: 8px; overflow-x: auto; }
.de-shots figure { margin: 0; flex: none; width: 92px; } .de-shots img { width: 92px; height: 115px; object-fit: cover; border-radius: 6px; display: block; }
.de-shots figcaption { display: flex; justify-content: space-between; align-items: center; font-size: .6875rem; color: var(--text-2); }

[data-tip] { position: relative; }
.de [data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); white-space: nowrap; background: var(--text); color: var(--card); padding: 4px 8px; border-radius: 6px; font-size: .6875rem; z-index: 80; pointer-events: none; }
.de-menubar [data-tip]:hover::after, .de-lacts [data-tip]:hover::after, .de-pages [data-tip]:hover::after, .de-opts [data-tip]:hover::after { left: 50%; top: auto; bottom: calc(100% + 6px); transform: translateX(-50%); }
.de-menubar [data-tip]:hover::after { bottom: auto; top: calc(100% + 6px); }

@media (max-width: 980px) { .de-main { grid-template-columns: 44px minmax(0, 1fr); } .de-side { position: absolute; right: 0; top: 84px; bottom: 26px; width: min(312px, 86%); background: var(--card); z-index: 40; box-shadow: -10px 0 30px -12px rgba(0,0,0,.3); } .de { height: calc(100vh - 120px); } }
.de input[type=range] { -webkit-appearance: auto; appearance: auto; background: none; border: 0; padding: 0; height: auto; min-height: 0; box-shadow: none; width: 100%; accent-color: var(--de-acc); }
.de input[type=checkbox] { width: auto; height: auto; min-height: 0; accent-color: var(--de-acc); }
.de-lock { opacity: .3; } .de-layer:hover .de-lock { opacity: .7; } .de-lock.on { opacity: 1; color: var(--warn); }
/* balão "Vindo do Arts" (js/de-ui.js showIncoming / js/arts-edit.js) */
.de-in { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30; display: grid; gap: 10px; justify-items: center; max-width: min(440px, 90%); padding: 14px; border-radius: 22px; background: var(--card); box-shadow: 0 0 0 var(--hair, 1px) var(--line), 0 24px 60px -12px rgba(0, 0, 0, .45); animation: de-in-pop .35s cubic-bezier(.2, .8, .2, 1); }
.de-in.busy { opacity: .6; pointer-events: none; }
.de-in-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px; border: 0; border-radius: 16px; background: var(--fill, rgba(127,127,127,.1)); cursor: pointer; text-align: left; }
.de-in-card:hover { background: color-mix(in srgb, var(--de-acc) 14%, transparent); }
.de-in-card img, .de-in-ph { width: 96px; height: 120px; flex: none; object-fit: cover; border-radius: 10px; background: #000; }
.de-in-txt { display: grid; gap: 4px; min-width: 0; } .de-in-txt small { color: var(--de-acc); font-weight: 700; font-size: .75rem; } .de-in-txt b { font-size: 1rem; } .de-in-txt span { color: var(--text-2); font-size: .8125rem; }
.de-in-note { margin: 0; font-size: .75rem; color: var(--text-2); text-align: center; }
.de-in-x { border: 0; background: none; color: var(--text-2); cursor: pointer; font-size: .8125rem; }
@keyframes de-in-pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } }
