.page-shell-collections {
    display: grid;
    align-content: start;
    gap: 24px;
}

.collections-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-top: 8px;
}

.collections-page-header h1 {
    margin: 0;
}

.collections-page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collections-page-eyebrow,
.collections-breadcrumb {
    color: var(--muted);
    font-size: 0.82rem;
}

.collections-breadcrumb {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.collections-breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.collections-search-shell {
    width: min(360px, 100%);
}

.collections-modal-search-shell {
    width: 100%;
}

.collections-primary-button,
.collections-secondary-button {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.collections-primary-button {
    background: #ffffff;
    color: #111114;
}

.collections-secondary-button {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
}

.collections-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.collections-empty-state {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 52vh;
    text-align: center;
}

.collections-empty-state[hidden] {
    display: none;
}

.collections-empty-title {
    font-size: 1.18rem;
    font-weight: 700;
}

.collections-empty-text {
    max-width: 420px;
    color: var(--muted);
}

.collections-empty-button {
    margin-top: 8px;
}

.collection-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    min-height: 84px;
    padding: 10px 10px 10px 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(18, 18, 24, 0.72);
}

.collection-card-link {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 14px;
    align-items: center;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.collection-card-preview {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.collection-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.collection-card-icon {
    font-size: 1.15rem;
    color: var(--text-soft);
}

.collection-card-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.collection-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.collection-card-title-row h2 {
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collection-card-meta {
    color: var(--muted);
    font-size: 0.8rem;
}

.collection-card-pin {
    color: #d6c7f4;
}

.collection-card-actions-shell {
    position: relative;
}

.collection-card-menu-toggle {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-soft);
}

.collection-card-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 10;
    display: grid;
    gap: 4px;
    min-width: 180px;
    padding: 8px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(22, 22, 28, 0.96);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.collection-card-menu[hidden] {
    display: none;
}

.collection-card-menu-button {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--text-soft);
    text-align: left;
}

.collection-card-menu-button.danger {
    color: #ff8177;
}

.collection-modal[hidden] {
    display: none;
}

.collection-modal {
    position: fixed;
    inset: 0;
    z-index: 75;
    display: grid;
    place-items: center;
}

.collection-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.collection-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(420px, calc(100% - 24px));
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #242428;
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.32);
}

.collection-modal-dialog-wide {
    width: min(680px, calc(100% - 24px));
}

.collection-add-dialog {
    width: min(760px, calc(100% - 24px));
}

.collection-modal-header h2 {
    margin: 0;
    font-size: 1.35rem;
}

.collection-modal-header {
    margin-bottom: 18px;
}

.collection-modal-subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.collection-editor-form,
.collection-choice-list,
.collection-add-list {
    display: grid;
    gap: 12px;
}

.collection-field-label {
    color: var(--text-soft);
    font-size: 0.84rem;
    font-weight: 600;
}

.collection-text-input {
    width: 100%;
    height: 46px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    outline: none;
}

.collection-form-error {
    min-height: 20px;
    color: #ff8177;
    font-size: 0.86rem;
}

.collection-editor-footer,
.collection-save-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.collection-save-actions {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: flex-end;
}

.collection-counter {
    color: var(--muted);
    font-size: 0.8rem;
}

.collection-editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

.collection-choice-row,
.collection-image-pick-card {
    display: grid;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
}

.collection-choice-row {
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    padding: 14px;
}

.collection-choice-row.is-saved {
    border-color: rgba(124, 163, 255, 0.28);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(114, 133, 190, 0.08) 100%);
}

.collection-choice-avatar {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.collection-choice-copy,
.collection-image-pick-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.collection-choice-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.collection-choice-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.collection-choice-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-soft);
    font-size: 0.76rem;
    font-weight: 600;
}

.collection-choice-badge-accent {
    background: rgba(125, 151, 255, 0.16);
    color: #dbe5ff;
}

.collection-choice-name,
.collection-image-pick-title {
    font-weight: 600;
}

.collection-choice-meta,
.collection-image-pick-meta,
.collection-choice-placeholder,
.collection-save-empty {
    color: var(--muted);
    font-size: 0.84rem;
}

.collection-choice-placeholder,
.collection-save-empty {
    padding: 20px;
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    text-align: center;
}

.collection-choice-action {
    min-width: 96px;
    justify-self: end;
}

.collection-image-pick-card {
    grid-template-columns: 72px 1fr auto;
}

.collection-image-pick-card img {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
}

.collections-primary-button:hover,
.collection-card-menu-toggle:hover,
.collection-card-menu-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.collections-secondary-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.collection-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
}

html[data-theme="light"] .collections-primary-button {
    background: #231d33;
    color: #ffffff;
}

html[data-theme="light"] .collections-primary-button:hover {
    background: #3b2e59;
}

html[data-theme="light"] .collections-secondary-button,
html[data-theme="light"] .collection-card,
html[data-theme="light"] .collection-card-menu,
html[data-theme="light"] .collection-modal-dialog,
html[data-theme="light"] .collection-choice-row,
html[data-theme="light"] .collection-image-pick-card {
    background: #ffffff;
    border-color: #e2dced;
}

html[data-theme="light"] .collection-card-preview,
html[data-theme="light"] .collection-text-input {
    background: #f6f1fc;
    border-color: #ddd7eb;
}

html[data-theme="light"] .collection-save-actions {
    border-top-color: #e2dced;
}

html[data-theme="light"] .collection-choice-row.is-saved {
    border-color: rgba(66, 98, 189, 0.22);
    background: linear-gradient(180deg, #ffffff 0%, #f2f6ff 100%);
}

html[data-theme="light"] .collection-choice-avatar {
    background: linear-gradient(135deg, #ece4fb, #dfe9ff);
    color: #2d2246;
}

html[data-theme="light"] .collection-choice-badge {
    background: #f4eefc;
    color: #5f5873;
}

html[data-theme="light"] .collection-choice-badge-accent {
    background: #e3ebff;
    color: #35539c;
}

html[data-theme="light"] .collection-card-meta,
html[data-theme="light"] .collections-page-eyebrow,
html[data-theme="light"] .collections-breadcrumb,
html[data-theme="light"] .collection-choice-meta,
html[data-theme="light"] .collection-image-pick-meta,
html[data-theme="light"] .collection-choice-placeholder,
html[data-theme="light"] .collection-save-empty,
html[data-theme="light"] .collection-counter {
    color: #645d78;
}

html[data-theme="light"] .collection-card-menu-button.danger,
html[data-theme="light"] .collection-form-error {
    color: #c84b4b;
}

html[data-theme="light"] .collection-card-menu-button:hover,
html[data-theme="light"] .collection-card-menu-toggle:hover,
html[data-theme="light"] .collections-secondary-button:hover {
    background: rgba(84, 46, 145, 0.08);
}

@media (max-width: 720px) {
    .collections-page-header,
    .collections-page-actions,
    .collection-editor-footer,
    .collection-save-actions,
    .collection-editor-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .collection-card {
        grid-template-columns: 1fr;
    }

    .collections-grid {
        grid-template-columns: 1fr;
    }

    .collection-choice-row {
        grid-template-columns: 1fr;
    }

    .collection-choice-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .collection-choice-badges {
        justify-content: flex-start;
    }

    .collection-choice-action {
        width: 100%;
    }

    .collection-card-actions-shell {
        justify-self: end;
    }

    .collection-image-pick-card {
        grid-template-columns: 1fr;
    }

    .collection-image-pick-card img {
        width: 100%;
        height: 180px;
    }
}
