/* Design editor (poster, flyer, invitation, social post, presentation and logo makers). */
.de {
    --de-w: min(1520px, calc(100vw - 56px));
    --de-sel: #8B5CF6;
    position: relative; display: flex; flex-direction: column;
    width: var(--de-w); margin: 0 0 28px calc((100% - var(--de-w)) / 2);
    height: clamp(620px, calc(100dvh - 110px), 1040px);
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow-2); overflow: hidden;
}
@media (min-width: 1100px) { .de { --de-w: min(1520px, calc(100vw - var(--side-w) - 56px)); } }
.de [hidden] { display: none !important; }
.de.is-full { position: fixed; inset: 0; z-index: 80; width: auto; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
html.de-full-open { overflow: hidden; }

/* ---------- Buttons ---------- */
.de-ibtn {
    display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px;
    background: none; color: var(--ink); cursor: pointer;
}
.de-ibtn .icon { width: 18px; height: 18px; }
.de-ibtn:hover:not(:disabled) { background: var(--mist); }
.de-ibtn:disabled { opacity: 0.35; cursor: default; }
.de-ibtn[aria-pressed="true"] { background: #F1EBFF; color: #5B21B6; }
.de-danger:hover:not(:disabled) { background: var(--bad-soft); color: var(--bad); }
.de-tbtn {
    display: inline-flex; align-items: center; gap: 7px; flex: none; height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--paper); color: var(--ink); font: 500 0.88rem var(--text); white-space: nowrap; cursor: pointer;
}
.de-tbtn .icon { width: 16px; height: 16px; }
.de-tbtn:hover, .de-tbtn[aria-expanded="true"] { border-color: var(--line-strong); background: var(--canvas); }
.de-chip-color { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(15 29 58 / 0.18); }
.de-link { display: inline-block; margin-top: 10px; padding: 0; border: 0; background: none; color: var(--signal-ink); font: 500 0.9rem var(--text); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.de-wide { width: 100%; justify-content: center; }
.de :focus-visible { outline: 2px solid var(--de-sel); outline-offset: 1px; }

/* ---------- Top bar ---------- */
.de-top { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 12px; border-bottom: 1px solid var(--line); }
.de .de-name {
    width: min(280px, 34vw); min-width: 0; padding: 6px 9px; border: 1px solid transparent; border-radius: 8px; background: none;
    color: var(--ink); font: 600 1rem var(--display);
}
.de .de-name:hover { border-color: var(--line); }
.de .de-name:focus { border-color: var(--de-sel); outline: none; background: var(--paper); box-shadow: none; }
.de-size { color: var(--slate); font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.de-saved { color: var(--slate-2); font-size: 0.82rem; white-space: nowrap; }
.de-spacer { flex: 1; }

/* ---------- Main area ---------- */
.de-main { position: relative; flex: 1; display: flex; min-height: 0; }
.de-rail {
    display: flex; flex-direction: column; gap: 2px; flex: none; width: 78px; padding: 8px 6px; border-right: 1px solid var(--line);
    background: var(--paper); overflow-y: auto;
}
.de-rail button {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px 8px; border: 0; border-radius: 10px;
    background: none; color: var(--slate); font: 500 0.72rem var(--text); cursor: pointer;
}
.de-rail .icon { width: 22px; height: 22px; }
.de-rail button:hover { background: var(--canvas); color: var(--ink); }
.de-rail button[aria-pressed="true"] { background: #F1EBFF; color: #5B21B6; }

.de-drawer { display: flex; flex-direction: column; flex: none; width: 330px; border-right: 1px solid var(--line); background: var(--paper); overflow-y: auto; }
.de-drawer-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 8px 16px; background: var(--paper); }
.de-drawer-head strong { font: 700 1.02rem var(--display); }
.de-panel { padding: 0 16px 20px; }
.de-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 0 8px; font-weight: 600; font-size: 0.86rem; color: var(--ink); }
.de-label span { color: var(--slate-2); font-weight: 400; font-size: 0.78rem; text-align: right; }
.de-note { margin: 8px 0 12px; color: var(--slate); font-size: 0.84rem; line-height: 1.45; }
.de .de-search { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 0.92rem; background: var(--canvas); }
.de .de-search:focus { outline: none; border-color: var(--de-sel); background: var(--paper); }

.de-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.de-chip { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: 500 0.82rem var(--text); cursor: pointer; }
.de-chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.de-tpls { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 10px; }
.de-tpls li { break-inside: avoid; margin-bottom: 10px; }
.de-tpls button { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.de-tpls img { display: block; width: 100%; height: auto; border-radius: 8px; box-shadow: 0 0 0 1px var(--line); background: var(--mist); }
.de-tpls button:hover img { box-shadow: 0 0 0 2px var(--de-sel); }
.de-tpls span { display: block; padding: 5px 2px 0; font-size: 0.8rem; color: var(--slate); }

.de-add-text {
    display: block; width: 100%; margin-bottom: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--canvas); color: var(--ink); text-align: left; cursor: pointer; font-family: Montserrat, var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.de-add-text:hover { border-color: var(--line-strong); background: var(--paper); }
.de-add-h { font-size: 1.5rem; font-weight: 800; }
.de-add-s { font-size: 1.1rem; font-weight: 700; }
.de-add-b { font-size: 0.88rem; }
.de-combos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.de-combo {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; min-height: 92px; padding: 10px 6px; border: 1px solid var(--line);
    border-radius: 10px; background: var(--canvas); color: var(--ink); line-height: 1.1; text-align: center; cursor: pointer; overflow: hidden;
}
.de-combo:hover { border-color: var(--de-sel); background: var(--paper); }
.de-combo span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.de-shapes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.de-shapes button { display: grid; place-items: center; aspect-ratio: 1; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); cursor: pointer; }
.de-shapes button:hover { border-color: var(--de-sel); background: var(--paper); }
.de-shapes svg { width: 100%; height: 100%; fill: #55627A; }
.de-shapes svg.is-frame { fill: #DCE3EC; stroke: #8B97AA; stroke-width: 1.5; stroke-dasharray: 3 2.5; }
.de-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; margin-top: 10px; color: var(--slate); font-size: 0.86rem; }
.de-icons button { display: grid; place-items: center; aspect-ratio: 1; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; }
.de-icons button:hover { background: var(--mist); }
.de-icons svg { width: 26px; height: 26px; }
.de-pop-chart { width: 300px; }
.de-pop-chart .field { margin-bottom: 10px; }
.de-pop-chart textarea { width: 100%; font: 0.9rem/1.45 var(--mono); }
.de-stickers { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.de-stickers button { aspect-ratio: 1; border: 0; border-radius: 8px; background: none; font-size: 1.35rem; line-height: 1; cursor: pointer; }
.de-stickers button:hover { background: var(--mist); }
.de-photo-chips { margin: 8px 0 4px; }
.de-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.de-photos button { padding: 0; aspect-ratio: 4 / 3; border: 0; border-radius: 8px; overflow: hidden; background: var(--mist); cursor: pointer; }
.de-photos button:disabled { opacity: 0.5; cursor: progress; }
.de-photos img { display: block; width: 100%; height: 100%; object-fit: cover; }
.de-photos button:hover img { transform: scale(1.04); transition: transform 0.15s ease; }

.de-uploads { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.de-upload { padding: 0; border: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: var(--mist); cursor: pointer; }
.de-upload img { width: 100%; height: 100%; object-fit: cover; display: block; }
.de-upload:hover { box-shadow: 0 0 0 2px var(--de-sel); }

.de-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 7px; }
.de-swatch { aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(15 29 58 / 0.16); cursor: pointer; }
.de-swatch:hover { box-shadow: inset 0 0 0 1px rgb(15 29 58 / 0.16), 0 0 0 2px var(--paper), 0 0 0 4px var(--de-sel); }
.de-panel .btn + .btn { margin-top: 8px; }

.de-brand-logo { display: block; width: 100%; height: 110px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); cursor: pointer; overflow: hidden; }
/* width/height 100% with object-fit (a percentage max-height doesn't resolve here, so big logos spilled out). */
.de-brand-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.de-brand-logo:hover { border-color: var(--de-sel); }
#de-brand .btn { margin-top: 10px; }

.de-designs { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.de-designs li { display: flex; align-items: center; gap: 4px; border-radius: 10px; }
.de-designs li.is-on { background: #F6F2FF; }
.de-design { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; cursor: pointer; }
.de-design:hover { background: var(--canvas); }
.de-design-thumb { display: grid; place-items: center; flex: none; width: 54px; height: 54px; border-radius: 6px; background: var(--mist); overflow: hidden; }
.de-design-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.de-design strong { display: block; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de-design small { color: var(--slate); font-size: 0.78rem; }

/* Magic design */
.de-panel[data-panel="magic"] .field { margin-bottom: 10px; }
.de-panel[data-panel="magic"] .field label { font-size: 0.84rem; }
.de-panel[data-panel="magic"] .de-link { display: block; margin: 8px auto 0; }
.de-mg-progress { margin-top: 12px; }
.de-mg-privacy { margin-top: 12px; font-size: 0.78rem; }
.de-mg-fields { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.de-mg-results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; align-items: start; }
.de-mg-results > p { grid-column: 1 / -1; margin: 0; }
.de-mg-result { display: block; padding: 0; border: 0; background: none; cursor: pointer; }
.de-mg-result img { display: block; width: 100%; height: auto; border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
.de-mg-result:hover img { box-shadow: 0 0 0 2px var(--de-sel); }

/* ---------- Work area ---------- */
.de-work { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; background: #ECEFF4; }
.de-ctx {
    display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 8px 10px; border-bottom: 1px solid var(--line);
    background: var(--paper); overflow-x: auto; scrollbar-width: none;
}
.de-ctx::-webkit-scrollbar { display: none; }
.de-ctx-group { display: flex; align-items: center; gap: 4px; flex: none; }
.de-ctx-end { margin-left: auto; padding-left: 10px; }
.de-ctx-hint { color: var(--slate); font-size: 0.86rem; white-space: nowrap; padding: 0 6px; }
.de-font-btn { width: 168px; justify-content: space-between; }
.de-font-btn span { overflow: hidden; text-overflow: ellipsis; }
.de-num { display: inline-flex; align-items: center; height: 34px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.de-num button { display: grid; place-items: center; width: 28px; height: 100%; border: 0; background: none; color: var(--ink); cursor: pointer; }
.de-num button:hover { background: var(--canvas); }
.de-num .icon { width: 14px; height: 14px; }
.de .de-num input { width: 46px; height: 100%; padding: 0; border-radius: 0; box-shadow: none; border: 0; border-inline: 1px solid var(--line); text-align: center; font: 500 0.9rem var(--text); -moz-appearance: textfield; }
.de-num input::-webkit-inner-spin-button { display: none; }
.de-text-color { flex-direction: column; justify-content: center; gap: 0; width: 34px; padding: 0; }
.de-text-color span { font: 700 1rem/1 var(--display); }
.de-text-color i { width: 18px; height: 4px; margin-top: 2px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgb(15 29 58 / 0.18); }
.de-case { font: 600 0.9rem var(--text); }
.de-range-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--slate); }
.de-range-inline input { width: 100px; accent-color: var(--de-sel); }

.de-stage { position: relative; flex: 1; display: grid; place-items: center; overflow: auto; padding: 24px; min-height: 0; }
.de-stage.is-drop { outline: 3px dashed var(--de-sel); outline-offset: -10px; }
.de-paper { position: relative; line-height: 0; background: #fff; box-shadow: 0 1px 3px rgb(15 29 58 / 0.12), 0 12px 32px -12px rgb(15 29 58 / 0.25); }
.de-paper.is-clear { background: repeating-conic-gradient(#E3E7EE 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.de-loading { position: absolute; inset: 0; display: grid; place-items: center; background: #ECEFF4; color: var(--slate); font-weight: 500; }

.de-bottom { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--paper); }
.de-pages { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.de-thumb { position: relative; flex: none; height: 58px; padding: 0; border: 2px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; cursor: pointer; }
.de-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.de-thumb span { position: absolute; left: 3px; bottom: 3px; min-width: 16px; padding: 0 4px; border-radius: 4px; background: rgb(15 29 58 / 0.7); color: #fff; font-size: 0.68rem; line-height: 16px; }
.de-thumb.is-on { border-color: var(--de-sel); }
.de-page-actions { display: flex; align-items: center; gap: 2px; flex: none; padding-left: 4px; }
.de-zoom { display: flex; align-items: center; gap: 2px; flex: none; }
.de-zoom-label { min-width: 54px; height: 30px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: 500 0.86rem var(--text); cursor: pointer; }
.de-zoom-label:hover { background: var(--mist); }

/* ---------- Pop-overs ---------- */
.de-pop-share { width: 320px; }
.de:not([data-kind="invitation"]) .de-rsvp-btn { display: none; }
.de:not([data-kind="menu"]) .de-menu-btn { display: none; }
#de-menu .btn + .btn, #de-menu .de-row + .btn { margin-top: 8px; }
.de-pop-rsvp { width: 360px; }
.de-rsvp-form { display: flex; flex-direction: column; gap: 10px; }
.de-rsvp-form .field { margin: 0; }
.de-rsvp-form .field label { font-size: 0.84rem; }
#de-rsvp-on { display: flex; flex-direction: column; gap: 10px; }
#de-rsvp-on .de-row { margin: 0; }
.de-rsvp-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.de-rsvp-totals div { padding: 8px; border-radius: 10px; background: var(--canvas); text-align: center; }
.de-rsvp-totals strong { display: block; font: 700 1.3rem var(--display); }
.de-rsvp-totals span { color: var(--slate); font-size: 0.76rem; }
.de-rsvp-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; border-top: 1px solid var(--line); }
.de-rsvp-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.de-rsvp-list small { grid-column: 1 / -1; color: var(--slate); }
.de-rsvp-list .is-yes { color: var(--good); font-weight: 600; }
.de-rsvp-list .is-no { color: var(--bad); font-weight: 600; }
.de-rsvp-list .is-maybe { color: var(--warn); font-weight: 600; }
.de-rsvp-links { display: flex; justify-content: space-between; }
.de-rsvp-links .de-link { margin: 0; }
.de-danger-link { color: var(--bad); }
.de .de-share-url { flex: 1; min-width: 0; padding: 7px 9px; font-size: 0.84rem; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); }
.de-pop {
    position: absolute; z-index: 60; width: 280px; max-height: min(70vh, 520px); overflow-y: auto; padding: 14px; border: 1px solid var(--line);
    border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-3);
}
.de-pop .field { margin-bottom: 12px; }
.de-pop .checkbox { display: flex; margin: 4px 0 12px; font-size: 0.92rem; }
.de-pop-title { margin: 10px 0 8px; font-weight: 600; font-size: 0.82rem; color: var(--slate); }
.de-pop-title:first-child { margin-top: 0; }
.de-pop-font { width: 270px; padding: 10px; }
.de-font-list { max-height: 340px; overflow-y: auto; margin-top: 8px; }
.de-font { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font-size: 1.12rem; text-align: left; cursor: pointer; }
.de-font:hover { background: var(--canvas); }
.de-font.is-on { background: #F1EBFF; }
.de-custom-color { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-weight: 500; font-size: 0.9rem; cursor: pointer; }
.de .de-custom-color input { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
.de-range { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; margin-bottom: 12px; font-weight: 500; font-size: 0.9rem; }
.de-range output { color: var(--slate); font-variant-numeric: tabular-nums; }
.de-range input { grid-column: 1 / -1; width: 100%; accent-color: var(--de-sel); }
.de-row { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.de-row input[type="range"] { flex: 1; accent-color: var(--de-sel); }
.de .de-row input[type="number"] { width: 90px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.de-grid2, .de-grid3 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.de-grid3 { grid-template-columns: 1fr 1fr 1fr; }
.de-grid2 .de-tbtn, .de-grid3 .de-tbtn { justify-content: center; padding: 0 6px; }
.de-pop-new { width: min(560px, calc(100% - 16px)); }
.de-formats > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.de-formats .de-label { grid-column: 1 / -1; margin: 12px 0 2px; }
.de-formats > div:first-child .de-label { margin-top: 0; }
.de-format {
    display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 0 10px; padding: 8px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--paper); color: var(--ink); text-align: left; cursor: pointer;
}
.de-format:hover { border-color: var(--de-sel); background: #FAF8FF; }
.de-format[aria-current] { border-color: var(--de-sel); background: #F4F0FF; }
.de-format-box { grid-row: span 2; justify-self: center; max-width: 30px; max-height: 30px; width: 30px; border: 2px solid var(--ink); border-radius: 3px; }
.de-format span:nth-child(2) { font-weight: 600; font-size: 0.86rem; line-height: 1.25; }
.de-format small { color: var(--slate); font-size: 0.74rem; }
.de-custom { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--line); }

.de-status:empty { display: none; }
.de-status {
    position: absolute; left: 50%; bottom: 84px; z-index: 55; transform: translateX(-50%); max-width: calc(100% - 32px); margin: 0;
    padding: 8px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 0.88rem; box-shadow: var(--shadow-3);
}

/* ---------- Phones and small tablets: the rail becomes a bottom bar and panels slide up over the page ---------- */
@media (max-width: 899px) {
    .de { --de-w: calc(100% + 40px); margin-left: -20px; height: calc(100dvh - var(--tabbar-h, 0px) - 70px); min-height: 520px; border-radius: 0; border-inline: 0; box-shadow: none; }
    .de.is-full { height: 100dvh; }
    .de-hide-sm, .de-size, .de-ctx-hint { display: none !important; }
    .de-name { width: auto; flex: 1; }
    .de-main { flex-direction: column; }
    .de-work { order: 1; }
    .de-rail { order: 3; flex-direction: row; width: auto; padding: 4px 6px; border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
    .de-rail button { flex: 1 0 62px; padding: 6px 2px; }
    .de-rail .icon { width: 20px; height: 20px; }
    .de-drawer {
        order: 2; position: absolute; left: 0; right: 0; bottom: 62px; z-index: 50; width: auto; max-height: 58%;
        border: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -12px 32px -12px rgb(15 29 58 / 0.3);
    }
    .de-stage { padding: 14px; }
    .de-thumb { height: 44px; }
    .de-bottom { padding: 6px 8px; }
    .de-font-btn { width: 132px; }
    .de-pop { max-width: calc(100% - 16px); }
    .de-status { bottom: 120px; }
}
@media (max-width: 600px) {
    .de { --de-w: calc(100% + 32px); margin-left: -16px; }
}
.de-mg-progress .progress { background: var(--mist); }

.de:not([data-cloud-ai^="http"]) .de-ai-only { display: none; }
.de-mg-pic { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--line); }
.de-mg-pic textarea { width: 100%; margin-bottom: 8px; }
.de-mg-pic .de-uploads { margin-top: 10px; }
#de-mg-local { margin-top: 8px; }

/* Animate */
.de-anim-styles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.de-anim-styles button { display: grid; justify-items: center; gap: 4px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font: 500 0.75rem var(--text); cursor: pointer; }
.de-anim-styles button[aria-pressed="true"] { border-color: var(--de-sel); background: #F4F0FF; }
.de-anim-ic { position: relative; width: 26px; height: 20px; border-radius: 4px; background: var(--mist); overflow: hidden; }
.de-anim-ic::after { content: ""; position: absolute; left: 6px; top: 6px; width: 14px; height: 8px; border-radius: 2px; background: var(--de-sel); }
.de-anim-ic.is-none::after { background: #9AA4B5; }
.de-anim-ic.is-fade::after { animation: de-fade 1.6s ease-out infinite; }
.de-anim-ic.is-rise::after { animation: de-rise 1.6s ease-out infinite; }
.de-anim-ic.is-slide::after { animation: de-slide 1.6s ease-out infinite; }
.de-anim-ic.is-pop::after { animation: de-pop 1.6s ease-out infinite; }
@keyframes de-fade { 0% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes de-rise { 0% { opacity: 0; transform: translateY(8px); } 50%, 100% { opacity: 1; transform: none; } }
@keyframes de-slide { 0% { opacity: 0; transform: translateX(-10px); } 50%, 100% { opacity: 1; transform: none; } }
@keyframes de-pop { 0% { opacity: 0; transform: scale(0.4); } 40% { transform: scale(1.1); } 55%, 100% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .de-anim-ic::after { animation: none !important; } }
.de-anim-play { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; pointer-events: none; }
#de-anim-btn.is-on { border-color: var(--de-sel); color: var(--de-sel); }

/* Layers panel */
.de-layers { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.de-layer { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: grab; }
.de-layer > .icon { flex: none; width: 16px; height: 16px; color: var(--slate); }
.de-layer.is-on { border-color: var(--de-sel); box-shadow: 0 0 0 1px var(--de-sel); }
.de-layer.is-hidden .de-layer-name, .de-layer.is-hidden > .icon { opacity: 0.45; }
.de-layer.is-drag { opacity: 0.5; }
.de-layer.is-target { border-top: 3px solid var(--de-sel); }
.de-layer .de-ibtn { flex: none; width: 30px; height: 30px; }
.de-layer-name { flex: 1; min-width: 0; padding: 6px 2px; border: 0; background: none; text-align: left; color: var(--ink); font: 500 0.88rem var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.de-layer-input { flex: 1; min-width: 0; padding: 4px 6px; font-size: 0.88rem; }

/* Size and position, distribute */
.de-distribute { margin-top: 6px; }
.de-pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.de-pos-grid label:not(.checkbox) { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--slate); }
.de-pos-grid input[type="number"] { width: 100%; min-width: 0; padding: 6px 8px; font-size: 0.88rem; }
.de-pos-angle { grid-column: 1 / -1; }
.de-pos-ratio { grid-column: 1 / -1; font-size: 0.84rem; }
.de-grid3 .de-tbtn .icon, .de-grid2 .de-tbtn .icon { flex: none; }

/* Photo filters */
.de-pop-filters { width: 300px; }
.de-filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.de-filter-grid button { display: flex; flex-direction: column; gap: 4px; padding: 3px; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; font: 500 0.76rem var(--text); color: var(--ink); }
.de-filter-grid button[aria-pressed="true"] { border-color: var(--de-sel); }
.de-filter-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; background: var(--mist); }

/* Photo shapes */
.de-mask-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.de-mask-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; font: 500 0.74rem var(--text); color: var(--ink); }
.de-mask-grid button[aria-pressed="true"] { border-color: var(--de-sel); box-shadow: 0 0 0 1px var(--de-sel); }
.de-mask-ic { width: 28px; height: 28px; background: linear-gradient(135deg, #A78BFA, #F472B6); }
.de-mask-ic.is-rounded { border-radius: 7px; }
.de-mask-ic.is-circle { border-radius: 50%; }
.de-mask-ic.is-arch { border-radius: 14px 14px 0 0; }
.de-mask-ic.is-heart { clip-path: path("M14 25C14 25 1.5 17.6 1.5 8.8A6.3 6.3 0 0 1 14 6.5A6.3 6.3 0 0 1 26.5 8.8C26.5 17.6 14 25 14 25Z"); }
.de-mask-ic.is-star { clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.de-mask-ic.is-hexagon { clip-path: polygon(25% 7%, 75% 7%, 100% 50%, 75% 93%, 25% 93%, 0 50%); }
.de-mask-ic.is-diamond { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.de-mask-ic.is-blob { border-radius: 58% 42% 55% 45% / 45% 55% 45% 55%; }
.de-ctx-group[data-ctx="crop"] .btn { margin-left: 4px; }
/* On wide screens the toolbar wraps onto a second row rather than hiding buttons off the edge. */
@media (min-width: 900px) { .de-ctx { flex-wrap: wrap; } }

/* Lines, tables and codes in the Elements panel */
.de-lines svg path, .de-lines svg circle { fill: none; stroke: #55627A; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.de-lines svg .is-fill { fill: #55627A; stroke: none; }
.de-shapes svg.is-outline rect, .de-shapes svg.is-outline path { fill: none; stroke: #55627A; stroke-width: 2.5; }
.de-sticker-cat { margin: 10px 0 4px; color: var(--slate); font-size: 0.76rem; font-weight: 600; }
.de-inline-select { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--slate); white-space: nowrap; }
.de-inline-select select { padding: 5px 26px 5px 8px; font-size: 0.85rem; }

/* Text styles */
.de-pop-effects { width: 300px; }
.de-text-styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.de-text-styles button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; font: 500 0.7rem var(--text); color: var(--ink); }
.de-text-styles button[aria-pressed="true"] { border-color: var(--de-sel); box-shadow: 0 0 0 1px var(--de-sel); }
.de-ts { font: 800 1.25rem/1.1 var(--display); color: #1F2937; }
.de-ts.is-shadow { text-shadow: 1px 2px 3px rgb(0 0 0 / 0.45); }
.de-ts.is-lift { text-shadow: 0 3px 7px rgb(0 0 0 / 0.3); }
.de-ts.is-hollow { color: transparent; -webkit-text-stroke: 1px #1F2937; }
.de-ts.is-splice { color: transparent; -webkit-text-stroke: 1px #1F2937; text-shadow: 2px 2px 0 #1F2937; }
.de-ts.is-neon { color: #FF2E9A; text-shadow: 0 0 6px #FF2E9A; }
.de-ts.is-retro { text-shadow: 2px 2px 0 #F59E0B; }
.de-ts.is-glow { text-shadow: 0 0 6px rgb(255 222 89); }
.de-grad-custom { margin-top: 8px; }
.de-grad-custom input[type="color"] { width: 36px; height: 32px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 6px; }
.de-grad-custom select { padding: 5px 8px; }

/* More menu, version history, find and replace, notes */
.de-pop-more { padding: 6px; min-width: 220px; }
.de-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: 500 0.9rem var(--text); text-align: left; cursor: pointer; }
.de-menu-item:hover, .de-menu-item:focus-visible { background: var(--mist); }
.de-pop-history, .de-pop-find { width: 320px; }
.de-history { display: grid; gap: 6px; max-height: 360px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.de-history li { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.de-history img { width: 54px; height: 54px; object-fit: contain; border-radius: 4px; background: var(--mist); }
.de-history span { display: flex; flex: 1; flex-direction: column; min-width: 0; font-size: 0.86rem; }
.de-history small { color: var(--slate); }
.de-find-list { max-height: 160px; margin: 0 0 10px; padding: 0; overflow-y: auto; list-style: none; font-size: 0.85rem; }
.de-find-list .de-link { text-align: left; padding: 3px 0; }
#de-notes textarea { width: 280px; max-width: 100%; }
#de-notes-btn.has-notes { color: var(--de-sel); }
#de-notes-btn.has-notes::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--de-sel); }
#de-notes-btn { position: relative; }

/* All pages grid */
.de-gridview { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: var(--canvas, #F4F6FA); overflow: hidden; }
.de-work { position: relative; }
.de-gridview-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.de-gridview-head .de-note { flex: 1; margin: 0; }
.de-gridview-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; margin: 0; padding: 18px; overflow-y: auto; list-style: none; align-content: start; }
.de-gv-page { position: relative; display: flex; flex-direction: column; gap: 6px; cursor: grab; }
.de-gv-open { position: relative; width: 100%; padding: 0; border: 2px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; cursor: pointer; }
.de-gv-page.is-on .de-gv-open { border-color: var(--de-sel); }
.de-gv-page.is-drag { opacity: 0.45; }
.de-gv-page.is-target .de-gv-open { box-shadow: -6px 0 0 -2px var(--de-sel); }
.de-gv-open img { display: block; width: 100%; height: 100%; object-fit: contain; }
.de-gv-open span { position: absolute; left: 6px; bottom: 6px; padding: 1px 7px; border-radius: 999px; background: rgb(15 29 58 / 0.75); color: #fff; font: 600 0.75rem var(--text); }
.de-gv-acts { display: flex; justify-content: center; gap: 4px; }

/* Keyboard shortcuts */
.de-keys { width: min(520px, calc(100vw - 32px)); padding: 20px 24px; border: 0; border-radius: 14px; box-shadow: 0 30px 60px -20px rgb(15 29 58 / 0.45); }
.de-keys::backdrop { background: rgb(15 29 58 / 0.35); }
.de-keys-head { display: flex; align-items: center; justify-content: space-between; }
.de-keys-head h2 { margin: 0; font-size: 1.2rem; }
.de-keys-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; font-size: 0.9rem; }
.de-keys-list dt { font: 600 0.82rem var(--mono); color: var(--ink); white-space: nowrap; }
.de-keys-list dd { margin: 0; color: var(--ink-2); }
.de-pop-sub { font-weight: 400; }
.de-recolor { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.de-recolor button, .de-rc-any { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; font: 500 0.74rem var(--text); color: var(--ink); }
.de-recolor button[aria-pressed="true"], .de-rc-any.is-on { border-color: var(--de-sel); box-shadow: 0 0 0 1px var(--de-sel); }
.de-rc { width: 24px; height: 24px; border-radius: 50%; border: 1px solid #C3CCD8; }
.de-rc.is-none { background: conic-gradient(#FF5A1F, #F59E0B, #10B981, #2563EB, #8B5CF6, #FF5A1F); }
.de-rc-any input { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }

/* Draw panel */
.de-draw-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.de-draw-tools button { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; font: 600 0.86rem var(--text); color: var(--ink); }
.de-draw-tools button[aria-pressed="true"] { border-color: var(--de-sel); box-shadow: 0 0 0 1px var(--de-sel); color: var(--de-sel); }
.de.is-drawing .de-ctx { opacity: 0.5; pointer-events: none; }
.de-panel[data-panel="draw"] .de-range { margin-top: 12px; }
#de-draw-done { margin-top: 14px; }

/* Animation for one element */
.de-anim-el { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.de-anim-el .de-chip[aria-pressed="true"] { border-color: var(--de-sel); background: var(--de-sel); color: #fff; }

/* Download: other sizes; fonts upload; mockups */
.de-dl-sizes { margin: 6px 0 10px; }
.de-dl-sizes summary { cursor: pointer; font-weight: 600; font-size: 0.86rem; color: var(--ink); }
.de-dl-size-list { display: grid; gap: 4px; font-size: 0.86rem; }
.de-font-upload { margin: 0 0 8px; cursor: pointer; }
.de-pop-mockup { width: min(460px, calc(100vw - 16px)); }
.de-mockup-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.de-mockup-kinds .de-chip[aria-pressed="true"] { border-color: var(--de-sel); background: var(--de-sel); color: #fff; }
.de-mockup-stage canvas { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 10px; }
.de-pop-mockup .de-row { justify-content: space-between; }
.de-pop-mockup input[type="color"] { width: 36px; height: 30px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 6px; }

/* Bulk create */
.de-bulk { width: min(640px, calc(100vw - 32px)); }
.de-bulk textarea { width: 100%; font: 0.86rem var(--mono); }
.de-bulk-upload { margin: 8px 0 4px; cursor: pointer; }
.de-bulk-cols { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.de-bulk-check { display: grid; gap: 4px; margin: 8px 0; padding: 0; list-style: none; font-size: 0.88rem; }
.de-bulk-check li { position: relative; padding-left: 22px; }
.de-bulk-check li::before { position: absolute; left: 0; font-weight: 700; }
.de-bulk-check .is-ok::before { content: "✓"; color: var(--good); }
.de-bulk-check .is-bad::before { content: "!"; color: var(--bad); }
.de-bulk-go { justify-content: space-between; margin-top: 12px; }
.de-bulk-go .de-note { margin: 0; flex: 1; }
.de-brand-pick { width: 100%; margin-bottom: 10px; }
