/*
 * SINAPSE · capa de experiencia 2026
 * Bodega ecommerce, miniaplicaciones modales y editores de contenido.
 */
:root {
    --sinapse-ink: #11182c;
    --sinapse-blue: #315ee8;
    --sinapse-violet: #7657e8;
    --sinapse-cyan: #22b8cf;
    --sinapse-surface: rgba(255, 255, 255, .88);
    --sinapse-line: rgba(33, 48, 91, .12);
    --sinapse-shadow: 0 24px 70px rgba(25, 36, 77, .17);
}

[data-editing-only][hidden] {
    display: none !important;
}

body.admin-body .admin-edit-mode {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .7rem;
    align-items: center;
    margin: .7rem .65rem .9rem;
    padding: .72rem;
    border: 1px solid rgba(30, 30, 70, .24);
    border-radius: 16px;
    background: linear-gradient(145deg, #1e1e46, #315ee8);
    color: #fff !important;
    box-shadow: 0 12px 26px rgba(30, 30, 70, .2), inset 0 1px 0 rgba(255, 255, 255, .16);
}

body.admin-body .admin-edit-mode > div {
    display: grid;
    gap: .14rem;
    min-width: 0;
}

body.admin-body .admin-edit-mode strong {
    color: #fff !important;
    font-size: .66rem;
    letter-spacing: .08em;
}

body.admin-body .admin-edit-mode small {
    color: rgba(255, 255, 255, .78) !important;
    font-size: .48rem;
    line-height: 1.35;
}

.admin-edit-mode-switch {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.admin-edit-mode-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.admin-edit-mode-switch span {
    position: relative;
    width: 46px;
    height: 26px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    transition: background .2s ease, border-color .2s ease;
}

.admin-edit-mode-switch span::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
    content: "";
    transition: transform .2s ease;
}

.admin-edit-mode-switch input:checked + span {
    border-color: rgba(34, 211, 238, .7);
    background: linear-gradient(135deg, #315ee8, #22b8cf);
}

.admin-edit-mode-switch input:checked + span::after {
    transform: translateX(20px);
}

.admin-edit-mode-switch input:focus-visible + span {
    outline: 3px solid rgba(34, 184, 207, .35);
    outline-offset: 3px;
}

body.admin-body.admin-edit-mode-active .admin-edit-mode {
    border-color: rgba(34, 211, 238, .72);
    background: linear-gradient(135deg, #243c9b, #13899d);
    box-shadow: 0 14px 32px rgba(36, 60, 155, .26), inset 0 1px 0 rgba(255, 255, 255, .2);
}

.page-builder-pro-launch {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) auto;
    gap: 1.25rem;
    align-items: center;
    min-height: 260px;
    padding: clamp(1.25rem, 3vw, 2rem);
    overflow: hidden;
    border: 1px solid rgba(49, 94, 232, .15);
    background:
        radial-gradient(circle at 100% 0, rgba(34, 184, 207, .14), transparent 36%),
        linear-gradient(145deg, #fff, #f3f6ff);
}

.page-builder-pro-launch-icon {
    display: grid;
    width: 86px;
    height: 86px;
    place-items: center;
    border-radius: 26px;
    background: linear-gradient(145deg, #315ee8, #22b8cf);
    color: #fff;
    box-shadow: 0 18px 40px rgba(49, 94, 232, .28);
}

.page-builder-pro-launch-icon svg {
    width: 42px;
    height: 42px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.page-builder-pro-launch h2 {
    margin: .2rem 0 .55rem;
    color: #11182c;
    font-size: clamp(1.2rem, 2vw, 1.65rem);
}

.page-builder-pro-launch p:not(.eyebrow) {
    max-width: 70ch;
    margin: 0;
    color: #667085;
    font-size: .72rem;
    line-height: 1.6;
}

.page-builder-pro-launch ul {
    display: grid;
    gap: .36rem;
    margin: .9rem 0 0;
    padding-left: 1.1rem;
    color: #344054;
    font-size: .64rem;
}

.page-builder-pro-launch > .btn {
    min-width: 210px;
    min-height: 48px;
}
.page-builder-pro-launch > .admin-heading-actions {
    display: grid;
    min-width: 210px;
}
.page-builder-pro-launch > .admin-heading-actions .btn {
    justify-content: center;
    min-height: 44px;
}

.admin-app-grid .admin-app-external {
    box-sizing: border-box;
    text-decoration: none;
}

#tab-builder > .legacy-builder-interface,
#tab-builder > .builder-subtabs,
#tab-builder > .builder-subpanel {
    display: none !important;
}

.admin-edit-mode-active .admin-app-groups {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.builder-programmed-notice {
    display: grid;
    gap: .22rem;
    padding: .75rem .85rem;
    border: 1px solid rgba(245, 158, 11, .24);
    border-radius: 12px;
    background: rgba(255, 251, 235, .88);
    color: #78350f;
}

.builder-programmed-notice strong {
    font-size: .72rem;
}

.builder-programmed-notice span {
    font-size: .58rem;
    line-height: 1.45;
}

.builder-page-chip {
    display: inline-flex;
    gap: .38rem;
    align-items: center;
}

.builder-page-chip small {
    padding: .12rem .32rem;
    border-radius: 999px;
    background: rgba(34, 184, 207, .15);
    color: inherit;
    font-size: .45rem;
    text-transform: uppercase;
}

.builder-pages-manager {
    display: grid;
    grid-template-columns: minmax(280px, .8fr) minmax(320px, 1.2fr);
    gap: 1rem;
    margin-top: 1rem;
}

.builder-pages-list {
    display: grid;
    gap: .55rem;
}

.builder-pages-list article {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .6rem;
    align-items: center;
    padding: .65rem;
    border: 1px solid rgba(30, 30, 70, .1);
    border-radius: 12px;
    background: #f8fafc;
}

.builder-pages-list article div {
    display: grid;
    gap: .12rem;
}

.builder-pages-list small {
    color: #667085;
    font-size: .52rem;
}

.builder-pages-list button {
    min-height: 34px;
    border: 1px solid rgba(49, 94, 232, .2);
    border-radius: 9px;
    background: #fff;
    color: #315ee8;
    cursor: pointer;
    font-weight: 800;
}

.live-editor-page-picker {
    display: grid;
    gap: .2rem;
    min-width: 180px;
    color: #667085;
    font-size: .55rem;
    font-weight: 800;
}

.live-editor-page-picker select {
    min-height: 40px;
    border: 1px solid rgba(30, 30, 70, .14);
    border-radius: 10px;
    background: #fff;
    padding: .45rem .65rem;
    color: #11182c;
    font: inherit;
}

.live-editor-app {
    display: grid;
    gap: .75rem;
    padding: .75rem;
    overflow: hidden;
}

.live-editor-appbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .2rem .25rem;
}

.live-editor-appbar div {
    display: grid;
    gap: .12rem;
}

.live-editor-appbar small {
    color: #667085;
    font-size: .55rem;
}

.live-editor-appbar > span {
    padding: .28rem .52rem;
    border-radius: 999px;
    background: rgba(22, 163, 74, .12);
    color: #166534;
    font-size: .52rem;
    font-weight: 900;
    letter-spacing: .08em;
}

#live-editor-frame {
    width: 100%;
    height: calc(100dvh - 230px);
    min-height: 620px;
    border: 1px solid rgba(30, 30, 70, .12);
    border-radius: 14px;
    background: #edf2f7;
}

@media (max-width: 820px) {
    .builder-pages-manager {
        grid-template-columns: 1fr;
    }

    .page-builder-pro-launch {
        grid-template-columns: 1fr;
    }

    .page-builder-pro-launch > .btn {
        width: 100%;
    }

    #live-editor-frame {
        min-height: 540px;
        height: calc(100dvh - 260px);
    }

    .admin-body:not(.admin-edit-mode-active) .admin-bottom-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Botones primarios cortos y colocados junto al encabezado. */
.admin-body .admin-heading-actions .btn,
.admin-body .builder-studio-actions .btn,
.admin-body .form-title-row > .btn,
.admin-body .admin-editor-launcher {
    width: auto;
    min-height: 38px;
    padding: .52rem .82rem;
    border-radius: 10px;
}

.admin-editor-launcher {
    justify-self: start;
    margin: 0 0 .8rem;
}

/* Accesos a editores: se sienten como aplicaciones, no como botones sueltos. */
.admin-launcher-host {
    align-items: stretch;
}

.admin-app-launchpad {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(.85rem, 2vw, 1.25rem);
}

.admin-body .admin-editor-launcher {
    --launcher-accent: #315ee8;
    --launcher-accent-2: #7657e8;
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr) 34px;
    gap: .9rem;
    align-items: center;
    width: 100%;
    min-height: 126px;
    margin: 0 0 .85rem;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid rgba(49, 94, 232, .15);
    border-radius: 22px;
    background:
        radial-gradient(circle at 100% 0, color-mix(in srgb, var(--launcher-accent-2) 14%, transparent), transparent 43%),
        linear-gradient(145deg, rgba(255,255,255,.98), rgba(244,247,255,.94));
    color: var(--sinapse-ink);
    box-shadow: 0 14px 38px rgba(24, 38, 82, .1), inset 0 1px 0 #fff;
    cursor: pointer;
    text-align: left;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.admin-body .admin-editor-launcher::after {
    position: absolute;
    z-index: -1;
    right: -48px;
    bottom: -70px;
    width: 170px;
    height: 170px;
    border: 26px solid color-mix(in srgb, var(--launcher-accent) 7%, transparent);
    border-radius: 50%;
    content: "";
}

.admin-body .admin-editor-launcher:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--launcher-accent) 32%, transparent);
    box-shadow: 0 24px 54px rgba(24, 38, 82, .16), inset 0 1px 0 #fff;
}

.admin-launcher-icon {
    display: grid;
    width: 68px;
    height: 68px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 21px;
    background: linear-gradient(145deg, var(--launcher-accent), var(--launcher-accent-2));
    color: #fff;
    font-size: 1.65rem;
    font-weight: 850;
    box-shadow: 0 15px 32px color-mix(in srgb, var(--launcher-accent) 27%, transparent), inset 0 1px 0 rgba(255,255,255,.35);
}

.admin-launcher-copy {
    display: grid;
    min-width: 0;
    gap: .22rem;
}

.admin-launcher-copy small {
    color: var(--launcher-accent);
    font-size: .52rem;
    font-weight: 850;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.admin-launcher-copy strong {
    font-size: clamp(.86rem, 1.5vw, 1.08rem);
    line-height: 1.2;
}

.admin-launcher-copy > span {
    max-width: 55ch;
    color: #667085;
    font-size: .62rem;
    line-height: 1.5;
}

.admin-launcher-enter {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid rgba(49,94,232,.13);
    border-radius: 50%;
    background: rgba(255,255,255,.8);
    color: var(--launcher-accent);
    font-size: 1.35rem;
    transition: transform .2s ease, background .2s ease;
}

.admin-editor-launcher:hover .admin-launcher-enter {
    transform: translateX(3px);
    background: #fff;
}

.admin-editor-launcher[data-launcher-kind="media"] { --launcher-accent: #13899d; --launcher-accent-2: #315ee8; }
.admin-editor-launcher[data-launcher-kind="magazine"] { --launcher-accent: #db6d58; --launcher-accent-2: #9e3c69; }
.admin-editor-launcher[data-launcher-kind="news"] { --launcher-accent: #ca5676; --launcher-accent-2: #74408d; }
.admin-editor-launcher[data-launcher-kind="client"] { --launcher-accent: #12806b; --launcher-accent-2: #2e65ce; }
.admin-editor-launcher[data-launcher-kind="identity"] { --launcher-accent: #6c4bd7; --launcher-accent-2: #c04da1; }
.admin-editor-launcher[data-launcher-kind="message"] { --launcher-accent: #e45878; --launcher-accent-2: #744bd8; }
.admin-editor-launcher[data-launcher-kind="system"] { --launcher-accent: #6849d4; --launcher-accent-2: #a545bd; }

/* Fuente única para cualquier dato de marca que antes aparecía duplicado. */
.unified-source-card {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) auto;
    gap: .8rem;
    align-items: center;
    padding: .85rem;
    border: 1px solid rgba(108, 75, 215, .16);
    border-radius: 17px;
    background:
        radial-gradient(circle at 100% 0, rgba(192,77,161,.1), transparent 38%),
        linear-gradient(145deg, #fff, #f5f3ff);
    box-shadow: 0 12px 28px rgba(73, 51, 142, .08);
}

.unified-source-card h3,
.unified-source-card p {
    margin: 0;
}

.unified-source-card h3 {
    margin: .12rem 0 .22rem;
    color: #211b45;
    font-size: .8rem;
}

.unified-source-card p:not(.eyebrow) {
    color: #706b83;
    font-size: .58rem;
    line-height: 1.5;
}

.unified-source-icon {
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(145deg, #6c4bd7, #c04da1);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 12px 25px rgba(108,75,215,.24);
}

.unified-source-card button {
    min-height: 38px;
    padding: .5rem .7rem;
    border: 1px solid rgba(108,75,215,.18);
    border-radius: 10px;
    background: #fff;
    color: #5b3fc4;
    font: 800 .58rem/1.2 Inter, sans-serif;
    cursor: pointer;
}

.identity-single-source-badge {
    display: inline-flex;
    gap: .42rem;
    align-items: center;
    min-height: 38px;
    padding: .5rem .72rem;
    border: 1px solid rgba(22,129,111,.15);
    border-radius: 999px;
    background: rgba(22,129,111,.07);
    color: #116857;
    font-size: .56rem;
    font-weight: 800;
}

.identity-single-source-badge i,
.admin-editor-state i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #19a784;
    box-shadow: 0 0 0 4px rgba(25,167,132,.12);
}

.identity-source-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .38rem;
    padding: .32rem;
    border: 1px solid rgba(40,56,100,.1);
    border-radius: 14px;
    background: #eef1f8;
}

.identity-source-switch button {
    display: grid;
    min-width: 0;
    min-height: 56px;
    place-items: center;
    align-content: center;
    gap: .2rem;
    padding: .38rem .25rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #69748b;
    cursor: pointer;
    transition: .18s ease;
}

.identity-source-switch button span {
    font-size: .85rem;
    line-height: 1;
}

.identity-source-switch button strong {
    overflow: hidden;
    max-width: 100%;
    font-size: .51rem;
    text-overflow: ellipsis;
}

.identity-source-switch button[aria-pressed="true"] {
    border-color: rgba(108,75,215,.14);
    background: #fff;
    color: #5c3ec7;
    box-shadow: 0 7px 17px rgba(52,42,104,.1);
}

/* Bodega tipo catálogo ecommerce. */
.media-warehouse-layout {
    display: grid;
    grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.media-warehouse-layout > #media-form {
    position: sticky;
    top: 68px;
}

.media-warehouse-card {
    overflow: hidden;
}

.media-commerce-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .85rem;
    align-items: stretch;
}

.media-commerce-grid > .media-result-summary,
.media-commerce-grid > .admin-empty {
    grid-column: 1 / -1;
}

.media-product-card {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--sinapse-line);
    border-radius: 16px;
    background: linear-gradient(165deg, rgba(255,255,255,.98), rgba(244,247,255,.9));
    box-shadow: 0 10px 28px rgba(23, 38, 83, .08);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.media-product-card:hover {
    transform: translateY(-3px);
    border-color: rgba(49, 94, 232, .28);
    box-shadow: 0 18px 40px rgba(23, 38, 83, .14);
}

.media-product-preview {
    position: relative;
    display: grid;
    width: 100%;
    aspect-ratio: 4 / 3;
    place-items: center;
    overflow: hidden;
    border-bottom: 1px solid var(--sinapse-line);
    background:
        linear-gradient(45deg, rgba(49,94,232,.035) 25%, transparent 25%, transparent 75%, rgba(49,94,232,.035) 75%),
        linear-gradient(45deg, rgba(49,94,232,.035) 25%, #f8faff 25%, #f8faff 75%, rgba(49,94,232,.035) 75%);
    background-position: 0 0, 8px 8px;
    background-size: 16px 16px;
}

.media-product-preview img {
    display: block;
    width: 100%;
    height: 100%;
    padding: .45rem;
    object-fit: contain;
    object-position: center;
}

.media-product-preview .media-file-thumb {
    display: grid;
    width: 70px;
    height: 88px;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(145deg, #fff, #e8edff);
    color: var(--sinapse-blue);
    font-size: .72rem;
    font-weight: 900;
    box-shadow: 0 12px 28px rgba(49, 94, 232, .18);
}

.media-product-badge {
    position: absolute;
    top: .55rem;
    right: .55rem;
    padding: .3rem .48rem;
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 999px;
    background: rgba(17, 24, 44, .78);
    color: #fff;
    font-size: .52rem;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
    backdrop-filter: blur(12px);
}

.media-product-card.is-inactive {
    opacity: .66;
}

.media-product-card.is-inactive .media-product-badge {
    background: #9a3412;
}

.media-product-info {
    display: grid;
    gap: .28rem;
    min-width: 0;
    padding: .78rem .78rem .68rem;
}

.media-product-info strong {
    overflow: hidden;
    color: var(--sinapse-ink);
    font-size: .76rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-product-info span {
    color: #6b7280;
    font-size: .58rem;
    line-height: 1.35;
}

.media-product-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .38rem;
    padding: 0 .68rem .68rem;
}

.media-product-actions button,
.resend-template-actions button {
    min-height: 34px;
    padding: .4rem .45rem;
    border: 1px solid var(--sinapse-line);
    border-radius: 9px;
    background: #fff;
    color: #334155;
    font: 750 .58rem/1.2 Inter, sans-serif;
    cursor: pointer;
    transition: .18s ease;
}

.media-product-actions button:hover,
.resend-template-actions button:hover {
    border-color: rgba(49,94,232,.34);
    background: #eef2ff;
    color: #244ac0;
}

.media-product-actions .btn-delete-row {
    color: #b42318;
}

/* Orígenes de archivos como controles de sistema: dispositivo o bodega visual. */
.device-upload-card {
    position: relative;
    display: grid !important;
    min-width: 0;
    overflow: hidden;
    font-size: 0 !important;
    cursor: pointer;
}

.device-upload-card > input[type="file"] {
    position: absolute !important;
    z-index: 2;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.device-upload-ui,
.media-library-launcher {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 28px;
    gap: .62rem;
    align-items: center;
    width: 100%;
    min-height: 68px;
    padding: .68rem;
    border: 1px solid rgba(49,94,232,.14);
    border-radius: 15px;
    background:
        radial-gradient(circle at 100% 0, rgba(49,94,232,.08), transparent 42%),
        #fff;
    color: var(--sinapse-ink);
    text-align: left;
    box-shadow: 0 9px 24px rgba(31,45,88,.07);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.device-upload-card:hover .device-upload-ui,
.media-library-launcher:hover {
    transform: translateY(-2px);
    border-color: rgba(49,94,232,.3);
    box-shadow: 0 14px 30px rgba(31,45,88,.12);
}

.device-upload-icon,
.media-source-app-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(145deg, #315ee8, #7657e8);
    color: #fff;
    box-shadow: 0 10px 22px rgba(49,94,232,.21);
}

.media-source-app-icon {
    background: linear-gradient(145deg, #128da0, #315ee8);
}

.device-upload-icon svg,
.media-source-app-icon svg,
.asset-picker-empty svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.device-upload-ui > span:nth-child(2),
.media-source-copy {
    display: grid;
    min-width: 0;
    gap: .14rem;
}

.device-upload-ui strong,
.media-source-copy strong {
    overflow: hidden;
    font: 820 .65rem/1.3 Inter, sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-upload-ui small,
.media-source-copy small {
    overflow: hidden;
    color: #718096;
    font: 600 .54rem/1.3 Inter, sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-upload-plus,
.media-source-chevron {
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border: 1px solid rgba(49,94,232,.12);
    border-radius: 50%;
    background: #f5f7ff;
    color: #315ee8;
    font: 800 1rem/1 Inter, sans-serif;
}

.device-upload-ui.has-file {
    border-color: rgba(22,129,111,.26);
    background: #f4fbf8;
}

.media-library-field {
    display: grid !important;
    font-size: 0 !important;
}

.media-picker-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.media-library-launcher {
    appearance: none;
    font-family: inherit;
    cursor: pointer;
}

.media-library-launcher.has-selection {
    border-color: rgba(22,129,111,.25);
    background:
        radial-gradient(circle at 100% 0, rgba(22,129,111,.09), transparent 42%),
        #fff;
}

.media-library-launcher.has-selection .media-source-app-icon {
    background: linear-gradient(145deg, #13816f, #22a68c);
}

.visual-toolbar .device-upload-card.is-compact {
    display: inline-grid !important;
    width: auto;
}

.visual-toolbar .device-upload-card.is-compact .device-upload-ui {
    grid-template-columns: 29px minmax(0, 1fr);
    min-height: 38px;
    padding: .3rem .48rem;
    border-radius: 9px;
    box-shadow: none;
}

.visual-toolbar .device-upload-card.is-compact .device-upload-icon {
    width: 29px;
    height: 29px;
    border-radius: 8px;
}

.visual-toolbar .device-upload-card.is-compact .device-upload-plus {
    display: none;
}

.visual-toolbar > .media-library-launcher {
    width: min(250px, 100%);
    min-height: 42px;
    grid-template-columns: 30px minmax(0,1fr) 24px;
    padding: .32rem .48rem;
    border-radius: 10px;
    box-shadow: none;
}

.visual-toolbar > .media-library-launcher .media-source-app-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
}

/* Explorador de bodega reutilizable en todos los editores. */
.share-sheet-modal.asset-picker-modal {
    z-index: 10040;
    display: grid;
    place-items: center;
    padding: clamp(.45rem, 2vw, 1.2rem);
    background:
        radial-gradient(circle at 8% 5%, rgba(21,149,168,.2), transparent 30%),
        radial-gradient(circle at 92% 96%, rgba(49,94,232,.22), transparent 34%),
        rgba(7, 13, 28, .76);
    backdrop-filter: blur(24px) saturate(130%);
}

.asset-picker-app {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    width: min(1080px, calc(100vw - 1rem));
    max-width: none;
    max-height: calc(100dvh - 1rem);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.75);
    border-radius: 24px;
    background: rgba(247,250,255,.97);
    box-shadow: 0 32px 90px rgba(4,10,28,.34), inset 0 1px 0 #fff;
}

.asset-picker-head {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1rem;
    border-bottom: 1px solid rgba(40,56,100,.1);
    background:
        radial-gradient(circle at 5% 0, rgba(21,149,168,.16), transparent 42%),
        rgba(255,255,255,.88);
}

.asset-picker-head h2,
.asset-picker-head p {
    margin: 0;
}

.asset-picker-head .share-close {
    display: grid;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid rgba(40,56,100,.12);
    border-radius: 50%;
    background: #fff;
    color: #344054;
    font-size: 1.2rem;
    cursor: pointer;
}

.asset-picker-commandbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .65rem;
    padding: .8rem 1rem .55rem;
}

.asset-picker-search {
    display: grid;
    grid-template-columns: 24px minmax(0,1fr);
    gap: .35rem;
    align-items: center;
    min-height: 44px;
    padding: 0 .72rem;
    border: 1px solid rgba(40,56,100,.12);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(31,45,88,.06);
}

.asset-picker-search input {
    width: 100%;
    min-height: 42px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
}

.asset-picker-device {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: .55rem .78rem;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(145deg, #315ee8, #6b50dc);
    color: #fff;
    font-size: .6rem;
    font-weight: 820;
    box-shadow: 0 10px 24px rgba(49,94,232,.22);
    cursor: pointer;
}

.asset-picker-device input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.asset-picker-meta {
    display: flex;
    gap: .6rem;
    align-items: center;
    justify-content: space-between;
    padding: .3rem 1rem .7rem;
    color: #667085;
    font-size: .55rem;
    font-weight: 700;
}

.asset-picker-meta button {
    border: 0;
    background: transparent;
    color: #315ee8;
    font: inherit;
    cursor: pointer;
}

.asset-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .68rem;
    min-height: 220px;
    padding: .25rem 1rem 1rem;
    overflow: auto;
    align-content: start;
}

.asset-choice-card {
    display: grid;
    min-width: 0;
    gap: .48rem;
    padding: .45rem;
    border: 1px solid rgba(40,56,100,.11);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 9px 23px rgba(31,45,88,.07);
    cursor: pointer;
    text-align: left;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.asset-choice-card:hover {
    transform: translateY(-3px);
    border-color: rgba(21,149,168,.36);
    box-shadow: 0 16px 32px rgba(31,45,88,.13);
}

.asset-choice-preview {
    position: relative;
    display: grid;
    aspect-ratio: 4 / 3;
    place-items: center;
    overflow: hidden;
    border-radius: 11px;
    background:
        linear-gradient(45deg, rgba(49,94,232,.035) 25%, transparent 25%, transparent 75%, rgba(49,94,232,.035) 75%) 0 0 / 14px 14px,
        #f7f9ff;
}

.asset-choice-preview img {
    width: 100%;
    height: 100%;
    padding: .32rem;
    object-fit: contain;
}

.asset-choice-check {
    position: absolute;
    right: .38rem;
    bottom: .38rem;
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    color: #13816f;
    font-size: .62rem;
    box-shadow: 0 5px 14px rgba(20,40,70,.18);
    opacity: 0;
    transform: scale(.7);
    transition: .18s ease;
}

.asset-choice-card:hover .asset-choice-check {
    opacity: 1;
    transform: scale(1);
}

.asset-choice-copy {
    display: grid;
    min-width: 0;
    gap: .1rem;
    padding: 0 .18rem .18rem;
}

.asset-choice-copy strong,
.asset-choice-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-choice-copy strong {
    color: #1c2746;
    font-size: .61rem;
}

.asset-choice-copy small {
    color: #7b8498;
    font-size: .5rem;
}

.asset-picker-empty {
    grid-column: 1 / -1;
    display: grid;
    min-height: 220px;
    place-items: center;
    align-content: center;
    gap: .35rem;
    padding: 1rem;
    color: #667085;
    text-align: center;
}

.asset-picker-empty > span {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 17px;
    background: #eaf0ff;
    color: #315ee8;
}

.asset-picker-empty p {
    margin: 0;
    font-size: .58rem;
}

.asset-picker-app > .form-status {
    min-height: 0;
    margin: 0;
    padding: 0 1rem .65rem;
}

/* Modales convertidos en mini aplicaciones contextuales. */
.admin-editor-modal {
    padding: clamp(.5rem, 2vw, 1.25rem);
    background:
        radial-gradient(circle at 12% 8%, rgba(74, 113, 255, .18), transparent 28%),
        radial-gradient(circle at 86% 92%, rgba(118, 87, 232, .2), transparent 34%),
        rgba(8, 13, 29, .72);
    backdrop-filter: blur(24px) saturate(125%);
}

.admin-editor-dialog {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(1240px, calc(100vw - 1rem));
    max-height: calc(100dvh - 1rem);
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 24px;
    background: rgba(247, 249, 255, .96);
    box-shadow: var(--sinapse-shadow), inset 0 1px 0 #fff;
}

.admin-editor-head {
    position: sticky;
    z-index: 4;
    top: 0;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    min-height: 82px;
    padding: .88rem 1rem;
    border-bottom: 1px solid rgba(40, 56, 100, .1);
    background:
        radial-gradient(circle at 6% 0, var(--modal-accent-soft, rgba(49,94,232,.16)), transparent 42%),
        rgba(255,255,255,.84);
}

.admin-editor-title-app {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: .72rem;
    align-items: center;
}

.admin-editor-app-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--modal-accent, #315ee8), var(--modal-accent-2, #7657e8));
    color: #fff;
    font-size: 1.05rem;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--modal-accent, #315ee8) 28%, transparent);
}

.admin-editor-title-app h2,
.admin-editor-title-app p {
    margin: 0;
}

.admin-editor-title-app p {
    color: #64748b;
    font-size: .6rem;
}

.admin-editor-close {
    display: grid;
    grid-template-columns: 24px auto;
    gap: .3rem;
    align-items: center;
    min-height: 36px;
    padding: .32rem .58rem .32rem .34rem;
    border: 1px solid rgba(40,56,100,.12);
    border-radius: 999px;
    background: rgba(255,255,255,.84);
    color: #46516a;
    cursor: pointer;
}

.admin-editor-close span {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    background: #edf0f7;
    font-size: .9rem;
}

.admin-editor-close small {
    font-size: .52rem;
    font-weight: 800;
}

.admin-editor-window-actions {
    display: flex;
    flex: 0 0 auto;
    gap: .55rem;
    align-items: center;
}

.admin-editor-state {
    display: inline-flex;
    gap: .42rem;
    align-items: center;
    color: #64748b;
    font-size: .52rem;
    font-weight: 750;
}

.admin-editor-body {
    min-height: 0;
    overflow: auto;
    padding: clamp(.8rem, 2vw, 1.25rem);
    background:
        linear-gradient(rgba(49,94,232,.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(49,94,232,.018) 1px, transparent 1px);
    background-size: 22px 22px;
}

.admin-editor-body > form {
    position: relative;
    display: grid;
    gap: .8rem;
    max-width: 1160px;
    margin: 0 auto;
    padding: clamp(.85rem, 2vw, 1.25rem) !important;
    border: 0 !important;
    border-radius: 18px !important;
    background: rgba(255,255,255,.78) !important;
    box-shadow: 0 12px 36px rgba(31, 45, 88, .08) !important;
}

.admin-editor-modal[data-app-kind="magazine"] { --modal-accent: #df765e; --modal-accent-2: #a94262; --modal-accent-soft: rgba(223,118,94,.18); }
.admin-editor-modal[data-app-kind="news"] { --modal-accent: #cc5d76; --modal-accent-2: #7d3c85; --modal-accent-soft: rgba(204,93,118,.17); }
.admin-editor-modal[data-app-kind="media"] { --modal-accent: #178fa3; --modal-accent-2: #315ee8; --modal-accent-soft: rgba(23,143,163,.17); }
.admin-editor-modal[data-app-kind="builder"] { --modal-accent: #315ee8; --modal-accent-2: #7657e8; --modal-accent-soft: rgba(49,94,232,.17); }
.admin-editor-modal[data-app-kind="client"] { --modal-accent: #16816f; --modal-accent-2: #315ee8; --modal-accent-soft: rgba(22,129,111,.17); }
.admin-editor-modal[data-app-kind="system"] { --modal-accent: #7657e8; --modal-accent-2: #b04fc1; --modal-accent-soft: rgba(118,87,232,.17); }
.admin-editor-modal[data-app-kind="identity"] { --modal-accent: #6c4bd7; --modal-accent-2: #c04da1; --modal-accent-soft: rgba(108,75,215,.17); }
.admin-editor-modal[data-app-kind="message"] { --modal-accent: #e45878; --modal-accent-2: #744bd8; --modal-accent-soft: rgba(228,88,120,.17); }

.admin-editor-modal:not([hidden]) .admin-editor-dialog,
.share-sheet-modal.asset-picker-modal .asset-picker-app {
    animation: sinapseAppEnter .28s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes sinapseAppEnter {
    from { opacity: 0; transform: translateY(15px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Los demás modales heredados reciben la misma superficie de sistema. */
.share-sheet-modal:not(.asset-picker-modal),
.admin-tour-modal {
    background:
        radial-gradient(circle at 10% 5%, rgba(49,94,232,.18), transparent 30%),
        radial-gradient(circle at 90% 95%, rgba(118,87,232,.2), transparent 34%),
        rgba(8,13,29,.74) !important;
    backdrop-filter: blur(24px) saturate(125%) !important;
}

.share-sheet-modal:not(.asset-picker-modal) > .share-sheet,
.admin-tour-modal > .admin-tour-card {
    border: 1px solid rgba(255,255,255,.72) !important;
    border-radius: 24px !important;
    background:
        linear-gradient(rgba(49,94,232,.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(49,94,232,.015) 1px, transparent 1px),
        rgba(249,250,255,.98) !important;
    background-size: 22px 22px !important;
    box-shadow: var(--sinapse-shadow), inset 0 1px 0 #fff !important;
}

/* Quill limpio: una sola superficie editorial, no dos editores superpuestos. */
.quill-editor-shell {
    overflow: hidden;
    border: 1px solid rgba(40, 56, 100, .13);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(31, 45, 88, .08);
}

.quill-editor-shell > .quill-toolbar-pro,
.quill-editor-shell > .ql-toolbar.ql-snow {
    margin: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(40, 56, 100, .1) !important;
    border-radius: 0 !important;
    background: linear-gradient(180deg, #fbfcff, #f1f4fb);
    box-shadow: none;
}

.quill-editor-shell > .visual-toolbar {
    margin: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(40, 56, 100, .1) !important;
    border-radius: 0 !important;
    background: #f8faff;
}

.quill-editor-shell > .ql-container.ql-snow {
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
}

.quill-layout-bar {
    display: flex;
    gap: .35rem;
    align-items: center;
    padding: .45rem .6rem;
    border-bottom: 1px solid rgba(40,56,100,.1);
    background: #fff;
}

.quill-layout-bar span {
    margin-right: .2rem;
    color: #64748b;
    font-size: .55rem;
    font-weight: 800;
    text-transform: uppercase;
}

.quill-layout-bar button {
    min-height: 32px;
    padding: .35rem .52rem;
    border: 1px solid var(--sinapse-line);
    border-radius: 8px;
    background: #f8faff;
    color: #334155;
    font-size: .58rem;
    font-weight: 800;
    cursor: pointer;
}

.ql-editor .editor-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1rem, 3vw, 2.2rem);
    margin: 1.25rem 0;
    padding: clamp(.8rem, 2vw, 1.2rem);
    border: 1px dashed rgba(49,94,232,.25);
    border-radius: 14px;
    background: rgba(49,94,232,.025);
}

.ql-editor .editor-columns > div {
    min-width: 0;
}

.ql-editor .editor-column {
    min-height: 96px;
    padding: .55rem;
    border-radius: 10px;
    outline: none;
}

.ql-editor .editor-column:focus {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(49,94,232,.12);
}

.magazine-rich-field {
    display: grid;
    gap: .55rem;
}

.magazine-rich-field strong,
.magazine-rich-field p {
    margin: 0;
}

.magazine-rich-editor .ql-editor {
    min-height: 300px;
}

/* Plantillas Resend. */
.resend-template-app,
.resend-template-form {
    display: grid;
    gap: .9rem;
}

.resend-template-form {
    padding: 1rem;
    border: 1px solid var(--sinapse-line);
    border-radius: 16px;
    background: #f8faff;
}

.resend-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: .7rem;
}

.resend-template-card {
    display: grid;
    gap: .55rem;
    padding: .85rem;
    border: 1px solid var(--sinapse-line);
    border-radius: 14px;
    background: #fff;
}

.resend-template-card h3,
.resend-template-card p { margin: 0; }
.resend-template-card p { color: #64748b; font-size: .62rem; }
.resend-template-actions { display: flex; gap: .35rem; flex-wrap: wrap; }

@media (max-width: 980px) {
    .admin-app-launchpad {
        grid-template-columns: 1fr;
    }
    .media-warehouse-layout {
        grid-template-columns: 1fr;
    }
    .media-warehouse-layout > #media-form {
        position: static;
    }
}

@media (max-width: 640px) {
    .admin-body .admin-heading-actions,
    .admin-body .builder-studio-actions,
    .admin-body .form-actions {
        display: flex;
        width: auto;
    }
    .admin-body .admin-heading-actions .btn,
    .admin-body .builder-studio-actions .btn,
    .admin-body .form-actions .btn {
        width: auto;
        flex: 0 1 auto;
    }
    .media-commerce-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .55rem;
    }
    .media-product-actions {
        grid-template-columns: 1fr;
    }
    .admin-body .admin-editor-launcher {
        grid-template-columns: 52px minmax(0, 1fr) 28px;
        min-height: 108px;
        padding: .78rem;
        border-radius: 18px;
    }
    .admin-launcher-icon {
        width: 52px;
        height: 52px;
        border-radius: 16px;
        font-size: 1.2rem;
    }
    .admin-launcher-copy > span {
        display: none;
    }
    .unified-source-card {
        grid-template-columns: 42px minmax(0,1fr);
    }
    .unified-source-icon {
        width: 42px;
        height: 42px;
        border-radius: 13px;
    }
    .unified-source-card button {
        grid-column: 1 / -1;
        width: 100%;
    }
    .asset-picker-commandbar {
        grid-template-columns: 1fr;
    }
    .asset-picker-device {
        width: 100%;
    }
    .asset-picker-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem;
        padding-inline: .65rem;
    }
    .admin-editor-dialog {
        width: calc(100vw - .5rem);
        max-height: calc(100dvh - .5rem);
        border-radius: 18px;
    }
    .admin-editor-head { min-height: 72px; padding: .65rem; }
    .admin-editor-title-app { grid-template-columns: 36px minmax(0,1fr); }
    .admin-editor-app-icon { width: 36px; height: 36px; border-radius: 11px; }
    .admin-editor-state,
    .admin-editor-close small {
        display: none;
    }
    .admin-editor-close {
        grid-template-columns: 26px;
        padding: .25rem;
    }
    .ql-editor .editor-columns { grid-template-columns: 1fr; }
}
