:root {
    --archive-modal-sidebar-space: calc(
        var(--dfms-layout-sidebar-width, 15.25rem)
        + (var(--dfms-layout-gutter, .75rem) * 2)
    );
}

body:has(.sidebar-collapsed) {
    --archive-modal-sidebar-space: calc(
        var(--dfms-layout-sidebar-collapsed-width, 4rem)
        + (var(--dfms-layout-gutter, .75rem) * 2)
    );
}

.archive-catalog-shell,
.archive-catalog {
    --archive-surface: var(--dfms-surface, var(--surface));
    --archive-surface-muted: var(--dfms-surface-muted, var(--background));
    --archive-text: var(--dfms-text, var(--text-primary));
    --archive-text-muted: var(--dfms-text-muted, var(--text-secondary));
    --archive-border: var(--dfms-border, var(--outline));
    --archive-primary: var(--dfms-primary, var(--primary));
    --archive-primary-soft: var(--dfms-primary-soft, var(--primary-container));
    --archive-shadow: var(--dfms-surface-shadow, 0 .4rem 1.2rem rgb(15 23 42 / 6%));
}

.archive-catalog-shell { position: relative; min-width: 0; }
.archive-catalog-shell:has(.archive-dialog-backdrop) { z-index: 11; }

@keyframes archiveCatalogFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-container:has(.archive-catalog-shell) {
    animation: archiveCatalogFadeIn .25s ease-out both;
}

.archive-catalog {
    display: grid;
    gap: .85rem;
    min-width: 0;
    color: var(--archive-text);
}

.archive-catalog__header,
.archive-filter-bar,
.archive-advanced-filters,
.archive-workspace {
    background: var(--archive-surface);
    border: 1px solid var(--archive-border);
    box-shadow: var(--archive-shadow);
}

.archive-catalog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1rem;
    border-radius: var(--dfms-surface-radius, 1rem);
}

.archive-catalog__heading { min-width: 0; }
.archive-catalog h1 { margin: .1rem 0; color: var(--archive-text); font-size: clamp(1.35rem, 2.2vw, 1.85rem); line-height: 1.25; }
.page-eyebrow { margin: 0; color: var(--archive-primary); font-size: .75rem; font-weight: 800; letter-spacing: .035em; }
.archive-catalog__heading > p:not(.page-eyebrow) { margin: 0; color: var(--archive-text-muted); font-size: .875rem; }

.archive-catalog__actions,
.archive-toolbar,
.archive-toolbar__selection,
.archive-pagination,
.archive-card__top,
.archive-card__top-actions,
.archive-card__footer,
.archive-result-summary {
    display: flex;
    align-items: center;
}

.archive-catalog__actions { justify-content: flex-end; flex-wrap: wrap; gap: .45rem; }
.archive-catalog .btn { padding-inline: .85rem; font-size: .8rem; }
.archive-catalog .btn-primary { background: linear-gradient(135deg, var(--archive-primary), #5b6fd8); }
.archive-catalog .btn-secondary { color: var(--archive-text); background: var(--archive-surface); border-color: var(--archive-border); }
.archive-catalog .btn-secondary:hover { background: var(--archive-surface-muted); border-color: var(--archive-primary); }
.archive-catalog .btn-ghost { color: var(--archive-text-muted); }
.archive-catalog .btn-ghost:hover { color: var(--archive-primary); background: var(--archive-primary-soft); }
.archive-catalog .btn-danger { color: #fff; background: var(--dfms-danger, #dc2626); }
.archive-catalog .btn-sm { min-height: 2.25rem; padding: .35rem .65rem; font-size: .75rem; }

.archive-message { padding: .7rem .9rem; border: 1px solid transparent; border-radius: .75rem; font-size: .875rem; font-weight: 600; }
.archive-message--success { color: #087c58; background: rgb(16 185 129 / 12%); border-color: rgb(16 185 129 / 28%); }
.archive-message--error { color: #bd2336; background: rgb(220 38 38 / 10%); border-color: rgb(220 38 38 / 24%); }
:root[data-theme="dark"] .archive-message--success { color: #8de4bd; }
:root[data-theme="dark"] .archive-message--error { color: #fda4af; }

.archive-filter-bar {
    display: grid;
    grid-template-columns: minmax(14rem, 2.1fr) minmax(9rem, .75fr) minmax(13rem, 1fr) auto;
    align-items: end;
    gap: .7rem;
    padding: .75rem;
    border-radius: .9rem;
    position: relative;
    z-index: 2;
}

.archive-advanced-filters {
    display: grid;
    grid-template-columns: repeat(7, minmax(8.25rem, 1fr));
    gap: .7rem;
    padding: .8rem;
    border-radius: .85rem;
}

.archive-field { display: grid; min-width: 0; gap: .35rem; color: var(--archive-text-muted); font-size: .77rem; font-weight: 700; }
.archive-field input,
.archive-field select,
.archive-field textarea,
.archive-department-filter__trigger {
    width: 100%;
    min-height: var(--dfms-control-height, 2.75rem);
    padding: .5rem .65rem;
    color: var(--archive-text);
    background: var(--archive-surface-muted);
    border: 1px solid var(--archive-border);
    border-radius: .6rem;
    font: inherit;
    text-align: right;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.archive-field textarea { min-height: 4.5rem; max-height: 4.5rem; resize: none; overflow-y: auto; }
.archive-field small { color: var(--archive-text-muted); font-size: .7rem; font-weight: 500; }
.archive-field b { color: var(--dfms-danger, #dc2626); }
.archive-field input:focus,
.archive-field select:focus,
.archive-field textarea:focus,
.archive-department-filter__trigger:focus-visible {
    outline: 0;
    border-color: var(--archive-primary);
    background: var(--archive-surface);
    box-shadow: 0 0 0 3px rgb(102 126 234 / 16%);
}

.archive-department-filter { position: relative; }
.archive-department-filter__trigger { display: flex; align-items: center; justify-content: space-between; gap: .5rem; cursor: pointer; }
.archive-department-filter__trigger > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.archive-department-filter__chevron {
    flex: 0 0 .75rem;
    width: .75rem;
    height: .75rem;
    margin: 0;
    border: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: .75rem;
    transform: none;
    transition: transform .16s ease;
}

.archive-department-filter__trigger[aria-expanded="true"]
.archive-department-filter__chevron {
    transform: rotate(180deg);
}

:root[data-theme="dark"] .archive-department-filter__chevron {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aebbd2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.archive-advanced-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: var(--dfms-control-height, 2.75rem);
    padding: .5rem .75rem;
    color: var(--archive-primary);
    background: var(--archive-primary-soft);
    border: 1px solid var(--archive-border);
    border-radius: .6rem;
    font: inherit;
    font-size: .8rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

    .archive-advanced-toggle:hover {
        background: var(--archive-surface);
        border-color: var(--archive-primary);
    }

.archive-filter-chips { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; padding: 0 .2rem; color: var(--archive-text-muted); font-size: .78rem; }
.archive-filter-chips > span { margin-inline-end: .2rem; font-weight: 800; }
.archive-filter-chips button { padding: .32rem .55rem; color: var(--archive-primary); background: var(--archive-primary-soft); border: 1px solid transparent; border-radius: 999px; font: inherit; font-size: .75rem; font-weight: 700; cursor: pointer; }
.archive-filter-chips button:hover { border-color: var(--archive-primary); }

.archive-workspace { min-width: 0; overflow: clip; border-radius: var(--dfms-surface-radius, 1rem); }
.archive-toolbar { justify-content: space-between; gap: 1rem; min-height: 3.35rem; padding: .65rem .9rem; border-bottom: 1px solid var(--archive-border); }
.archive-result-summary { gap: .35rem; color: var(--archive-text-muted); font-size: .82rem; }
.archive-result-summary strong { color: var(--archive-text); font-size: 1rem; }
.archive-result-summary__icon { display: grid; width: 1.8rem; aspect-ratio: 1; place-items: center; color: var(--archive-primary); background: var(--archive-primary-soft); border-radius: .55rem; }
.archive-toolbar__selection { min-width: 0; gap: .45rem; color: var(--archive-text-muted); font-size: .8rem; }
.archive-toolbar__selection strong { overflow: hidden; color: var(--archive-text); text-overflow: ellipsis; white-space: nowrap; }

.archive-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16.75rem, 1fr)); gap: .8rem; padding: .8rem; }
.archive-card { position: relative; display: grid; min-width: 0; min-height: 22.4rem; grid-template-rows: auto 1fr auto auto; overflow: hidden; background: var(--archive-surface); border: 1px solid var(--archive-border); border-radius: var(--dfms-surface-radius, 1rem); box-shadow: 0 .35rem 1rem rgb(15 23 42 / 6%); cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease; }
.archive-card::after { position: absolute; inset-inline: 0; bottom: 0; height: .3rem; content: ""; background: linear-gradient(90deg, #667eea, #6366f1, #3b82f6, #5a67d8); }
    .archive-card:hover {
        border-color: var(--archive-primary);
        box-shadow: 0 .85rem 1.8rem rgb(15 23 42 / 13%);
    }

.archive-card.is-selected {
    border-color: var(--archive-primary);
    background: var(--archive-surface);
    box-shadow: 0 0 0 3px rgb(102 126 234 / 16%), 0 .8rem 1.8rem rgb(15 23 42 / 12%);
}

.archive-card:focus-within {
    border-color: var(--archive-primary);
}

.archive-card:focus-visible {
    outline: 2px solid var(--archive-primary);
    outline-offset: 2px;
    border-color: var(--archive-primary);
    box-shadow: var(--dfms-focus-ring, 0 0 0 .2rem rgb(102 126 234 / 20%));
}
.archive-card__top { justify-content: space-between; padding: .9rem .9rem 0; }
.archive-card__document-icon { display: grid; width: 3rem; aspect-ratio: 1; place-items: center; color: #fff; background: linear-gradient(145deg, #667eea, #5167d6); border-radius: .85rem; box-shadow: 0 .45rem .9rem rgb(102 126 234 / 28%); font-size: 1.3rem; }
.archive-card__top-actions { gap: .4rem; }
.archive-card__main-flag { display: grid; width: 1.75rem; aspect-ratio: 1; place-items: center; color: #9a6500; background: #fff4c9; border: 1px solid #f4d76f; border-radius: 50%; font-size: .9rem; }
:root[data-theme="dark"] .archive-card__main-flag { color: #ffe49b; background: rgb(146 96 0 / 28%); border-color: rgb(251 191 36 / 38%); }
.archive-card__count { padding: .35rem .55rem; color: var(--archive-primary); background: var(--archive-primary-soft); border-radius: 999px; font-size: .78rem; font-weight: 800; }
.archive-card__count span { color: var(--archive-text-muted); font-weight: 700; }
.archive-card__body { display: grid; align-content: start; gap: .65rem; padding: .85rem .9rem; }
.archive-card__body h2 { display: -webkit-box; min-height: 3.05rem; overflow: hidden; margin: 0; color: var(--archive-text); font-size: 1.05rem; line-height: 1.45; text-align: center; text-overflow: ellipsis; line-clamp: 2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.archive-card__description { display: -webkit-box; min-height: 2.8rem; overflow: hidden; color: var(--archive-text-muted); font-size: .8rem; line-height: 1.7; text-align: center; line-clamp: 2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.archive-card__department,
.archive-card__user { display: flex; align-items: center; gap: .45rem; min-width: 0; padding: .55rem .65rem; border-radius: .65rem; font-size: .78rem; }
.archive-card__department { color: #315fbc; background: #e8f1ff; }
.archive-card__user { color: var(--archive-text-muted); background: var(--archive-surface-muted); }
:root[data-theme="dark"] .archive-card__department { color: #b9d4ff; background: rgb(59 130 246 / 16%); }
.archive-card__department-content { display: grid; min-width: 0; gap: .08rem; }
.archive-card__department-content small { overflow: hidden; color: currentColor; font-size: .65rem; font-weight: 600; line-height: 1.2; opacity: .72; text-overflow: ellipsis; white-space: nowrap; }
.archive-card__department-content strong { overflow: hidden; color: currentColor; font-size: .79rem; font-weight: 800; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.archive-card__user span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-card__metadata { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin: 0; padding: 0 .9rem .8rem; }
.archive-card__metadata div { min-width: 0; padding: .55rem .6rem; background: var(--archive-surface-muted); border-radius: .6rem; }
.archive-card__metadata div:last-child { background: var(--archive-primary-soft); }
.archive-card__metadata dt { color: var(--archive-text-muted); font-size: .68rem; font-weight: 700; }
.archive-card__metadata dd { overflow: hidden; margin: .16rem 0 0; color: var(--archive-text); font-size: .78rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.archive-card__metadata div:last-child dd { color: var(--archive-primary); }
.archive-card__footer { justify-content: space-between; gap: .5rem; padding: .55rem .65rem .78rem; border-top: 1px solid var(--archive-border); }
.archive-icon-button { display: grid; width: 2.5rem; min-width: 2.5rem; min-height: 2.5rem; aspect-ratio: 1; place-items: center; color: var(--archive-text-muted); background: transparent; border: 0; border-radius: .5rem; font-size: 1.1rem; cursor: pointer; }
.archive-icon-button:hover,
.archive-icon-button:focus-visible { color: var(--archive-primary); background: var(--archive-primary-soft); outline: 0; }

.archive-pagination { justify-content: center; gap: .7rem; padding: .7rem .9rem; color: var(--archive-text-muted); border-top: 1px solid var(--archive-border); font-size: .8rem; }
.archive-state { display: grid; min-height: 18rem; place-items: center; align-content: center; gap: .55rem; padding: 2rem; text-align: center; }
.archive-state p { max-width: 28rem; color: var(--archive-text-muted); font-size: .88rem; }
.archive-state h2 { color: var(--archive-text); font-size: 1.1rem; }
.archive-state__icon { display: grid; width: 3.25rem; aspect-ratio: 1; place-items: center; color: var(--archive-primary); background: var(--archive-primary-soft); border-radius: var(--dfms-surface-radius, 1rem); font-size: 1.4rem; }
.archive-state .loading-spinner { width: 2.4rem; height: 2.4rem; border-width: 3px; }

.archive-dialog-backdrop { position: fixed; z-index: 20; inset: 0 var(--archive-modal-sidebar-space) 0 0; display: grid; align-items: center; justify-items: center; min-height: 0; overflow: hidden; padding: .75rem; isolation: isolate; background: rgb(15 23 42 / 14%); }
.archive-dialog { display: flex; flex-direction: column; width: min(100%, 38rem); max-height: min(39rem, calc(100dvh - 1.5rem)); overflow: hidden; color: var(--archive-text); background: var(--archive-surface); border: 1px solid var(--archive-border); border-radius: .8rem; box-shadow: 0 1rem 2.35rem rgb(15 23 42 / 18%), 0 .1rem .35rem rgb(15 23 42 / 8%); }
.archive-dialog > header,
.archive-dialog > footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: .55rem; padding: .48rem .68rem; }
.archive-dialog > header { min-height: 2.55rem; border-bottom: 1px solid var(--archive-border); border-inline-start: .18rem solid var(--archive-primary); background: var(--archive-surface); }
.archive-dialog > footer { border-top: 1px solid var(--archive-border); }
.archive-dialog h2 { color: var(--archive-primary); font-size: .98rem; line-height: 1.25; }
.archive-dialog__body { display: grid; flex: 1 1 auto; min-height: 0; gap: .48rem; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: .55rem .68rem; scrollbar-gutter: stable; }
.archive-dialog--editor { width: min(100%, 34rem); max-height: min(38.5rem, calc(100dvh - 1.5rem)); }
.archive-dialog--move { width: min(100%, 37.5rem); max-height: min(34.5rem, calc(100dvh - 1.5rem)); }
.archive-dialog--compact { width: min(100%, 30rem); }
.archive-editor-form { grid-template-columns: minmax(0, 1.15fr) minmax(9rem, .85fr); gap: .5rem .6rem; }
.archive-editor-form > * { grid-column: 1 / -1; }
.archive-editor-form > label[for="archive-update-add-date"],
.archive-editor-form > label[for="archive-editor-add-date"] { grid-column: auto; }
.archive-editor-form__intro { color: var(--archive-text-muted); font-size: .79rem; line-height: 1.45; }
.archive-editor-form__validation { padding: .5rem .6rem; color: #bd2336; background: rgb(220 38 38 / 9%); border: 1px solid rgb(220 38 38 / 22%); border-radius: .6rem; font-size: .78rem; font-weight: 700; }
:root[data-theme="dark"] .archive-editor-form__validation { color: #fda4af; }
.archive-dialog .archive-field { gap: .22rem; }
.archive-dialog .archive-field input,
.archive-dialog .archive-field select,
.archive-dialog .archive-dialog-department-picker__trigger { min-height: 2.35rem; padding-block: .4rem; }
.archive-dialog .archive-field textarea { min-height: 3.5rem; max-height: 3.5rem; padding-block: .45rem; }
.archive-dialog--move .archive-field textarea { min-height: 3.8rem; max-height: 3.8rem; }
.archive-check { display: flex; align-items: flex-start; gap: .5rem; padding: .45rem .58rem; color: var(--archive-text); background: var(--archive-surface-muted); border: 1px solid var(--archive-border); border-radius: .65rem; font-size: .8rem; cursor: pointer; }
.archive-check input { margin-top: .17rem; accent-color: var(--archive-primary); }
.archive-check span { display: grid; gap: .08rem; }
.archive-check small { color: var(--archive-text-muted); font-size: .69rem; line-height: 1.3; }
.archive-dialog__message { padding: .5rem .6rem; border: 1px solid transparent; border-radius: .65rem; font-size: .78rem; font-weight: 700; line-height: 1.4; }
.archive-dialog__message--success { color: #087c58; background: rgb(16 185 129 / 12%); border-color: rgb(16 185 129 / 28%); }
.archive-dialog__message--error { color: #bd2336; background: rgb(220 38 38 / 9%); border-color: rgb(220 38 38 / 22%); }
:root[data-theme="dark"] .archive-dialog__message--success { color: #8de4bd; }
:root[data-theme="dark"] .archive-dialog__message--error { color: #fda4af; }
.archive-dialog__readonly-department { display: grid; min-height: var(--dfms-control-height, 2.75rem); gap: .06rem; padding: .5rem .65rem; overflow: hidden; color: var(--archive-text-muted); background: var(--archive-surface-muted); border: 1px solid var(--archive-border); border-radius: .6rem; }
.archive-dialog__readonly-department small { overflow: hidden; color: var(--archive-text-muted); font-size: .67rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.archive-dialog__readonly-department strong { overflow: hidden; color: var(--archive-text); font-size: .8rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.archive-dialog__summary { display: grid; gap: .3rem; margin: 0; padding: .5rem .6rem; background: var(--archive-surface-muted); border: 1px solid var(--archive-border); border-radius: .75rem; }
.archive-dialog__summary div { display: grid; grid-template-columns: minmax(7.5rem, .55fr) 1fr; gap: .65rem; align-items: start; min-width: 0; }
.archive-dialog__summary dt { color: var(--archive-text-muted); font-size: .78rem; font-weight: 700; }
.archive-dialog__summary dd { min-width: 0; margin: 0; color: var(--archive-text); font-size: .82rem; font-weight: 800; overflow-wrap: anywhere; }
.archive-dialog__warning { margin: 0; padding: .5rem .6rem; color: #8a5a00; background: rgb(245 158 11 / 11%); border: 1px solid rgb(245 158 11 / 28%); border-radius: .65rem; font-size: .76rem; line-height: 1.4; }
.archive-dialog__muted { margin: -.35rem 0 0; color: var(--archive-text-muted); font-size: .8rem; }
.archive-dialog__confirmation-text { margin: 0; white-space: pre-line; line-height: 1.8; }
.archive-dialog__footer--three-actions { flex-wrap: wrap; }
.archive-dialog__footer--three-actions .btn { flex: 1 1 8rem; }

.archive-dialog-department-picker { position: relative; min-width: 0; }
.archive-dialog-department-picker__trigger { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; min-height: var(--dfms-control-height, 2.75rem); padding: .5rem .65rem; color: var(--archive-text); background: var(--archive-surface-muted); border: 1px solid var(--archive-border); border-radius: .6rem; font: inherit; text-align: right; cursor: pointer; }
.archive-dialog-department-picker__trigger:hover,
.archive-dialog-department-picker__trigger:focus-visible { outline: 0; border-color: var(--archive-primary); background: var(--archive-surface); box-shadow: 0 0 0 3px rgb(102 126 234 / 16%); }
.archive-dialog-department-picker__value { display: grid; min-width: 0; gap: .06rem; overflow: hidden; }
.archive-dialog-department-picker__value small { overflow: hidden; color: var(--archive-text-muted); font-size: .67rem; font-weight: 600; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.archive-dialog-department-picker__value strong { overflow: hidden; color: var(--archive-text); font-size: .8rem; font-weight: 800; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.archive-dialog-department-picker__chevron { color: var(--archive-primary); font-size: 1.1rem; line-height: 1; }
.archive-dialog-department-picker__popover {
    position: fixed;
    inset: auto;
    top: anchor(bottom);
    left: anchor(left);
    z-index: 40;
    width: anchor-size(width);
    min-width: min(20rem, calc(100vw - 1rem));
    max-width: calc(100vw - 1rem);
    max-height: min(13rem, calc(100dvh - 1rem));
    gap: .35rem;
    margin: .25rem 0 0;
    padding: .45rem;
    overflow: hidden;
    color: var(--archive-text);
    background: var(--archive-surface);
    border: 1px solid var(--archive-border);
    border-radius: .75rem;
    box-shadow: 0 .9rem 1.75rem rgb(15 23 42 / 18%);
    position-try-fallbacks: flip-block;
}
.archive-dialog-department-picker__popover:not(:popover-open) { display: none; }
.archive-dialog-department-picker__popover:popover-open { display: grid; }
.archive-dialog-department-picker__popover::backdrop { background: transparent; }
.archive-dialog-department-picker__popover > input { width: 100%; min-height: 2.35rem; padding: .38rem .55rem; color: var(--archive-text); background: var(--archive-surface-muted); border: 1px solid var(--archive-border); border-radius: .55rem; font: inherit; text-align: right; }
.archive-dialog-department-picker__popover > input:focus { outline: 0; border-color: var(--archive-primary); box-shadow: 0 0 0 3px rgb(102 126 234 / 16%); }
.archive-dialog-department-picker__tree { height: 9.5rem; max-height: 9.5rem; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; background: var(--archive-surface-muted); border: 1px solid var(--archive-border); border-radius: .6rem; }
.archive-dialog-department-picker__node { display: flex; align-items: center; min-width: 0; }
.archive-dialog-department-picker__item { flex: 1; min-width: 0; min-height: 2.15rem; padding: .38rem .55rem; overflow: hidden; color: var(--archive-text); background: transparent; border: 0; font: inherit; text-align: right; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.archive-dialog-department-picker__toggle { width: 2.15rem; min-width: 2.15rem; min-height: 2.15rem; color: var(--archive-text-muted); background: transparent; border: 0; font: inherit; cursor: pointer; }
.archive-dialog-department-picker__toggle:disabled { opacity: .35; cursor: default; }
.archive-dialog-department-picker__item:hover,
.archive-dialog-department-picker__item:focus-visible,
.archive-dialog-department-picker__item.is-selected { color: var(--archive-primary); background: var(--archive-primary-soft); font-weight: 800; outline: 0; }

@supports not (position-anchor: --archive-picker-anchor) {
    .archive-dialog-department-picker__popover:popover-open {
        top: 50%;
        left: 50%;
        width: min(30rem, calc(100vw - 1rem));
        margin: 0;
        transform: translate(-50%, -50%);
    }
}
.archive-dialog__body,
.archive-dialog-department-picker__tree {
    scrollbar-width: thin;
    scrollbar-color: var(--archive-primary) transparent;
}.archive-dialog__body::-webkit-scrollbar,
.archive-dialog-department-picker__tree::-webkit-scrollbar { width: .55rem; height: .55rem; }
    .archive-dialog__body::-webkit-scrollbar-thumb,
    .archive-dialog-department-picker__tree::-webkit-scrollbar-thumb {
        background: var(--archive-primary);
        border: .14rem solid transparent;
        border-radius: 999px;
        background-clip: padding-box;
    }.archive-dialog__body::-webkit-scrollbar-track,
.archive-dialog-department-picker__tree::-webkit-scrollbar-track { margin: .35rem; background: transparent; }
body:has(.archive-dialog-backdrop) { overflow: hidden; }
.archive-dialog > footer .btn { display: inline-flex; align-items: center; justify-content: center; min-width: 5.5rem; line-height: 1; text-align: center; }

:root[data-theme="dark"] .archive-dialog-backdrop {
    background: rgb(2 6 23 / 42%);
}

@media (max-width: 68.75rem) {
    .archive-advanced-filters { grid-template-columns: repeat(4, minmax(8.25rem, 1fr)); }
    .archive-card-grid { grid-template-columns: repeat(auto-fill, minmax(15.75rem, 1fr)); }
}

@media (max-width: 64rem) {
    :root { --archive-modal-sidebar-space: 0rem; }
    body:has(.sidebar-collapsed) { --archive-modal-sidebar-space: 0rem; }
}

@media (max-width: 51.25rem) {
    .archive-catalog__header { align-items: stretch; flex-direction: column; }
    .archive-catalog__actions { justify-content: flex-start; }
    .archive-filter-bar { grid-template-columns: minmax(13rem, 1fr) minmax(9rem, .72fr); }
    .archive-field--search { grid-column: 1 / -1; }
    .archive-department-filter { grid-column: 1 / -1; }
    .archive-advanced-toggle { justify-self: start; }
    .archive-advanced-filters { grid-template-columns: repeat(3, minmax(8rem, 1fr)); }
}

@media (max-width: 37.5rem) {
    .archive-catalog { gap: .65rem; }
    .archive-catalog__header,
    .archive-filter-bar,
    .archive-advanced-filters,
    .archive-toolbar { padding: .7rem; }
    .archive-catalog__actions { display: grid; grid-template-columns: 1fr 1fr; }
    .archive-catalog__actions .btn { width: 100%; }
    .archive-filter-bar,
    .archive-advanced-filters { grid-template-columns: 1fr; }
    .archive-field--search,
    .archive-department-filter { grid-column: auto; }
    .archive-advanced-toggle { width: 100%; }
    .archive-toolbar { align-items: stretch; flex-direction: column; }
    .archive-toolbar__selection { justify-content: space-between; }
    .archive-card-grid { grid-template-columns: 1fr; gap: .65rem; padding: .65rem; }
    .archive-card { min-height: 0; }
    .archive-pagination { justify-content: space-between; gap: .4rem; }
    .archive-dialog-backdrop {
        inset-inline: 0;
        align-items: center;
        padding-block-start: max(.5rem, env(safe-area-inset-top, 0px));
        padding-inline-end: max(.5rem, env(safe-area-inset-right, 0px));
        padding-block-end: env(safe-area-inset-bottom, 0px);
        padding-inline-start: max(.5rem, env(safe-area-inset-left, 0px));
    }
    .archive-dialog {
        width: calc(100vw - 1rem);
        max-height: calc(
            100dvh
            - env(safe-area-inset-top, 0px)
            - env(safe-area-inset-bottom, 0px)
            - .75rem
        );
        border-radius: .85rem;
        border-bottom: 1px solid var(--archive-border);
    }
    .archive-dialog > header { min-height: 2.45rem; padding: .38rem .56rem; }
    .archive-dialog h2 { font-size: .91rem; }
    .archive-dialog > footer { gap: .45rem; padding: .45rem .56rem; }
    .archive-dialog__body { gap: .42rem; padding: .48rem .56rem; }
    .archive-editor-form { grid-template-columns: 1fr; }
    .archive-editor-form > label[for="archive-update-add-date"],
    .archive-editor-form > label[for="archive-editor-add-date"] { grid-column: 1; }
    .archive-dialog__summary div { grid-template-columns: 1fr; gap: .2rem; }
    .archive-dialog__footer--three-actions .btn { flex-basis: 100%; }
    .archive-dialog-department-picker__popover { margin-top: .35rem; }
}

@media (max-height: 48rem) {
    .archive-dialog > header,
    .archive-dialog > footer { padding-block: .5rem; }
    .archive-dialog__body { gap: .45rem; padding-block: .55rem; }
    .archive-dialog-department-picker__tree { height: 8.5rem; max-height: 8.5rem; }
}

@media (max-height: 32rem) {
    .archive-dialog-backdrop {
        padding-block-start: max(.5rem, env(safe-area-inset-top, 0px));
        padding-block-end: max(.5rem, env(safe-area-inset-bottom, 0px));
    }
    .archive-dialog {
        max-height: calc(
            100dvh
            - env(safe-area-inset-top, 0px)
            - env(safe-area-inset-bottom, 0px)
            - 1rem
        );
    }
    .archive-dialog > header,
    .archive-dialog > footer { padding-block: .6rem; }
    .archive-dialog__body { gap: .6rem; padding-block: .65rem; }
    .archive-dialog-department-picker__tree { height: 10.5rem; max-height: 10.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .archive-card,
    .archive-field input,
    .archive-field select,
    .archive-field textarea,
    .archive-department-filter__trigger,
    .archive-advanced-toggle { transition: none; }
}

#archive-more {
    gap: 0.15rem;
}

.archive-more-chevron {
    display: inline-flex;
    align-items: center;
    margin: 0;
    font-size: 0.8em;
    line-height: 1;
}

#archive-year {
    appearance: none;
    -webkit-appearance: none;
    padding-inline: .65rem 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left .75rem center;
    background-size: .75rem;
}

:root[data-theme="dark"] #archive-year {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aebbd2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
