.temp-uploader {
    width: 100%;
    margin: 12px 0 20px;
    box-sizing: border-box;
}

.temp-uploader input[type="file"] {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-bottom: 14px;
    box-sizing: border-box;
}

.temp-upload-list {
    display: grid;
    grid-template-columns: repeat(
        auto-fill,
        minmax(320px, 1fr)
    );
    gap: 14px;
    width: 100%;
}

.temp-upload-card {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;

    width: 100%;
    min-width: 0;

    padding: 12px;

    border: 1px solid #d1d5db;
    border-radius: 12px;

    background: #fff;

    box-sizing: border-box;
    overflow: hidden;
}

.temp-upload-preview {
    width: 90px;
    height: 110px;

    overflow: hidden;

    border-radius: 9px;

    background: #eef2f7;

    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;
}

.temp-upload-preview a {
    display: block;
    width: 100%;
    height: 100%;
}

.temp-upload-preview img,
.temp-upload-preview iframe {
    display: block;

    width: 100%;
    height: 100%;

    border: 0;

    object-fit: cover;

    box-sizing: border-box;
}

.temp-upload-preview iframe {
    pointer-events: none;
}

.temp-upload-pdf-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    font-size: 18px;
    font-weight: 700;

    color: #4b5563;
}

.temp-upload-body {
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.temp-upload-filename {
    display: block;

    width: 100%;
    max-width: 100%;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 14px;
}

.temp-upload-meta {
    width: 100%;

    margin-top: 6px;

    color: #6b7280;

    font-size: 12px;
    line-height: 1.4;

    overflow-wrap: anywhere;
}

.temp-upload-progress {
    width: 100%;
    height: 8px;

    margin-top: 10px;

    overflow: hidden;

    border-radius: 999px;

    background: #e5e7eb;
}

.temp-upload-progress > div {
    width: 0;
    height: 100%;

    border-radius: inherit;

    background: #2563eb;

    transition: width 0.1s linear;
}

.temp-upload-actions {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 90px;
}

.temp-upload-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: auto;
    min-width: 82px;
    min-height: 38px;

    padding: 8px 12px;

    border: 0;
    border-radius: 8px;

    background: #dc2626;
    color: #fff;

    font-family: inherit;
    font-size: 13px;
    font-weight: 600;

    white-space: nowrap;

    cursor: pointer;

    box-sizing: border-box;
}

.temp-upload-remove:hover:not(:disabled) {
    background: #b91c1c;
}

.temp-upload-remove:disabled {
    opacity: 0.45;
    cursor: default;
}

.temp-upload-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: auto !important;
    min-width: 170px;
    min-height: 40px;

    margin-top: 14px;
    padding: 9px 14px !important;

    white-space: nowrap;
}

.temp-upload-card.error {
    border-color: #dc2626;
}

.temp-upload-card.complete {
    border-color: #86efac;
}

.pdf-preview-frame {
    display: block;

    width: 100%;
    height: 190px;

    border: 0;
    border-radius: 8px;

    background: #f3f4f6;
}

.file-preview-link {
    display: block;
    width: 100%;

    text-decoration: none;
}

.file-preview-link img {
    display: block;

    width: 100%;
    height: 190px;

    object-fit: cover;

    border-radius: 8px;
}

.file-preview-link iframe {
    pointer-events: none;
}

@media (max-width: 700px) {
    .temp-upload-list {
        grid-template-columns: 1fr;
    }

    .temp-upload-card {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 10px;
    }

    .temp-upload-preview {
        width: 72px;
        height: 90px;
    }

    .temp-upload-actions {
        grid-column: 1 / -1;

        width: 100%;
        min-width: 0;

        justify-content: flex-end;
    }

    .temp-upload-remove {
        min-width: 100px;
    }

    .temp-upload-clear {
        width: 100% !important;
    }

    .pdf-preview-frame,
    .file-preview-link img {
        height: 160px;
    }
}

/* Globaler Datei-Viewer */
.file-viewer { display:none; position:fixed; inset:0; z-index:10000; background:rgba(0,0,0,.72); align-items:center; justify-content:center; padding:18px; box-sizing:border-box; }
.file-viewer-panel { width:min(1400px, 96vw); height:min(920px, 94vh); background:#fff; border-radius:14px; overflow:hidden; display:flex; flex-direction:column; box-shadow:0 24px 70px rgba(0,0,0,.35); }
.file-viewer-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 16px; border-bottom:1px solid #e5e7eb; }
.file-viewer-header > strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file-viewer-actions { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.file-viewer-body { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; background:#eef1f5; overflow:auto; }
.file-viewer-image { display:block; max-width:100%; max-height:100%; object-fit:contain; margin:auto; }
.file-viewer-frame { width:100%; height:100%; border:0; background:#fff; }
body.file-viewer-open { overflow:hidden; }
[data-file-viewer] { cursor:pointer; }
@media (max-width:700px) { .file-viewer { padding:0; } .file-viewer-panel { width:100vw; height:100vh; border-radius:0; } .file-viewer-header { align-items:flex-start; flex-direction:column; } .file-viewer-actions { width:100%; flex-wrap:wrap; } .file-viewer-actions .small-button { flex:1; min-width:120px; } }

/* Datei-Viewer Buttons an normales UI-Design anpassen */

.file-viewer-actions a,
.file-viewer-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: auto;
    min-height: 38px;

    padding: 9px 14px;

    border: none;
    border-radius: 10px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;

    text-decoration: none;
    cursor: pointer;

    box-sizing: border-box;

    transition:
        transform 0.15s ease,
        background-color 0.15s ease,
        opacity 0.15s ease;
}

/* Separat öffnen */
.file-viewer-actions .file-viewer-open {
    background: #e5e7eb;
    color: #111827;
}

.file-viewer-actions .file-viewer-open:hover {
    background: #d1d5db;
    color: #111827;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Herunterladen */
.file-viewer-actions .file-viewer-download {
    background: #2563eb;
    color: #ffffff;
}

.file-viewer-actions .file-viewer-download:hover {
    background: #1d4ed8;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
}

.file-viewer-actions a:active,
.file-viewer-actions button:active {
    transform: translateY(0);
}

@media (max-width: 700px) {
    .file-viewer-actions a,
    .file-viewer-actions button {
        min-height: 42px;
        padding: 10px 14px;
    }
}
