/* =========================================================
   01. Basis / Variablen
   ========================================================= */

:root {
    --bg: #f4f7fb;
    --ink: #162033;
    --muted: #6b778c;
    --panel: #ffffff;
    --line: #dfe6f0;
    --blue: #2364d2;
    --blue2: #153e7c;
    --dark: #14213d;
    --shadow: 0 12px 30px rgba(19, 36, 66, 0.10);
}

* {
    box-sizing: border-box;
}

body.app-body {
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    background: var(--bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a.disabled {
    pointer-events: none;
    opacity: 0.55;
}


/* =========================================================
   02. Topbar & Header
   ========================================================= */

.topbar {
    position: relative;
    z-index: 3;
    display: grid;
    /* Update 2026-06: Optimierte Spaltenaufteilung */
    grid-template-columns: 300px minmax(360px, 1fr) auto;
    gap: 18px;
    align-items: center;
    height: 64px;
    padding: 0 18px;
    color: #ffffff;
    background: linear-gradient(90deg, #111b31, #1d3765);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.topbar .btn {
    border-radius: 999px !important;
}

.brand-text {
    font-size: 1.13rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.brandmark {
    display: none;
}

.top-search {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 40px;
    padding: 0 10px 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.top-search input {
    width: 100%;
    min-width: 0;
    color: #ffffff;
    background: transparent;
    border: 0;
    outline: 0;
}

.top-search input::placeholder {
    color: rgba(255, 255, 255, 0.72);
}

.top-search-wide {
    justify-content: space-between;
}

.top-search-text {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    flex: 1 1 auto;
}

.top-date-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 170px;
    padding-left: 12px;
    margin-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.top-date-filter input[type="date"] {
    width: 132px;
    min-width: 132px;
    color-scheme: dark;
}

.top-date-filter input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(1);
    opacity: 0.85;
}

/* Temporär deaktivierte Filter */
#toggleLast7Filter {
    display: none !important;
}

.top-userzone {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    white-space: nowrap;
}

.top-userzone-useronly {
    justify-self: end;
    margin-left: auto;
}

.quota-chip,
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    font-size: 0.88rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.11);
}

.quota-chip {
    font-weight: 700;
    color: #1d3765;
    background: #ffffff;
    border-color: #ffffff;
}

#diskFreeChip {
    white-space: nowrap;
}

.user-chip-button {
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    cursor: pointer;
    transition: 0.15s;
}

.user-chip-button:hover,
.user-chip-button:focus {
    color: #ffffff;
    background: rgba(20, 130, 65, 0.22) !important;
    border-color: rgba(20, 130, 65, 0.55) !important;
}

.top-userzone-useronly .user-chip {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* =========================================================
   03. Grundlayout & Footer
   ========================================================= */

.app-shell {
    display: grid;
    grid-template-columns: 280px 350px minmax(520px, 1fr) 360px;
    gap: 12px;
    height: calc(100vh - 96px);
    padding: 12px;
}

.collections-pane,
.category-pane,
.content-pane,
.details-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.collections-pane {
    position: relative;
    color: #ffffff;
    background: #111b31;
    border-color: #111b31;
}

.content-pane {
    min-width: 0;
}

.content-pane.content-drag {
    outline: 3px dashed #0d6efd;
    outline-offset: -10px;
    background: #eef6ff;
}

.app-footer {
    position: relative;
    display: grid !important;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 38px !important;
    
    /* NEU: padding-bottom hinzugefügt (10px). Die 0 12px bleiben für links/rechts */
    padding: 0 10px;
    padding-bottom: 10px !important; 
    
    color: #6d7890;
    font-size: 0.72rem;
    background: transparent;
    text-align: center;
    line-height: 1.35;
}

.app-footer .footer-copy {
    grid-column: 2;
}

.footer-logout {
    grid-column: 3;
    justify-self: end;
    white-space: nowrap;
    min-height: 24px !important;
    padding: 2px 8px !important;
    font-size: 0.68rem !important;
    line-height: 1.05 !important;
    border-radius: 999px !important;
}


/* =========================================================
   04. Panel-Köpfe
   ========================================================= */

.pane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 76px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.collections-pane .pane-head {
    border-color: rgba(255, 255, 255, 0.12);
}

.pane-head .btn-group {
    gap: 8px !important;
}

.pane-head .btn-group > .btn,
.pane-head .btn {
    border-radius: 999px !important;
}

.pane-head .btn-group > .btn:not(:first-child) {
    margin-left: 0 !important;
}

.pane-head small {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.collections-pane .pane-head small {
    color: #91a8cc;
}

.pane-head h1,
.pane-head h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
}

.pane-head p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.content-pane .pane-head,
.details-pane .pane-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #ffffff;
}

.content-pane .pane-head {
    align-items: flex-start;
}

.content-pane #contentTitle {
    margin-bottom: 0 !important;
    font-size: 1.05rem !important;
    line-height: 1.05 !important;
}

.content-pane #contentSubtitle {
    margin-top: 1px !important;
    margin-bottom: -10px !important;
    font-size: 0.70rem !important;
    line-height: 1.05 !important;
}


/* =========================================================
   05. Scrollbereiche
   ========================================================= */

.collection-list,
.category-tree,
.file-grid,
.details-form,
.details-empty {
    min-height: 0;
    overflow: auto;
    padding: 12px;
}

.collection-list {
    flex: 1 1 auto !important;
    padding-bottom: 12px !important;
}


/* =========================================================
   06. Sammlungen (Sidebar Links)
   ========================================================= */

.collection-item {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    padding: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.07);
    transition: 0.15s;
}

.collection-item:hover {
    background: rgba(255, 255, 255, 0.13);
}

/* PATCH 2026-06-05: Klare grüne Hervorhebung */
.collection-item.active {
    color: #ffffff !important;
    background: rgba(22, 163, 74, 0.22) !important;
    border: 1px solid rgba(34, 197, 94, 0.60) !important;
    box-shadow: inset 4px 0 0 #22c55e, 0 4px 16px rgba(22, 163, 74, 0.25) !important;
}

.collection-item.active strong {
    color: #ffffff !important;
}

.collection-item.active small {
    color: rgba(255, 255, 255, 0.75) !important;
    opacity: 1 !important;
}

.collection-item strong {
    display: block;
}

.collection-item small {
    display: block;
    max-width: 185px;
    overflow: hidden;
    color: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.72;
}

.count-pill {
    padding: 4px 8px;
    color: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    border-radius: 999px;
    background: rgba(35, 100, 210, 0.12);
}

.collection-item.active .count-pill {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.18) !important;
}

/* Verstecke Counter beim Hover, um Platz für Aktions-Icons zu machen */
.collection-item:hover .count-pill {
    visibility: hidden;
}

/* Sammlungs-Info Bereich (Sticky Bottom) */
.collections-fixed-info {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 4;
    padding: 12px;
    margin-top: auto;
    background: linear-gradient(180deg, rgba(17,27,49,0.88), #111b31 28%, #111b31 100%);
    border-top: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 -14px 28px rgba(0,0,0,0.24);
}

.collections-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.collections-info-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    width: 100%;
    padding: 7px 10px;
    color: #12213c;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    background: #ffffff;
    border: 1px solid rgba(255,255,255,0.88);
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}

.collections-admin-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.collections-admin-actions .btn {
    font-weight: 800;
    border-radius: 999px !important;
}

.collections-fixed-info-hdd-only .collections-info-grid {
    grid-template-columns: 1fr;
}

.collections-fixed-info-hdd-only .collections-admin-actions,
#sideDownloadQuota {
    display: none !important;
}


/* =========================================================
   07. Globale kleine Buttons / Aktionen
   ========================================================= */

.item-actions {
    position: absolute;
    right: 8px;
    bottom: 6px;
    display: none;
    gap: 4px;
}

.collection-item:hover .item-actions,
.cat-node:hover .item-actions {
    display: flex;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    color: #1d3765;
    background: rgba(255, 255, 255, 0.85);
    border: 0;
    border-radius: 8px;
    transition: 0.15s;
}

/* PATCH 2026-06-05: Hover grün */
.icon-btn:hover {
    color: #ffffff !important;
    background: #1a8a4a !important;
}

.cat-node .icon-btn {
    background: #eef3fb;
}

.btn-outline-primary:hover {
    background-color: #166534 !important;
    border-color: #166534 !important;
    color: #ffffff !important;
}


/* =========================================================
   08. Kategoriebaum
   ========================================================= */

.category-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 12px 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.category-search-box input {
    border: 0;
    outline: none;
    width: 100%;
    min-width: 0;
    background: transparent;
}

.category-tree {
    background: linear-gradient(180deg, #ffffff, #fbfdff);
}

#categoryTree.category-tree {
    display: block !important;
    align-items: initial !important;
    justify-content: initial !important;
    padding: 8px 6px 14px 4px !important;
    text-align: left !important;
}

#categoryTree.category-tree.empty-box {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

.explorer-branch {
    position: relative;
    margin: 0;
    padding: 0 0 0 18px;
    list-style: none;
}

.explorer-root {
    padding-left: 0;
}

.explorer-branch:not(.explorer-root)::before {
    content: "";
    position: absolute;
    top: -4px;
    bottom: 14px;
    left: 8px;
    border-left: 1px solid #c7d3e5;
}

.explorer-li {
    position: relative;
    margin: 2px 0;
}

.explorer-li::before {
    content: "";
    position: absolute;
    top: 18px;
    left: -10px;
    width: 12px;
    border-top: 1px solid #c7d3e5;
}

.explorer-root > .explorer-li::before {
    display: none;
}

/* Überschreibungen für den speziellen Baum */
#categoryTree.category-tree .explorer-root {
    width: 100% !important;
    margin: 0 !important;
    padding-left: 0 !important;
}
#categoryTree.category-tree .explorer-branch {
    margin: 0 !important;
    padding-left: 12px !important;
}
#categoryTree.category-tree .explorer-branch:not(.explorer-root)::before {
    left: 5px !important;
}
#categoryTree.category-tree .explorer-li {
    margin: 2px 0 !important;
}
#categoryTree.category-tree .explorer-li::before {
    left: -7px !important;
    width: 9px !important;
}

.cat-node {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    width: 100% !important;
    min-height: 34px !important;
    gap: 5px !important;
    padding: 5px 7px !important;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid transparent;
    border-radius: 10px;
    transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.cat-node:hover {
    background: #f2f6fc;
}

.cat-node.active {
    color: #14532d !important;
    background: #dcfce7 !important;
    border-color: #86efac !important;
    box-shadow: inset 3px 0 0 #16a34a !important;
}

.tree-toggle {
    display: inline-flex;
    flex: 0 0 15px !important;
    align-items: center;
    justify-content: center;
    width: 15px !important;
    height: 22px !important;
    color: #64748b;
    background: transparent;
    border: 0;
    border-radius: 6px;
}

.tree-toggle:hover {
    color: #146c35 !important;
    background: #d4f1e2 !important;
}

.tree-toggle.invisible {
    visibility: hidden;
}

.node-icon {
    flex: 0 0 17px !important;
    font-size: 1rem !important;
}

.cat-node.leaf .node-icon {
    color: #22915f;
}

.cat-node.has-child .node-icon {
    color: #c77a00;
}

.cat-title {
    flex: 1;
    overflow: hidden;
    font-size: 0.9rem !important;
    font-weight: 700;
    line-height: 1.1 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.new-files-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: .03em;
    color: #8a4200;
    background: #ffe4bf;
    border: 1px solid #ffbd73;
    margin-left: auto;
    white-space: nowrap;
}

.cat-node .cat-title + .new-files-badge + .cat-counter,
.cat-node .new-files-badge + .cat-counter {
    margin-left: 4px;
}

.cat-counter {
    min-width: 22px !important;
    margin-right: 0 !important;
    margin-left: auto !important;
    padding: 2px 6px !important;
    color: #51617a;
    font-size: 0.68rem !important;
    font-weight: 800;
    line-height: 1 !important;
    text-align: center;
    background: #ffffff;
    border: 1px solid #dbe5f2;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.cat-counter.cat-counter-recent {
    color: #a84f00 !important;
    background: #fff1dc !important;
    border-color: #ffb65f !important;
    box-shadow: 0 0 0 2px rgba(255, 162, 51, 0.12) !important;
}

.cat-node.active .cat-counter.cat-counter-recent {
    color: #8a4200 !important;
    background: #ffe4bf !important;
    border-color: #ffb65f !important;
}

.cat-node:hover .cat-counter {
    visibility: hidden;
}

.cat-node .item-actions {
    top: 50%;
    right: 7px;
    bottom: auto;
    z-index: 3;
    transform: translateY(-50%);
}

#emptyCategoryBtn {
    margin-right: 20px !important;
}


/* =========================================================
   09. Kategorie-Beschreibung
   ========================================================= */

.category-description-card {
    flex: 0 0 auto;
    margin: 12px 12px 0;
    padding: 12px 13px;
    background: linear-gradient(135deg, #f7faff, #ffffff);
    border: 1px solid #dfe6f0;
    border-radius: 14px;
    box-shadow: 0 5px 14px rgba(19, 36, 66, 0.06);
}

.category-description-label {
    margin-bottom: 3px;
    color: #6b778c;
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.category-description-title {
    margin-bottom: 6px;
    color: #162033;
    font-weight: 900;
}

.category-description-text {
    color: #34435b;
    font-size: 0.88rem;
    line-height: 1.42;
    word-break: break-word;
}


/* =========================================================
   10. Dateiübersicht / Grid
   ========================================================= */

.file-grid {
    align-content: start;
}

.content-pane #fileGrid.file-grid,
.content-pane #fileGrid.file-grid:not(.empty-box) {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    grid-auto-rows: auto !important;
    align-items: start !important;
    align-content: start !important;
    gap: 6px !important;
    padding: 6px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    columns: auto !important;
    column-count: initial !important;
    column-width: auto !important;
    column-gap: normal !important;
}

.content-pane #fileGrid.file-grid.empty-box {
    display: flex !important;
}

.content-pane #fileGrid.file-grid:not(.empty-box)::before,
.content-pane #fileGrid.file-grid:not(.empty-box)::after {
    display: none !important;
    content: none !important;
}

.file-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(19, 36, 66, 0.07);
    transition: 0.15s;
}

.file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(19, 36, 66, 0.12);
}

.file-card.active {
    border-color: #8eb2ff;
    outline: 3px solid rgba(35, 100, 210, 0.32);
}

.file-card-image-only {
    min-height: 0;
    padding: 0;
    background: #ffffff;
}

.file-card-image-only .file-card-body {
    display: none;
}

.content-pane #fileGrid.file-grid > .file-card.file-card-image-only {
    position: relative !important;
    display: block !important;
    contain: layout paint !important;
    width: 100% !important;
    height: clamp(190px, 15.5vw, 280px) !important;
    min-height: 190px !important;
    max-height: 280px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #ffffff !important;
    border: 1px solid #dfe6f0 !important;
    border-radius: 10px !important;
    box-shadow: 0 3px 10px rgba(19, 36, 66, 0.07) !important;
    transform: none !important;
    break-inside: auto !important;
    page-break-inside: auto !important;
    -webkit-column-break-inside: auto !important;
}

.content-pane #fileGrid.file-grid > .file-card.file-card-image-only:hover {
    transform: none !important;
    box-shadow: 0 4px 12px rgba(19, 36, 66, 0.10) !important;
}

.content-pane #fileGrid.file-grid > .file-card.file-card-image-only.active {
    border-color: #8eb2ff !important;
    outline: 2px solid rgba(35, 100, 210, 0.45) !important;
    outline-offset: -2px !important;
}

.thumb-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #edf2f8, #f9fbff);
    border-bottom: 1px solid #edf2f8;
}

.content-pane #fileGrid.file-grid > .file-card.file-card-image-only > .thumb-wrap {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #ffffff !important;
    border: 0 !important;
}

.thumb-wrap img {
    display: block;
}

.overview-thumb {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    border-radius: 11px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
}

.content-pane #fileGrid.file-grid > .file-card.file-card-image-only > .thumb-wrap > img.overview-thumb {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: contain !important;
    object-position: center center !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
}

.pdf-thumb {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 120px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(180deg, #fff7f7, #f7f7fb);
    color: #b02a37;
    font-weight: 800;
    border-radius: inherit;
}

.pdf-thumb .bi {
    font-size: clamp(2.6rem, 6vw, 4.8rem);
}

.file-card-body {
    padding: 9px 10px;
    background: #ffffff;
}

.file-card-body strong {
    display: block;
    overflow: hidden;
    font-size: 0.88rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-card-body small {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* =========================================================
   11. Thumbnail-Aktionsbuttons & Overlays
   ========================================================= */

.thumb-action-stack {
    position: absolute !important;
    right: 8px !important;
    bottom: 8px !important;
    z-index: 10 !important;
    display: none !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
}

.file-card-image-only:hover .thumb-action-stack {
    display: flex !important;
}

.thumb-action-stack .thumb-delete-btn,
.thumb-action-stack .thumb-release-btn,
.thumb-action-stack .thumb-preview-btn {
    position: static !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 11 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    color: #ffffff !important;
    border: 0 !important;
    border-radius: 999px !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25) !important;
    transition: 0.15s;
}

.thumb-action-stack .thumb-delete-btn {
    background: rgba(220, 53, 69, 0.92) !important;
}

.thumb-action-stack .thumb-delete-btn:hover {
    color: #ffffff !important;
    background: #b02a37 !important;
}

.thumb-action-stack .thumb-release-btn {
    background: rgba(13, 110, 253, 0.92) !important;
}

.thumb-action-stack .thumb-release-btn.is-released {
    background: rgba(25, 135, 84, 0.94) !important;
}

.thumb-action-stack .thumb-release-btn:hover {
    color: #ffffff !important;
    filter: brightness(0.92) !important;
}

.thumb-release-btn.is-blocked,
.download-blocked {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.thumb-action-stack .thumb-preview-btn {
    background: rgba(15, 23, 42, 0.80) !important;
}

.thumb-action-stack .thumb-preview-btn:hover {
    color: #ffffff !important;
    background: #1a7a41 !important;
}

/* Badges (Datum, Grösse) auf Thumbnails */
.thumb-size-badge,
.thumb-upload-date {
    position: absolute !important;
    z-index: 9 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    max-width: calc(100% - 18px) !important;
    padding: 3px 7px !important;
    overflow: hidden !important;
    color: #fff !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    background: rgba(15, 23, 42, 0.76) !important;
    border: 1px solid rgba(255,255,255,0.28) !important;
    border-radius: 999px !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.20) !important;
    backdrop-filter: blur(3px) !important;
}

.thumb-size-badge {
    top: 8px !important;
    right: 8px !important;
}

.thumb-upload-date {
    top: 8px !important;
    left: 8px !important;
    background: rgba(168, 79, 0, 0.90) !important;
}


/* =========================================================
   12. Detailbereich
   ========================================================= */

.details-form {
    padding: 14px;
}

.details-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.details-empty .bi {
    margin-bottom: 10px;
    color: #9aabc4;
    font-size: 3rem;
}

.detail-preview {
    display: none !important;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    max-height: none;
    margin-bottom: 14px;
    padding: 12px;
    overflow: auto;
    background: linear-gradient(135deg, #eef3fb, #fafcff);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.detail-preview img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 360px;
    object-fit: contain;
}

.detail-preview img.ba-tile-img {
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    object-fit: initial;
}

.detail-preview .ba-tile-host {
    align-items: flex-start;
    min-height: 340px;
}

.pdf-detail-preview {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.detail-preview-thumb-wrap {
    margin-bottom: 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--line);
}

.detail-mini-preview {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
    padding: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #f7faff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(19, 36, 66, 0.06);
}

.detail-mini-preview:hover {
    border-color: #9dbaf2;
    box-shadow: 0 8px 18px rgba(19, 36, 66, 0.10);
}

.detail-mini-preview img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: 190px !important;
    object-fit: contain !important;
    background: #ffffff;
    border-radius: 10px !important;
}

.detail-preview-zoom {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #ffffff;
    background: rgba(17, 27, 49, 0.82);
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(3px);
}

.detail-actionbar,
.detail-toolbar,
.detail-toolbar-note {
    display: none !important;
}

.move-category-box {
    padding: 12px;
    background: #f7faff;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.alias-category-box {
    padding: 12px;
    background: #fffaf0;
    border: 1px solid #f2d49b;
    border-radius: 14px;
}

.alias-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 9px;
    margin: 0 4px 6px 0;
}

.btn-close-sm {
    width: .55em;
    height: .55em;
    padding: .15em;
    font-size: .7rem;
}

.selected-file-info {
    margin: 10px 0 12px;
    padding: 9px 11px;
    color: #162033;
    background: linear-gradient(135deg, #f6f9ff, #ffffff);
    border: 1px solid #dfe6f0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(19,36,66,0.06);
}

.selected-file-info strong {
    display: block;
    overflow: hidden;
    font-size: 0.92rem;
    line-height: 1.18;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-file-info span {
    display: block;
    margin-top: 3px;
    color: #6b778c;
    font-size: 0.74rem;
    line-height: 1.2;
}


/* =========================================================
   13. Bild-Tiles / Detail- und Modalansicht
   ========================================================= */

.ba-tile-host {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.ba-tile-host-card {
    min-height: 132px;
}

.ba-tile-host-detail {
    min-height: 340px;
    padding: 0;
}

.ba-tile-host-modal {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    min-height: 72vh;
    padding: 10px;
    overflow: auto;
}

.ba-tile-view {
    position: relative;
    flex: 0 0 auto;
    overflow: hidden;
    user-select: none;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(101, 116, 139, 0.18);
    -webkit-user-select: none;
}

.ba-tile-host-modal .ba-tile-view {
    border-radius: 14px;
    box-shadow:
        0 10px 34px rgba(15, 23, 42, 0.18),
        inset 0 0 0 1px rgba(101, 116, 139, 0.22);
}

.ba-tile-ready {
    background: #ffffff;
}

.ba-tile-loading,
.ba-tile-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    min-height: 90px;
    padding: 12px;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
}

.ba-tile-error {
    color: #b42318;
    background: #fff4f2;
}

.ba-modal-preview-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 120px;
    padding: 18px 22px;
    color: #475569;
    font-size: 0.92rem;
    font-weight: 800;
}

.ba-modal-preview-loader .spinner-border {
    width: 1.25rem;
    height: 1.25rem;
}

.image-modal-meta {
    margin: 12px auto 0;
    max-width: min(1024px, 96%);
    padding: 10px 14px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    color: #334155;
    text-align: center;
}

.image-modal-meta strong {
    display: block;
    color: #0f172a;
    font-size: 0.98rem;
    line-height: 1.25;
}

.image-modal-meta span {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
}

.ba-tile-img {
    position: absolute;
    display: block;
    margin: 0;
    padding: 0;
    pointer-events: none;
    user-select: none;
    border: 0;
    -webkit-user-drag: none;
}

.ba-tile-img-error {
    opacity: 0.18;
}

.ba-tile-badge {
    display: none;
}


/* =========================================================
   14. Bildmodal
   ========================================================= */

.image-modal-body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 72vh;
    overflow: auto;
    background: #f6f9fe;
}

#imageModalTitle {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    line-height: 1.15;
}

.image-modal-title-text {
    font-size: 0.95rem;
    font-weight: 600;
}

.image-modal-title-date {
    font-size: 0.78rem;
    font-weight: 400;
    opacity: 0.72;
}


/* =========================================================
   15. Upload
   ========================================================= */

.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px !important;
    padding: 18px !important;
    color: #51617a;
    text-align: center;
    cursor: pointer;
    background: #f6f9fe;
    border: 2px dashed #91a8cc;
    border-radius: 16px !important;
}

.drop-zone.drag {
    background: #e8f0ff;
    border-color: var(--blue);
}

.drop-zone .bi {
    color: var(--blue);
    font-size: 2.2rem !important;
}

.drop-zone h4 {
    margin: 0.25rem 0 !important;
    font-size: 1.05rem !important;
}

.drop-zone p {
    margin: 0 !important;
    font-size: 0.88rem !important;
}

.upload-max-info {
    margin-top: 8px;
    color: #51617a;
    font-size: 0.82rem;
    font-weight: 700;
}

.drop-zone .upload-max-info strong {
    color: #162033;
}

.uploadModal .modal-body {
    padding-bottom: 14px;
}

.upload-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    padding: 9px 12px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.upload-row.compact {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 5px;
    align-items: center;
    gap: 4px 8px !important;
    margin-bottom: 4px !important;
    padding: 5px 7px !important;
    font-size: 0.78rem !important;
    border-radius: 8px !important;
}

.upload-row.compact .upload-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-row.compact .upload-status .badge {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-progress-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    padding-right: 4px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.upload-file-progress {
    grid-column: 1 / -1;
    height: 5px !important;
}

.upload-overall-progress {
    height: 16px !important;
    border-radius: 999px;
}

.upload-overall-progress .progress-bar {
    font-size: 0.68rem;
    font-weight: 800;
}

.upload-done-banner {
    margin: 0 0 10px;
    padding: 9px 12px;
    color: #166534;
    font-weight: 900;
    text-align: center;
    letter-spacing: 0.08em;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 12px;
    cursor: pointer;
}

.upload-done-banner.upload-done-error {
    color: #842029;
    background: #f8d7da;
    border-color: #f1aeb5;
}

#uploadCloseDone.d-none {
    display: none !important;
}

.file-size-under-preview {
    margin-top: 6px;
    text-align: center;
    font-size: .78rem;
    color: #6c757d;
}


/* =========================================================
   16. Leere Zustände / Skeleton / Toast
   ========================================================= */

.empty-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    color: var(--muted);
    text-align: center;
}

.empty-box-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 160px;
    height: 100%;
    color: var(--muted);
    text-align: center;
}

.empty-box-inner .bi {
    color: #9aabc4;
    font-size: 2.6rem;
}

.empty-mini {
    padding: 12px;
    color: rgba(255, 255, 255, 0.72);
}

.category-tree .empty-mini {
    color: var(--muted);
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05),
        rgba(255, 255, 255, 0.13),
        rgba(255, 255, 255, 0.05)
    );
    background-size: 240% 100%;
    animation: sk 1.2s infinite;
}

@keyframes sk {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.toast-top-center {
    z-index: 2200;
}

.toast-top-center .toast {
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.22);
}


/* =========================================================
   17. Formulare
   ========================================================= */

.form-label {
    color: #36445d;
    font-size: 0.86rem;
    font-weight: 700;
}


/* =========================================================
   18. Login
   ========================================================= */

.login-bg {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 14%, rgba(216, 176, 104, 0.28), transparent 30%),
        radial-gradient(circle at 82% 88%, rgba(45, 91, 151, 0.42), transparent 32%),
        linear-gradient(135deg, #111827 0%, #16213b 43%, #0b1020 100%);
}

.login-bg::before,
.login-bg::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.login-bg::before {
    inset: -16%;
    background-image:
        linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
    background-size: 48px 48px;
    transform: rotate(-4deg);
    mask-image: radial-gradient(circle at center, #000 0%, transparent 70%);
}

.login-bg::after {
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.06) 0 2px, transparent 2px 46px) left bottom / 92px 120px repeat-x,
        radial-gradient(circle at center, transparent 0 58%, rgba(0,0,0,0.34) 100%);
    opacity: 0.72;
}

.login-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(320px, 560px) minmax(360px, 440px);
    width: min(1020px, 96vw);
    min-height: 640px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 34px;
    box-shadow: 0 34px 110px rgba(0, 0, 0, 0.44);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
}

.login-hero-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 44px;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(13, 22, 39, 0.48), rgba(68, 47, 26, 0.54)),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.06) 0 2px, transparent 2px 86px),
        radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.17), transparent 18%),
        linear-gradient(135deg, #46351f, #17213a 58%, #0f172a);
    isolation: isolate;
}

.login-hero-panel::before {
    content: "";
    position: absolute;
    inset: 32px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 26px;
    box-shadow: inset 0 0 60px rgba(255, 255, 255, 0.05);
    z-index: -1;
}

.login-archive-stamp {
    position: absolute;
    top: 36px;
    left: 40px;
    padding: 7px 13px;
    color: rgba(255, 237, 213, 0.9);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    border: 1px solid rgba(255, 237, 213, 0.4);
    border-radius: 999px;
    background: rgba(120, 53, 15, 0.22);
}

.login-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 22px;
    color: #fff7ed;
    font-size: 2.25rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.13);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
}

.login-hero-content h1 {
    max-width: 12ch;
    margin: 0 0 14px;
    font-size: clamp(2.35rem, 5vw, 4.1rem);
    font-weight: 950;
    line-height: 0.94;
    letter-spacing: -0.055em;
}

.login-hero-content p {
    max-width: 420px;
    margin: 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 1.02rem;
    line-height: 1.65;
}

.login-filmstrip {
    position: absolute;
    right: 26px;
    top: 26px;
    bottom: 26px;
    display: grid;
    gap: 10px;
    width: 58px;
    opacity: 0.42;
}

.login-filmstrip span {
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.09);
}

.login-card {
    width: auto;
    padding: 42px;
    text-align: left;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 0;
}

.login-card-heritage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: none !important;
}

.login-brandmark {
    margin: 0 0 22px;
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.26);
}

.login-kicker {
    margin-bottom: 8px;
    color: #b45309;
    font-size: 0.75rem;
    font-weight: 950;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.login-card h2 {
    margin: 0;
    color: #0f172a;
    font-size: 2rem;
    font-weight: 950;
    letter-spacing: -0.035em;
}

.login-subtitle {
    margin: 9px 0 28px;
    color: #64748b;
    font-weight: 650;
}

.login-alert {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-field .form-label {
    margin-bottom: 7px;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap .bi {
    position: absolute;
    left: 16px;
    top: 50%;
    z-index: 2;
    color: #64748b;
    transform: translateY(-50%);
}

.login-input-wrap .form-control {
    min-height: 56px;
    padding-left: 46px;
    color: #0f172a;
    font-weight: 750;
    border: 1px solid #dbe5f2;
    border-radius: 17px;
    background: #f8fbff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.login-input-wrap .form-control:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.login-submit {
    min-height: 56px;
    margin-top: 4px;
    font-weight: 900;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, #1d4ed8, #0f766e);
    box-shadow: 0 18px 38px rgba(29, 78, 216, 0.28);
}

.login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 44px rgba(29, 78, 216, 0.34);
}

.login-footer-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 26px;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 750;
}


/* =========================================================
   19. Admin / Benutzerverwaltung
   ========================================================= */

.admin-only-btn {
    font-weight: 700;
}

.users-area {
    min-height: 420px;
}

.user-table-wrap {
    overflow: auto;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.user-table {
    margin: 0;
}

.user-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #36445d;
    font-size: 0.86rem;
    background: #f6f9fe;
}

.user-table td,
.user-table th {
    padding: 12px 14px;
}

.stat-card {
    padding: 18px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(19, 36, 66, 0.07);
}

.stat-card small {
    display: block;
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-card strong {
    display: block;
    margin-top: 4px;
    color: var(--blue2);
    font-size: 2rem;
    line-height: 1.1;
}

.users-modal-header,
.user-edit-modal-header {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
}

.users-modal-title {
    min-width: 0;
}

.users-modal-actions {
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    margin-left: auto !important;
}

.users-modal-actions .btn-close,
.user-edit-modal-header .btn-close {
    flex: 0 0 auto !important;
    margin-left: 8px !important;
}

.user-collection-access-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
    gap: 8px 18px !important;
    max-height: 220px !important;
    overflow: auto !important;
    padding: 12px !important;
    background: #f8fafc !important;
}

.user-collection-access-item {
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    min-height: 30px !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    line-height: 1.25 !important;
    cursor: pointer !important;
    border-radius: 10px !important;
}

.user-collection-access-item:hover {
    background: #eef4ff !important;
}

.user-collection-access-item .form-check-input {
    position: static !important;
    flex: 0 0 auto !important;
    float: none !important;
    margin: 0 !important;
}

.user-collection-access-item .form-check-label {
    min-width: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.user-self-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.user-self-summary > div {
    padding: 12px;
    background: #f8fbff;
    border: 1px solid #dfe6f0;
    border-radius: 14px;
}

.user-self-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}


/* =========================================================
   20. Bildmodal-Lupe / Detailfenster (Desktop)
   ========================================================= */

@media (min-width: 1101px) {
    .image-modal-with-magnifier .modal-dialog {
        max-width: min(1040px, calc(100vw - 440px));
        margin-right: auto;
        margin-left: auto;
    }
}

.ba-magnifier-pane {
    position: fixed;
    z-index: 1095;
    width: 360px;
    max-width: calc(100vw - 24px);
    color: #e5edf8;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.97), rgba(30, 41, 59, 0.96));
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(10px) scale(0.985);
    pointer-events: none;
    transition: opacity 0.14s ease, transform 0.14s ease;
    overflow: hidden;
}

.ba-magnifier-pane.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ba-magnifier-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px;
    font-size: 0.86rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.ba-magnifier-head .bi {
    color: #93c5fd;
    font-size: 1.1rem;
}

.ba-magnifier-head strong {
    margin-left: auto;
    padding: 4px 9px;
    color: #07111f;
    border-radius: 999px;
    background: #bfdbfe;
}

.ba-magnifier-window {
    position: relative;
    height: 340px;
    margin: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px;
    background:
        linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25% 75%, rgba(255,255,255,0.06) 75%),
        linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25% 75%, rgba(255,255,255,0.06) 75%);
    background-position: 0 0, 10px 10px;
    background-size: 20px 20px;
}

.ba-magnifier-canvas {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    will-change: transform;
    filter: brightness(var(--ba-magnifier-brightness, 100%));
}

.ba-magnifier-tile {
    position: absolute;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.ba-magnifier-crosshair::before,
.ba-magnifier-crosshair::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 4;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.42);
    transform: translate(-50%, -50%);
}

.ba-magnifier-crosshair::before {
    width: 1px;
    height: 100%;
}

.ba-magnifier-crosshair::after {
    width: 100%;
    height: 1px;
}

.ba-magnifier-foot {
    padding: 0 15px 14px;
    color: #aebed2;
    font-size: 0.76rem;
    font-weight: 750;
    text-align: center;
}

.ba-magnifier-source-dot {
    position: absolute;
    z-index: 15;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.26);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.26), 0 4px 18px rgba(15, 23, 42, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}

.ba-magnifier-source-dot.show {
    opacity: 1;
}

.ba-image-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 18px;
    color: #e5edf8;
    border-top: 1px solid rgba(255,255,255,0.12);
    background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(30,41,59,0.94));
}

.ba-image-modal-footer-title {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.ba-image-modal-footer-control {
    display: grid;
    grid-template-columns: auto minmax(180px, 360px) auto auto auto;
    align-items: center;
    gap: 10px;
    width: min(720px, 100%);
}

.ba-image-modal-footer-control .form-range {
    margin: 0;
}

.ba-image-modal-footer-min,
.ba-image-modal-footer-max {
    color: #aebed2;
    font-size: 0.72rem;
    font-weight: 750;
}

#baModalBrightnessValue {
    min-width: 48px;
    color: #07111f;
    padding: 5px 9px;
    border-radius: 999px;
    background: #bfdbfe;
    text-align: center;
}


/* =========================================================
   21. Responsive Media Queries (Gemerged)
   ========================================================= */

@media (max-width: 1450px) {
    .app-shell {
        grid-template-columns: 240px 320px minmax(420px, 1fr) 330px;
    }
    .topbar {
        grid-template-columns: 270px minmax(220px, 1fr) auto;
    }
    .quota-chip {
        max-width: 220px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .admin-only-btn {
        padding-right: 0.55rem;
        padding-left: 0.55rem;
    }
    .admin-only-btn#openUsers {
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 1200px) {
    .collections-info-chip {
        font-size: 0.72rem;
        padding-left: 8px;
        padding-right: 8px;
    }
    .collections-admin-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1180px) {
    body.app-body {
        overflow: auto;
    }
    .topbar {
        grid-template-columns: 220px minmax(360px, 1fr) auto;
    }
    .quota-chip {
        display: none;
    }
    .app-shell {
        grid-template-columns: 1fr;
        min-height: calc(100vh - 130px);
        height: auto;
    }
    .collections-pane,
    .category-pane,
    .content-pane,
    .details-pane {
        min-height: 300px;
    }
    .content-pane #fileGrid.file-grid,
    .content-pane #fileGrid.file-grid:not(.empty-box) {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    .content-pane #fileGrid.file-grid > .file-card.file-card-image-only {
        height: clamp(190px, 26vw, 290px) !important;
    }
}

@media (max-width: 1100px) {
    .ba-magnifier-pane,
    .ba-magnifier-source-dot {
        display: none !important;
    }
}

@media (max-width: 880px) {
    .login-bg { padding: 16px; }
    .login-shell { grid-template-columns: 1fr; min-height: auto; }
    .login-hero-panel { display: none; }
    .login-card { padding: 30px; border-radius: 30px; }
}

@media (max-width: 860px) {
    .topbar {
        grid-template-columns: 1fr !important;
        height: auto;
        padding: 10px;
    }
    .top-search-wide {
        flex-wrap: wrap;
        border-radius: 18px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .top-date-filter {
        width: 100%;
        min-width: 0;
        padding-left: 0;
        margin-left: 0;
        border-left: 0;
    }
    .top-userzone {
        flex-wrap: wrap;
    }
}

@media (max-width: 840px) {
    .ba-image-modal-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }
    .ba-image-modal-footer-control {
        grid-template-columns: 1fr auto auto;
    }
    .ba-image-modal-footer-min,
    .ba-image-modal-footer-max {
        display: none;
    }
}

@media (max-width: 720px) {
    .content-pane #fileGrid.file-grid,
    .content-pane #fileGrid.file-grid:not(.empty-box) {
        grid-template-columns: 1fr !important;
    }
    .content-pane #fileGrid.file-grid > .file-card.file-card-image-only {
        height: 260px !important;
    }
    .users-modal-header {
        align-items: flex-start !important;
        flex-wrap: wrap !important;
    }
    .users-modal-actions {
        width: 100% !important;
        margin-left: 0 !important;
    }
    .users-modal-actions #newUser {
        flex: 1 1 auto !important;
    }
    .user-collection-access-list {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 700px) {
    .user-self-summary {
        grid-template-columns: 1fr;
    }
}