/* Private image library: compact cards, persistent tools, reversible bulk actions. */
.as-library-dialog:has(.alg-library){width:min(1120px,calc(100vw - 32px));height:min(850px,calc(100dvh - 40px));max-height:calc(100dvh - 40px);padding:0;border:1px solid #e7dff1;border-radius:22px;background:#faf8fd;overflow:hidden;color:#302344}
.as-library-dialog[open]:has(.alg-library){display:flex;flex-direction:column}
.as-library-dialog:has(.alg-library)>header{flex:none;min-height:72px;padding:14px 24px;background:#fff;border-bottom:1px solid #e9e1f1;position:relative}
.as-library-dialog:has(.alg-library)>header:before{content:'';position:absolute;inset:0 0 auto;height:3px;background:linear-gradient(90deg,#7950df,#b5a1e8 55%,#edd7d9)}
.as-library-dialog:has(.alg-library)>header h2{margin:0;color:#342153;font:600 26px/1.2 Fredoka,Arial,sans-serif;letter-spacing:-.03em}
.as-library-dialog:has(.alg-library)>header button{border-radius:12px!important;background:#f5effc!important;color:#684a88!important;min-width:44px;min-height:44px}
.as-library-dialog:has(.alg-library) .as-library-body{padding:0 24px 20px;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#d5c5e7 transparent;scroll-padding-top:190px}
.alg-library{--alg-violet:#6740c9;--alg-ink:#342153;--alg-line:#e4daef;--alg-soft:#f4effb;--alg-danger:#a73655;font:14px/1.4 Arial,sans-serif;color:var(--alg-ink)}
.alg-library *{box-sizing:border-box}
.alg-library [hidden]{display:none!important}
.alg-library svg{width:19px;height:19px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;vertical-align:middle}
.alg-library button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:42px!important;padding:9px 13px!important;border:1px solid var(--alg-line)!important;border-radius:11px!important;background:#fff!important;color:#604680!important;font:600 13px/1.25 Arial,sans-serif!important;letter-spacing:0;text-transform:none;box-shadow:none;cursor:pointer;transition:background-color .15s,border-color .15s,box-shadow .15s,translate .15s}
.alg-library button:hover:not(:disabled){background:#f0e8fc!important;border-color:#c6ade9!important;color:#513095!important}
.alg-library button:disabled{opacity:.5;cursor:wait}
.alg-library button:focus-visible,.alg-library input:focus-visible{outline:2px solid #825ad0!important;outline-offset:3px!important}
.alg-library .alg-primary{background:linear-gradient(130deg,#7e52e3,#5d37c5)!important;color:white!important;border-color:transparent!important}
.alg-library .alg-primary:hover:not(:disabled){color:#fff!important;background:#6438c4!important;box-shadow:0 4px 12px #6036cc25}
.alg-toolbar{position:sticky;top:0;z-index:4;padding:18px 0 14px;background:#faf8fdfc;border-bottom:1px solid #e8e0f1;margin-bottom:18px}
.alg-top,.alg-views,.alg-controls,.alg-search-row,.alg-bulk,.alg-notice{display:flex;align-items:center;gap:8px}
.alg-top{justify-content:space-between;flex-wrap:wrap;gap:12px}
.alg-views{gap:4px}
.alg-library .alg-view{background:transparent!important;border-color:transparent!important;color:#857291!important}
.alg-library .alg-view[aria-pressed=true]{background:#ede4fc!important;color:#6236b6!important;border-color:#dfcef4!important}
.alg-search-row{margin-top:12px;justify-content:space-between;gap:14px}
.alg-library .alg-search{display:flex;align-items:center;gap:9px;padding:0 12px;border:1px solid var(--alg-line);border-radius:11px;background:white;margin:0;max-width:430px;width:100%;color:#94809e}
.alg-library .alg-search input{margin:0!important;min-width:0;min-height:40px;height:40px;padding:8px 0!important;border:0!important;box-shadow:none!important;background:transparent!important;border-radius:0;font:14px Arial,sans-serif!important;color:#39264d;width:100%}
.alg-library .alg-search:focus-within{outline:2px solid #a385d6;outline-offset:1px}
.alg-library .alg-search input:focus-visible{outline:none!important}
.alg-count{font-size:12px;white-space:nowrap;color:#8c7a99}
.alg-bulk{margin-top:12px;padding:9px 10px;background:#eee5fc;border:1px solid #dccbf3;border-radius:12px;flex-wrap:wrap}
.alg-bulk strong{font-size:13px;margin-right:auto}
.alg-library .alg-all{background:transparent!important;border-color:transparent!important;font-weight:400!important;padding:7px!important}
.alg-library .alg-danger{color:#fff!important;background:#a73655!important;border-color:#a73655!important}
.alg-library .alg-danger:hover:not(:disabled){background:#922c49!important;color:#fff!important;border-color:#922c49!important}
.alg-notice{margin-top:12px;padding:9px 12px;border-radius:12px;background:#eef7f3;color:#316752;flex-wrap:wrap}
.alg-notice.is-error{background:#fff0eb;color:#963f35}
.alg-message{flex:1;min-width:160px;font-size:13px;line-height:1.45}
.alg-library .alg-undo,.alg-library .alg-retry{background:#fff!important;border-color:currentColor!important;color:inherit!important;min-height:36px!important;padding:7px 10px!important}
.alg-library .alg-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:0}
.alg-library .alg-card{position:relative;padding:0!important;margin:0!important;min-width:0;border:1px solid #e6ddef!important;background:#fff!important;border-radius:16px!important;overflow:hidden;box-shadow:0 3px 12px #32204404;transition:border-color .15s,box-shadow .15s}
.alg-library .alg-card.is-selected{border-color:#8760ce!important;box-shadow:0 0 0 2px #906bce33}
.alg-library .alg-preview{display:block!important;width:100%;height:auto;aspect-ratio:4/3;padding:10px!important;min-height:0!important;overflow:hidden;border:0!important;border-radius:0!important;background:repeating-conic-gradient(#f1eef5 0 25%,#f9f7fc 0 50%) 0/18px 18px!important}
.alg-library .alg-preview:hover:not(:disabled){background:repeating-conic-gradient(#ece5f5 0 25%,#f7f3fc 0 50%) 0/18px 18px!important}
.alg-library .alg-preview img{display:block;width:100%;height:100%;object-fit:contain;border-radius:5px;background:transparent}
.alg-library .alg-check{position:absolute;top:8px;left:8px;display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;margin:0;border-radius:10px;background:#ffffffee;box-shadow:0 2px 8px #35224510;cursor:pointer;z-index:1}
.alg-library .alg-checkbox{appearance:auto!important;width:19px!important;height:19px!important;min-height:19px!important;padding:0!important;margin:0!important;accent-color:var(--alg-violet);cursor:pointer;display:block;box-shadow:none!important}
.alg-caption{padding:12px}
.alg-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:600 13px/1.4 Arial,sans-serif;color:#4c365d;margin-bottom:9px}
.alg-card-actions{display:flex;gap:6px;align-items:center}
.alg-library .alg-use{flex:1;min-width:0;padding:7px 10px!important;background:#f4effb!important;border-color:#e7ddf1!important;color:#5e399f!important}
.alg-library .alg-icon-button{padding:8px!important;width:38px;min-width:38px;min-height:38px!important;border-color:transparent!important;background:transparent!important;color:#927e9f!important}
.alg-library .alg-delete:hover:not(:disabled){background:#fff0f3!important;color:#b13d5d!important;border-color:#f0cad5!important}
.alg-selecting .alg-card-actions{display:none}
.alg-selecting .alg-name{margin-bottom:0}
.alg-selecting .alg-check{background:#fff}
.alg-selecting .alg-preview{cursor:pointer}
.alg-rename{padding:0 12px 12px;display:flex;flex-wrap:wrap;gap:7px}
.alg-library .alg-rename input{flex:1 0 100%;width:100%;min-height:44px;margin:0;padding:10px;border:1px solid #c8b0e2;border-radius:9px;font:16px Arial,sans-serif;box-shadow:none}
.alg-rename button{flex:1;font-size:12px!important;padding:7px!important}
.alg-empty{grid-column:1/-1;min-height:240px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:12px;color:#8b749d}
.alg-empty svg{width:34px;height:34px}
.alg-empty strong{font:600 23px Fredoka,Arial,sans-serif;color:#5c4276}
.alg-empty p{margin:0!important;max-width:330px;font-size:13px!important}
.alg-help{margin-top:20px!important;padding:12px 0!important;border:0!important;color:#8d7a9b;background:transparent!important}
.alg-help summary{font:12px/1.5 Arial,sans-serif!important;color:#867192!important;cursor:pointer}
.alg-help p{font:12px/1.7 Arial,sans-serif!important;max-width:780px;color:#867192!important}
.as-account-images .alg-toolbar{position:relative}
.as-account-images .alg-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,190px),1fr))}
/* Whole-image hover preview. It never intercepts the card's actions or changes the grid. */
.alg-image-peek{position:fixed;z-index:8;box-sizing:border-box;pointer-events:none;margin:0;padding:9px;border:1px solid #d8c7ed;border-radius:19px;background:#fff;box-shadow:0 16px 48px #38235038,0 3px 12px #38235012;animation:alg-peek-in .18s cubic-bezier(.2,.75,.2,1)}
.as-library-dialog .alg-image-peek{position:absolute}
.alg-image-peek[hidden]{display:none!important}
.alg-image-peek img{display:block;width:100%;height:100%;object-fit:contain;border-radius:11px;background:repeating-conic-gradient(#f1eef5 0 25%,#f9f7fc 0 50%) 0/18px 18px}
@keyframes alg-peek-in{from{opacity:0;transform:translateY(5px) scale(.97)}to{opacity:1;transform:none}}
@media(hover:hover) and (pointer:fine){.alg-library .alg-card:has(.alg-preview:hover){border-color:#b69bdd!important;box-shadow:0 4px 18px #68429917}}
@media(hover:none),(pointer:coarse),(max-width:760px){.alg-image-peek{display:none!important}}
@media(prefers-reduced-motion:reduce){.alg-image-peek{animation:none}}
@media(min-width:761px) and (max-width:1000px){.alg-library .alg-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:760px){
 .as-library-dialog:has(.alg-library){width:calc(100vw - 16px);height:calc(100dvh - 20px);max-height:calc(100dvh - 20px);border-radius:18px}
 .as-library-dialog:has(.alg-library)>header{padding:12px 16px;min-height:64px}
 .as-library-dialog:has(.alg-library)>header h2{font-size:24px}
 .as-library-dialog:has(.alg-library) .as-library-body{padding:0 12px 16px;scroll-padding-top:240px}
 .alg-toolbar{padding:12px 0;margin-bottom:12px}
 .alg-top{gap:8px}.alg-views{flex:1 0 100%}.alg-controls{width:100%}.alg-controls button{flex:1}
 .alg-library button{min-height:44px!important;font-size:12px!important;padding:9px 11px!important}
 .alg-library .alg-search input{font-size:16px!important;min-height:44px}
 .alg-count{display:none}.alg-search-row{margin-top:9px}
 .alg-library .alg-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 .alg-caption{padding:10px}.alg-name{font-size:12px}.alg-card-actions{gap:1px;flex-wrap:wrap}
 .alg-library .alg-use{flex:1 0 100%;min-height:36px!important}
 .alg-library .alg-icon-button{flex:1;width:auto;min-width:44px;min-height:40px!important}
 .alg-library .alg-check{width:40px;height:40px;top:5px;left:5px}
 .alg-bulk{gap:6px;padding:8px}.alg-bulk strong{flex:1}.alg-library .alg-bulk-action{width:100%}
 .alg-library .alg-preview{padding:8px!important}.alg-help{margin-top:14px!important}
}
@media(prefers-reduced-motion:reduce){.alg-library button,.alg-library .alg-card{transition:none!important}}
