.g29-gallery-manager {
    overflow: hidden;
    border: 1px solid var(--g29-ui-line, rgba(23, 36, 58, 0.11));
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 8px 24px rgba(27, 42, 65, 0.045);
}

.g29-gallery-manager svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.g29-gallery-manager button,
.g29-gallery-manager select,
.g29-gallery-manager input {
    font-family: "Avenir Next", Avenir, "Segoe UI Variable", "Segoe UI", sans-serif;
}

.g29-gallery-manager button {
    cursor: pointer;
}

.g29-gallery-manager button:disabled {
    cursor: default;
    opacity: 0.34;
}

.g29-gallery-manager-header {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--g29-ui-line, rgba(23, 36, 58, 0.11));
    background: rgba(247, 249, 251, 0.76);
}

.g29-gallery-manager-title,
.g29-gallery-upload,
.g29-gallery-upload label,
.g29-gallery-category-create,
.g29-gallery-results-header,
.g29-gallery-media-meta,
.g29-gallery-media-moves {
    display: flex;
    align-items: center;
}

.g29-gallery-manager-title {
    min-width: 0;
    gap: 11px;
}

.g29-gallery-manager-title > span {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 13px;
    color: var(--g29-ui-accent, #a9485c);
    background: var(--g29-ui-accent-soft, rgba(169, 72, 92, 0.11));
}

.g29-gallery-manager-title h3,
.g29-gallery-manager-title p {
    margin: 0;
}

.g29-gallery-manager-title h3 {
    color: var(--g29-ui-ink, #17243a);
    font-size: 14px;
    font-weight: 670;
    letter-spacing: -0.018em;
}

.g29-gallery-manager-title p {
    margin-top: 3px;
    color: var(--g29-ui-muted, #6d7889);
    font-size: 10px;
    font-weight: 520;
}

.g29-gallery-upload {
    flex: 0 0 auto;
    gap: 7px;
}

.g29-gallery-upload label {
    height: 38px;
    gap: 7px;
    padding: 0 9px 0 11px;
    border: 1px solid var(--g29-ui-line, rgba(23, 36, 58, 0.11));
    border-radius: 11px;
    background: #fff;
}

.g29-gallery-upload label > span {
    color: var(--g29-ui-muted, #6d7889);
    font-size: 9px;
    font-weight: 620;
    white-space: nowrap;
}

.g29-gallery-upload select,
.g29-gallery-media-meta select {
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--g29-ui-ink, #17243a);
    background: transparent;
    box-shadow: none;
    font-size: 10px;
    font-weight: 620;
}

.g29-gallery-upload > button {
    display: inline-flex;
    height: 40px;
    align-items: center;
    gap: 7px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #fff;
    background: var(--g29-ui-accent, #a9485c);
    box-shadow: 0 8px 18px rgba(169, 72, 92, 0.2);
    font-size: 10px;
    font-weight: 680;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.g29-gallery-upload > button:hover {
    background: #963c50;
    box-shadow: 0 10px 22px rgba(169, 72, 92, 0.25);
    transform: translateY(-1px);
}

.g29-gallery-upload > button:active {
    transform: scale(0.98);
}

.g29-gallery-category-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--g29-ui-line, rgba(23, 36, 58, 0.11));
    background: rgba(255, 255, 255, 0.88);
}

.g29-gallery-category-tabs {
    display: flex;
    min-width: 0;
    gap: 6px;
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(23, 36, 58, 0.16) transparent;
}

.g29-gallery-category-tabs button {
    display: inline-flex;
    height: 34px;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--g29-ui-muted, #6d7889);
    background: var(--g29-ui-soft, #f1f4f7);
    font-size: 10px;
    font-weight: 620;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.g29-gallery-category-tabs button:hover {
    border-color: rgba(169, 72, 92, 0.18);
    color: var(--g29-ui-ink, #17243a);
    background: #fff;
    transform: translateY(-1px);
}

.g29-gallery-category-tabs button[aria-pressed="true"] {
    border-color: rgba(169, 72, 92, 0.2);
    color: var(--g29-ui-accent, #a9485c);
    background: var(--g29-ui-accent-soft, rgba(169, 72, 92, 0.11));
}

.g29-gallery-category-tabs em {
    display: grid;
    min-width: 19px;
    height: 19px;
    place-items: center;
    border-radius: 6px;
    color: inherit;
    background: rgba(255, 255, 255, 0.72);
    font-size: 8px;
    font-style: normal;
    font-variant-numeric: tabular-nums;
}

.g29-gallery-category-create {
    height: 36px;
    overflow: hidden;
    border: 1px solid var(--g29-ui-line, rgba(23, 36, 58, 0.11));
    border-radius: 11px;
    background: var(--g29-ui-soft, #f1f4f7);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.g29-gallery-category-create:focus-within {
    border-color: rgba(169, 72, 92, 0.4);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(169, 72, 92, 0.09);
}

.g29-gallery-category-create > span {
    display: grid;
    width: 33px;
    place-items: center;
    color: var(--g29-ui-muted, #6d7889);
}

.g29-gallery-category-create > span svg {
    width: 15px;
    height: 15px;
}

.g29-gallery-category-create input {
    width: 116px;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    color: var(--g29-ui-ink, #17243a);
    background: transparent;
    font-size: 10px;
    font-weight: 560;
}

.g29-gallery-category-create button {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 0;
    color: var(--g29-ui-accent, #a9485c);
    background: transparent;
    transition: color 160ms ease, background 160ms ease;
}

.g29-gallery-category-create button:hover {
    color: #fff;
    background: var(--g29-ui-accent, #a9485c);
}

.g29-gallery-results-header {
    min-height: 44px;
    justify-content: space-between;
    padding: 0 14px;
    color: var(--g29-ui-muted, #6d7889);
    background: rgba(247, 249, 251, 0.58);
}

.g29-gallery-results-header > span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.g29-gallery-results-header svg {
    width: 14px;
    height: 14px;
}

.g29-gallery-results-header strong,
.g29-gallery-results-header small {
    font-size: 10px;
    font-weight: 620;
}

.g29-gallery-results-header strong {
    color: var(--g29-ui-ink, #17243a);
}

.g29-gallery-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
    gap: 10px;
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
    overflow-x: hidden;
    background: rgba(247, 249, 251, 0.45);
}

.g29-gallery-media-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 7px 20px rgba(27, 42, 65, 0.055);
    transition: border-color 170ms ease, box-shadow 170ms ease, transform 170ms ease;
}

.g29-gallery-media-card:hover,
.g29-gallery-media-card[data-selected="true"] {
    border-color: rgba(169, 72, 92, 0.3);
    box-shadow: 0 11px 26px rgba(27, 42, 65, 0.09);
    transform: translateY(-2px);
}

.g29-gallery-media-card[data-selected="true"]::after {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    border: 2px solid #fff;
    border-radius: 8px;
    color: #fff;
    background: var(--g29-ui-accent, #a9485c);
    box-shadow: 0 4px 12px rgba(27, 42, 65, 0.2);
    content: "✓";
    font-size: 12px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
}

.g29-gallery-media-select {
    display: grid;
    width: 100%;
    gap: 7px;
    padding: 0 0 8px;
    border: 0;
    color: var(--g29-ui-ink, #17243a);
    background: transparent;
    text-align: left;
}

.g29-gallery-media-preview {
    position: relative;
    display: grid;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    place-items: center;
    color: var(--g29-ui-muted, #6d7889);
    background: var(--g29-ui-soft, #f1f4f7);
}

.g29-gallery-media-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 280ms cubic-bezier(.2, .8, .2, 1);
}

.g29-gallery-media-card:hover .g29-gallery-media-preview img {
    transform: scale(1.025);
}

.g29-gallery-media-preview b {
    position: absolute;
    right: 7px;
    bottom: 7px;
    display: grid;
    min-width: 25px;
    height: 21px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.54);
    border-radius: 7px;
    color: #fff;
    background: rgba(17, 25, 38, 0.66);
    backdrop-filter: blur(8px);
    font-size: 8px;
    font-variant-numeric: tabular-nums;
}

.g29-gallery-media-select > strong {
    overflow: hidden;
    padding: 0 9px;
    font-size: 10px;
    font-weight: 630;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.g29-gallery-media-meta {
    min-height: 38px;
    gap: 3px;
    padding: 6px;
    border-top: 1px solid var(--g29-ui-line, rgba(23, 36, 58, 0.11));
    background: rgba(247, 249, 251, 0.72);
}

.g29-gallery-media-meta > label {
    min-width: 0;
    flex: 1 1 auto;
}

.g29-gallery-media-meta select {
    width: 100%;
    height: 28px;
    padding: 0 5px;
    border-radius: 8px;
    background: #fff;
}

.g29-gallery-media-moves {
    gap: 2px;
}

.g29-gallery-media-moves button,
.g29-gallery-media-delete {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: var(--g29-ui-muted, #6d7889);
    background: transparent;
    transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.g29-gallery-media-moves button:hover {
    color: var(--g29-ui-ink, #17243a);
    background: #fff;
}

.g29-gallery-media-delete:hover {
    color: #9f3047;
    background: rgba(163, 61, 78, 0.1);
}

.g29-gallery-media-moves button:active,
.g29-gallery-media-delete:active {
    transform: scale(0.94);
}

.g29-gallery-media-moves svg,
.g29-gallery-media-delete svg {
    width: 14px;
    height: 14px;
}

.g29-gallery-empty {
    display: grid;
    min-height: 190px;
    grid-column: 1 / -1;
    place-items: center;
    align-content: center;
    gap: 7px;
    border: 1px dashed rgba(23, 36, 58, 0.16);
    border-radius: 15px;
    color: var(--g29-ui-muted, #6d7889);
    background: rgba(255, 255, 255, 0.74);
    text-align: center;
}

.g29-gallery-empty > span {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 13px;
    color: var(--g29-ui-accent, #a9485c);
    background: var(--g29-ui-accent-soft, rgba(169, 72, 92, 0.11));
}

.g29-gallery-empty strong {
    color: var(--g29-ui-ink, #17243a);
    font-size: 12px;
}

.g29-gallery-empty p {
    max-width: 36ch;
    margin: 0;
    font-size: 10px;
    line-height: 1.5;
}

.g29-gallery-manager .screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
    white-space: nowrap !important;
}

.g29-gallery-manager button:focus-visible,
.g29-gallery-manager select:focus-visible,
.g29-gallery-manager input:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(169, 72, 92, 0.16);
}

@media (max-width: 760px) {
    .g29-gallery-manager-header,
    .g29-gallery-category-bar {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .g29-gallery-manager-header {
        flex-direction: column;
    }

    .g29-gallery-upload,
    .g29-gallery-upload label,
    .g29-gallery-upload > button {
        flex: 1 1 0;
    }

    .g29-gallery-media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .g29-gallery-category-create input {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .g29-gallery-manager * {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
