:root {
    --library-bg: #f7f9fc;
    --library-accent: #1d4ed8;
    --library-muted: #6b7280;
    --library-border: #e5e7eb;
    --library-card-bg: #ffffff;
}

/* .library-hero--card {
    background: var(--library-card-bg);
    border: 1px solid var(--library-border);
    border-radius: 16px;
    padding: 32px;
    margin: 24px 0;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
} */

.library-hero.internal {
    border-left: 6px solid #f97316;
}

.library-hero__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.24em;
    font-size: 12px;
    color: var(--library-muted);
    margin-bottom: 12px;
}

.library-hero__title {
    font-size: clamp(28px, 3vw, 40px);
    margin: 0 0 12px;
}

.library-hero__subtitle {
    max-width: 720px;
    color: var(--library-muted);
    line-height: 1.6;
    margin: 0;
}

.library-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-card {
    background: var(--library-card-bg);
    border: 1px solid var(--library-border);
    border-radius: 12px;
    padding: 16px 20px;
}

.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--library-muted);
    letter-spacing: 0.18em;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

.library-collections header,
.internal-docs header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
}

.library-collections h2,
.internal-docs h2 {
    margin: 0;
}

.library-collections .muted,
.internal-docs .muted {
    color: var(--library-muted);
    font-size: 14px;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.collection-card {
    background: var(--library-card-bg);
    border: 1px solid var(--library-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.collection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.12);
}

.collection-owner {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.3em;
    color: var(--library-muted);
    margin: 0 0 6px;
}

.collection-description {
    margin: 0;
    color: #111827;
    line-height: 1.5;
}

.collection-updated {
    font-size: 13px;
    color: var(--library-muted);
}

.collection-tags .tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(29, 78, 216, 0.08);
    color: var(--library-accent);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    margin-right: 6px;
}

.doc-table-wrapper {
    overflow-x: auto;
    background: var(--library-card-bg);
    border: 1px solid var(--library-border);
    border-radius: 16px;
    padding: 8px;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.doc-table th,
.doc-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--library-border);
    text-align: left;
}

.doc-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--library-muted);
}

.doc-table tbody tr:hover {
    background: var(--library-bg);
}

@media (max-width: 640px) {
    .library-hero {
        padding: 24px;
    }

    .library-collections header,
    .internal-docs header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.library-ops {
    background: var(--library-card-bg);
    border: 1px solid var(--library-border);
    border-radius: 18px;
    padding: clamp(20px, 4vw, 32px);
    margin: 24px 0 40px;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
}

.library-ops__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.library-ops__search {
    flex: 1 1 280px;
}

.library-ops__search input {
    width: 100%;
}

.library-ops__search input,
.library-ops__select select {
    /* min-width: 220px; */
    border: 1px solid #457b9d;
    border-radius: 4px;
    padding: 10px 14px;
}

.library-ops__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 4px;
    border: 1px solid var(--library-border);
    padding: 8px 16px;
    font-weight: 600;
    /* background: #f8fafc; */
    color: #1d4ed8;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    min-height:42px;
}

.library-ops__btn--primary {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

.library-ops__btn--ghost {
    background: transparent;
    color: #ef4444;
    border-color: #ef4444;
}

.library-ops__btn--icon {
    /* border-radius: 999px; */
    border: none;
    width: 30px;
    /* height: 36px; */
    justify-content: center;
    color: #16a34a;
}

.library-ops__btn:hover {
    background: #e0f2ff;
    box-shadow: 0 10px 20px rgba(31, 96, 196, 0.15);
}

.library-category {
    border: 1px solid var(--library-border);
    border-radius: 14px;
    margin-bottom: 16px;
    overflow: hidden;
}

.library-category__header {
    padding: 10px;
    background: #f0f8ff;
    /* border-left: 4px solid #3498db; */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.library-category__title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.library-category__icon {
    color: #3498db;
    transition: transform 0.2s ease;
}

.library-category__icon.collapsed {
    transform: rotate(-90deg);
}

.library-category__badge {
    border: 1px solid #3498db;
    color: #3498db;
    border-radius: 999px;
    padding: 2px 12px;
    font-size: 13px;
}

.library-category__select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--library-muted);
}

/* .library-category__body {
    padding: 0 16px 16px;
} */

.library-category__drop-zone.is-empty {
    min-height: 120px;
    border: 2px dashed var(--library-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--library-muted);
}

.library-table-wrapper {
    overflow-x: auto;
    /* margin-top: 12px; */
}

.library-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--library-border);
    /* border-radius: 12px; */
    overflow: hidden;
}

.library-table th {
    background: #0056b3;
    color: #fff;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.08em;
    padding: 12px;
}

.library-table td {
    padding: 5px;
    border-bottom: 1px solid var(--library-border);
    font-size: 14px;
}

.library-category__footer {
    display: flex;
    justify-content: flex-end;
    /* padding: 12px 0; */
}

.library-category__pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.library-pagination {
    display: flex;
    gap: 6px;
}

.library-pagination__link {
    border: 1px solid var(--library-border);
    padding: 6px 12px;
    border-radius: 8px;
    color: #0d6efd;
}

.library-pagination__link.is-active {
    background: #0d6efd;
    color: #fff;
}

.library-empty-state {
    text-align: center;
    padding: 32px 0;
    color: var(--library-muted);
}

.library-preview-dialog .ui-dialog-content {
    padding: 0 !important;
    overflow: hidden !important;
}

#libraryPreviewDialog {
    padding: 0;
}

.library-preview__body {
    width: 100%;
    height: 100%;
    min-height: 420px;
}

.library-preview__stage {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 420px;
    background: #0f172a;
}

.library-preview__loader {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 5;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    background: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
}

.library-preview__loader.is-visible {
    display: flex;
}

.library-preview__loader-content {
    text-align: center;
}

.library-preview__loader-text {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    color: #fff;
}

.library-preview__loader .loader-spinner-main {
    position: relative;
    left: auto;
    transform: rotateZ(45deg);
    margin: 0 auto 1rem;
}

.library-preview__stage iframe,
.library-preview__stage img,
.library-preview__stage video {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #f8fafc;
}

.library-preview__stage img,
.library-preview__stage video {
    object-fit: contain;
    background: #111827;
    padding: 12px;
}

.library-preview__document {
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: 28px;
    background: #e2e8f0;
    color: #1e293b;
    user-select: text;
}

.library-preview__document .docx-wrapper {
    min-height: 100%;
    padding: 24px 0;
    background: #e2e8f0;
}

.library-preview__document .docx-wrapper > section {
    margin: 0 auto 24px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
}

.library-preview__document p,
.library-preview__document h1,
.library-preview__document h2,
.library-preview__document h3,
.library-preview__document h4 {
    max-width: 900px;
}

.library-preview__sheet {
    margin-bottom: 28px;
}

.library-preview__sheet h3 {
    margin: 0 0 12px;
    color: #334155;
    font-size: 16px;
}

.library-preview__sheet > div {
    overflow: auto;
}

.library-preview__sheet table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.library-preview__sheet th,
.library-preview__sheet td {
    min-width: 90px;
    padding: 7px 9px;
    border: 1px solid #cbd5e1;
    text-align: left;
    vertical-align: top;
}

.library-preview__sheet th {
    background: #f1f5f9;
    font-weight: 700;
}

.library-preview__presentation {
    display: flex;
    height: 100%;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #0f172a;
}

.library-preview__presentation-canvas {
    display: block;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    object-fit: contain;
    background: #fff;
}

.library-preview__presentation-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #e2e8f0;
}

.library-preview__presentation-controls .btn {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #0f172a !important;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    padding: 9px 16px;
    text-shadow: none;
}

.library-preview__presentation-controls .btn:hover,
.library-preview__presentation-controls .btn:focus-visible {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8 !important;
    outline: none;
}

.library-preview__fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    gap: 12px;
    color: #fff;
    display: none;
}

.library-preview__fallback.is-visible {
    display: flex;
}

.library-preview__download {
    padding: 10px 18px;
    border-radius: 999px;
    background: #22c55e;
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.library-manage {
    /* margin-top: 32px; */
    background: var(--library-card-bg);
    border: 1px solid var(--library-border);
    border-radius: 18px;
    padding: clamp(20px, 4vw, 32px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.library-manage__toolbar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 16px;
}

.library-field {
    display: flex;
    flex-direction: column;
    /* gap: 6px; */
}

.library-field label {
    font-size: 12px;
    text-transform: uppercase;
    /* letter-spacing: 0.2em; */
    color: var(--library-muted);
}

.library-field input,
.library-field select {
    border: 1px solid var(--library-border);
    border-radius: 4px;
    padding: 10px 14px;
    height:40px;
    /* min-width: 220px; */
}

.library-manage__actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.library-manage .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    padding: 8px 16px;
    font-weight: 600;
    cursor: pointer;
}

.library-manage .btn.primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.library-manage .btn.secondary {
    background: #f0f8ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.library-manage .btn.ghost {
    background: transparent;
    border-color: var(--library-border);
    color: var(--library-muted);
}

.library-manage .btn.icon {
    width: 36px;
    height: 36px;
    justify-content: center;
    border-radius: 50%;
    border-color: var(--library-border);
    color: #2563eb;
}

.library-manage .btn.icon.danger {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.3);
}

.library-mgt-category {
    border: 1px solid var(--library-border);
    border-radius: 16px;
    margin-bottom: 18px;
    overflow: hidden;
}

.library-mgt-category__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f0f8ff;
    /* border-left: 4px solid #2563eb; */
    cursor: pointer;
}

.library-mgt-category__title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.library-mgt-category__title i {
    color: #2563eb;
    transition: transform 0.2s ease;
}

.library-mgt-category__title i.collapsed {
    transform: rotate(-90deg);
}

.library-mgt-category__drag {
    border: none;
    background: transparent;
    padding: 0 12px 0 0;
    cursor: grab;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.library-mgt-category__drag span {
    width: 18px;
    height: 2px;
    background: #94a3b8;
    border-radius: 1px;
    display: block;
}

.library-mgt-category__drag:active {
    cursor: grabbing;
}

.library-mgt-category__meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.library-mgt-category__buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.library-mgt-category__buttons .btn.ghost {
    border-radius: 999px;
    padding: 6px 14px;
}

.library-mgt-category__meta .badge {
    border-radius: 999px;
    border: 1px solid #2563eb;
    color: #2563eb;
    padding: 4px 12px;
    font-size: 12px;
}

.library-mgt-category__body {
    /* padding: 18px; */
    border-top: 1px solid var(--library-border);
}

.library-table-wrapper {
    border: 1px solid var(--library-border);
    /* border-radius: 12px; */
    overflow: hidden;
}

.library-table th,
.library-table td {
    vertical-align: middle;
}

.library-table__form {
    width: 55%;
}

.library-table__file {
    width: 30%;
    min-width: 220px;
}

.library-table__actions {
    width: 280px;
    min-width: 100px;
    text-align: right;
}

.library-table__actions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.library-select-control {
    display: inline-flex;
    /* padding: 4px; */
    border: 1px solid var(--library-border);
    border-radius: 6px;
    /* background: #fff; */
}

.library-select-control input {
    width: 16px;
    height: 16px;
}

.library-table__form strong {
    font-size: 15px;
}

.library-table tbody tr[data-has-file="0"] {
    background: var(--library-missing-bg, #fee2e2);
}

.library-table tbody tr[data-has-file="0"] td {
    border-top: 1px solid var(--library-missing-border, #fecaca);
    border-bottom: 1px solid var(--library-missing-border, #fecaca);
}

.library-file__warning {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--library-missing-text, #991b1b);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.library-file__warning i {
    color: inherit;
}

.library-mgt-inline-input {
    width: 100%;
    height:45px;
    border: 1px solid transparent;
    background: transparent;
    font-weight: 600;
    font-size: 15px;
    padding: 4px 12px;
    border-radius: 6px;
}

.library-mgt-inline-input:focus {
    outline: none;
    border-color: #2563eb;
    background: #f0f7ff;
}

.library-file__summary {
    margin: 0;
    font-weight: 600;
    color: #1f2937;
}

.library-file__meta {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--library-muted);
}

.library-mgt-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.library-mgt-title .tag {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
}

.library-toggle {
    position: relative;
    width: 44px;
    height: 22px;
    display: inline-flex;
    align-items: center;
}

.library-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.library-toggle span[aria-hidden="true"] {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    background: #cbd5f5;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.library-toggle span[aria-hidden="true"]::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease;
}

.library-toggle input:checked + span[aria-hidden="true"] {
    background: #2563eb;
}

.library-toggle input:checked + span[aria-hidden="true"]::after {
    transform: translateX(20px);
}

.library-mgt-category p.helper {
    font-size: 11px;
    color: #94a3b8;
    margin: 2px 0 0;
}

.library-field--inline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.library-field--inline .checkbox {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px 0 0 0;
    line-height: 1.2;
    white-space: nowrap;
}

.library-field--inline .checkbox input[type="checkbox"] {
    position: static;
    display: block;
    flex: 0 0 18px;
    width: 18px;
    min-width: 18px;
    max-width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    accent-color: #2563eb;
}

.library-field--inline .checkbox span {
    display: inline-block;
    margin: 0;
}

.library-modal-open {
    overflow: hidden;
}

.library-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
}

.library-modal[hidden] {
    display: none;
}

.library-modal__dialog {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    width: min(540px, 100%);
    box-shadow: 0 25px 40px rgba(15, 23, 42, 0.2);
}

.library-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.library-modal__header h3 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(16px, 2vw, 20px);
}

.library-modal__eyebrow {
    margin: 0 0 6px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.library-upload-fields-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

#library-upload-files[hidden] {
    display: none !important;
}

.library-upload-dropzone {
    display: flex;
    min-height: 150px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 22px;
    border: 2px dashed #bfdbfe;
    border-radius: 14px;
    background: #f8fbff;
    color: #64748b;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.library-upload-dropzone:hover,
.library-upload-dropzone:focus-visible,
.library-upload-dropzone.is-dragging {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

.library-upload-dropzone.has-files {
    border-style: solid;
}

.library-upload-dropzone i {
    color: #2563eb;
    font-size: 30px;
}

.library-upload-dropzone strong {
    color: #1e293b;
    font-size: 16px;
}

.library-upload-dropzone em {
    color: #2563eb;
    font-style: normal;
    font-weight: 600;
}

.library-upload-dropzone small,
.library-upload-help {
    color: #64748b;
    font-size: 12px;
    line-height: 0.9;
}
.library-upload-help {
    padding:5px; 
}
.library-upload-file-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    max-height: 220px;
    overflow-y: auto;
}

.library-upload-file-row {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) minmax(180px, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}

.library-upload-file-row__icon {
    color: #2563eb;
}

.library-upload-file-row__name {
    overflow: hidden;
    color: #334155;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-upload-file-row input {
    min-width: 0;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 10px;
}

.library-upload-file-row__remove {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
    cursor: pointer;
}

.library-upload-file-row__remove:hover {
    background: #fee2e2;
}

.library-modal__footer {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.library-mgt-row-actions {
    display: grid;
    grid-auto-flow: column;
    align-items: center;
    justify-content: end;
    column-gap: 10px;
    min-height: 60px;
}

.library-mgt-row-actions__buttons {
    display: inline-flex;
    gap: 4px;
}

.library-mgt-row-actions__buttons .btn.icon {
    width: 28px;
    height: 28px;
    padding: 4px;
    border-radius: 999px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

tr[data-form-id].is-dragging {
    opacity: 0.5;
}

.library-mgt-category.is-drop-target {
    border: 2px dashed #2563eb;
    transition: border-color 0.2s ease;
}

.library-mgt-category.is-being-dragged {
    opacity: 0.5;
}

.library-mgt-order-hint {
    font-size: 13px;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.library-mgt-row-checkbox input {
    width: 16px;
    height: 16px;
}

.library-mgt-footer {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.library-mgt-footer__pagination {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    flex: 0 0 auto;
    display: flex;
}

.library-mgt-footer__actions {
    display: flex;
    justify-content: flex-end;
    flex: 0 0 auto;
    min-width: 220px;
    margin-left: auto;
}

@media (max-width: 640px) {
    .library-mgt-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .library-mgt-footer__pagination {
        position: static;
        transform: none;
        justify-content: center;
        margin-bottom: 8px;
    }

    .library-mgt-footer__actions {
        width: 100%;
        justify-content: center;
        min-width: 0;
        margin-left: 0;
    }
}

.library-pagination {
    list-style: none;
    padding: 0;
    margin: 0;
}

.library-pagination li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--library-border);
    color: #2563eb;
}

.library-pagination li.active a {
    background: #2563eb;
    color: #fff;
}

.library-empty {
    padding: 24px;
    border: 1px dashed var(--library-border);
    border-radius: 12px;
    text-align: center;
    color: var(--library-muted);
    background: var(--library-bg);
}

@media (max-width: 768px) {
    .library-upload-fields-row {
        grid-template-columns: 1fr;
    }

    .library-upload-file-row {
        grid-template-columns: auto 1fr auto;
    }

    .library-upload-file-row input {
        grid-column: 2 / -1;
        width: 100%;
    }

    .library-field input,
    .library-field select {
        min-width: 100%;
    }

    .library-mgt-category__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .library-mgt-category__meta {
        width: 100%;
        justify-content: space-between;
    }

    .library-table th,
    .library-table td {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .library-ops__filters {
        flex-direction: column;
    }

    .library-ops__search input,
    .library-ops__select select {
        width: 100%;
    }

    .library-category__title {
        flex-wrap: wrap;
    }

    .library-table thead {
        display: none;
    }

    .library-table tr {
        display: flex;
        flex-direction: column;
        border-bottom: 1px solid var(--library-border);
        padding: 10px 0;
    }

    .library-table td {
        border: none;
        display: flex;
        justify-content: space-between;
        width: 100%;
        font-size: 13px;
    }

    .library-table td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 12px;
    }
}
