* {
    box-sizing: border-box;
}

html {
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    margin: 0;
    background: #f3f4f6;
    color: #111827;
}

.hidden {
    display: none !important;
}

.topbar {
    min-height: 64px;
    padding: 0 24px;

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

    background: #111827;
    color: white;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 28px auto;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 22px;

    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.08),
        0 1px 4px rgba(0, 0, 0, 0.05);
}

.login-card {
    width: min(420px, 100%);
    margin: 70px auto;
}

h1,
h2 {
    margin-top: 0;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;

    margin-bottom: 16px;

    font-size: 0.95rem;
    font-weight: 600;
}

input,
select {
    width: 100%;

    padding: 10px 12px;

    border: 1px solid #cbd5e1;
    border-radius: 6px;

    background: white;
    color: #111827;

    font: inherit;
}

input:focus,
select:focus {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.button {
    border: 0;
    border-radius: 6px;

    padding: 9px 14px;

    font: inherit;
    font-weight: 600;

    cursor: pointer;
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary {
    background: #2563eb;
    color: white;
}

.secondary {
    background: #e5e7eb;
    color: #111827;
}

.danger {
    background: #dc2626;
    color: white;
}

.warning {
    background: #d97706;
    color: white;
}

.small {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.tabs {
    display: flex;
    gap: 8px;

    margin-bottom: 20px;
}

.tab {
    border: 0;
    border-radius: 6px;

    padding: 10px 16px;

    background: #d1d5db;

    cursor: pointer;
    font-weight: 600;
}

.tab.active {
    background: #111827;
    color: white;
}

.form-row {
    max-width: 400px;
}

.user-create-grid {
    display: grid;
    grid-template-columns:
        minmax(180px, 1fr)
        minmax(180px, 1fr)
        160px
        auto;

    gap: 16px;

    align-items: end;
}

.user-create-grid label {
    margin-bottom: 0;
}

.button-align {
    padding-bottom: 1px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;
}

.table-wrapper {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    padding: 12px 10px;

    text-align: left;
    vertical-align: middle;

    border-bottom: 1px solid #e5e7eb;
}

.users-table th {
    background: #f8fafc;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.status-active {
    color: #15803d;
    font-weight: 700;
}

.status-inactive {
    color: #b91c1c;
    font-weight: 700;
}

.role-admin {
    font-weight: 700;
}

.message {
    margin-top: 14px;
    padding: 10px 12px;

    border-radius: 6px;
}

.message.success {
    background: #dcfce7;
    color: #166534;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
}

.modal {
    position: fixed;
    inset: 0;

    z-index: 1000;

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

    padding: 20px;

    background: rgba(0, 0, 0, 0.55);
}

.modal-box {
    width: min(500px, 100%);

    padding: 24px;

    border-radius: 10px;

    background: white;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;

    gap: 10px;

    margin-top: 22px;
}

@media (max-width: 850px) {

    .user-create-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 12px 16px;
    }

    .container {
        width: min(100% - 20px, 1200px);
        margin-top: 16px;
    }

    .card {
        padding: 16px;
    }

    .tabs {
        flex-direction: column;
    }

    .users-table th,
    .users-table td {
        white-space: nowrap;
    }
}


.muted {
    color: #64748b;
    font-size: 0.9rem;
}

.external-pathbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

#external-path {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow-wrap: anywhere;
}

.external-browser {
    display: grid;
    grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1.2fr);
    gap: 24px;
}

.external-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.external-entry {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #111827;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.external-entry:hover {
    background: #eef2ff;
}

.external-file-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 10px;
    border-bottom: 1px solid #e5e7eb;
    overflow-wrap: anywhere;
}

.external-file-state {
    flex: 0 0 auto;
    color: #64748b;
    white-space: nowrap;
}

.state-imported {
    color: #15803d;
    font-weight: 700;
}

.checkbox-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: fit-content;
}

.checkbox-row input {
    width: auto;
}

.scan-result {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.scan-grid {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 6px 18px;
    max-width: 520px;
}

.scan-grid dt,
.scan-grid dd {
    margin: 0;
}

.scan-grid dd {
    font-weight: 700;
    text-align: right;
}

#external-import-actions {
    margin-top: 16px;
}

@media (max-width: 850px) {
    .external-browser {
        grid-template-columns: 1fr;
    }

    .external-file-row {
        flex-direction: column;
        gap: 3px;
    }

    .external-file-state {
        white-space: normal;
    }
}


/* External Import 004b */
.external-checkbox-row {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 9px;
    width: auto !important;
    margin: 8px 0 16px;
    font-weight: 600;
}

.external-checkbox-row input[type="checkbox"] {
    display: inline-block !important;
    flex: 0 0 auto !important;
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.external-progress {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}

.progress-grid {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 6px 14px;
    margin: 12px 0;
}

.progress-grid dt,
.progress-grid dd {
    margin: 0;
}

.progress-grid dt {
    font-weight: 700;
}

.progress-grid dd {
    overflow-wrap: anywhere;
}

.progress-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 60px;
    align-items: center;
    gap: 12px;
    margin: 12px 0 8px;
}

.progress-line progress {
    width: 100%;
    height: 20px;
}

.result-details {
    max-height: 420px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
}

.result-detail-row {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.result-detail-row:last-child {
    border-bottom: 0;
}

.result-imported {
    color: #166534;
}

.result-existing,
.result-duplicate {
    color: #854d0e;
}

.result-error {
    color: #b91c1c;
    font-weight: 700;
}

#external-rescan-actions {
    margin-top: 16px;
}

@media (max-width: 650px) {
    .progress-grid {
        grid-template-columns: 80px minmax(0, 1fr);
    }
}


/* External Import 004c: robuste Checkbox-Anordnung */
.external-checkbox-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    width: max-content !important;
    max-width: 100% !important;
    margin: 12px 0 18px !important;
}

.external-checkbox-row > input#external-recursive {
    appearance: auto !important;
    -webkit-appearance: checkbox !important;
    display: block !important;
    position: static !important;
    flex: 0 0 18px !important;
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: initial !important;
    border-radius: 0 !important;
}

.external-checkbox-row > label[for="external-recursive"] {
    display: block !important;
    flex: 0 1 auto !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
}


/* MiniReview 005 – Mediathek */
.media-toolbar { display:flex; flex-wrap:wrap; gap:8px; margin:18px 0; }
.media-filter.active { background:#111827; color:#fff; }
.media-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:16px; }
.media-card { display:block; min-width:0; padding:0; overflow:hidden; border:1px solid #e5e7eb; border-radius:9px; background:#fff; color:inherit; text-align:left; cursor:pointer; box-shadow:0 1px 2px rgba(0,0,0,.05); }
.media-card:hover { border-color:#94a3b8; box-shadow:0 4px 12px rgba(0,0,0,.08); }
.media-thumb-wrap { position:relative; width:100%; aspect-ratio:30/17; overflow:hidden; background:#111827; }
.media-thumb { display:block; width:100%; height:100%; object-fit:contain; object-position:center; }
.media-thumb-placeholder { display:flex; width:100%; height:100%; align-items:center; justify-content:center; color:#cbd5e1; font-weight:800; letter-spacing:.08em; }
.media-duration,.media-missing-badge { position:absolute; right:8px; bottom:8px; padding:3px 6px; border-radius:4px; background:rgba(17,24,39,.88); color:#fff; font-size:.78rem; font-weight:700; }
.media-missing-badge { top:8px; bottom:auto; background:#b91c1c; }
.media-card-body { padding:11px 12px 13px; }
.media-filename { overflow:hidden; margin-bottom:7px; font-weight:700; text-overflow:ellipsis; white-space:nowrap; }
.media-card-meta { overflow:hidden; color:#64748b; font-size:.82rem; line-height:1.45; text-overflow:ellipsis; white-space:nowrap; }
.media-empty { grid-column:1/-1; padding:36px 18px; border:1px dashed #cbd5e1; border-radius:8px; color:#64748b; text-align:center; }
.media-upload-form { display:grid; grid-template-columns:minmax(260px,1fr) auto; gap:14px; align-items:end; }
.media-upload-form label { margin:0; }
.upload-progress { display:grid; grid-template-columns:minmax(0,1fr) 60px; gap:12px; align-items:center; margin-top:16px; }
.upload-progress progress { width:100%; height:20px; }
.media-viewer { position:fixed; z-index:1000; inset:0; overflow:auto; padding:24px; background:rgba(15,23,42,.88); }
.media-viewer-dialog { width:min(1400px,100%); min-height:calc(100vh - 48px); margin:0 auto; padding:18px; border-radius:10px; background:#fff; }
.media-viewer-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:14px; }
.media-viewer-header h2 { margin:0; overflow-wrap:anywhere; }
.media-viewer-player { display:flex; min-height:360px; align-items:center; justify-content:center; overflow:hidden; border-radius:8px; background:#020617; }
.media-full-image { display:block; max-width:100%; max-height:78vh; object-fit:contain; }
.media-video { display:block; width:100%; max-height:78vh; background:#000; }
.media-viewer-bottom { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:20px; align-items:start; margin-top:16px; }
.media-viewer-details { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:8px 18px; }
.media-detail-row { display:flex; flex-direction:column; gap:2px; min-width:0; font-size:.88rem; }
.media-detail-row span { overflow-wrap:anywhere; color:#475569; }

@media (max-width:700px) {
    .media-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
    .media-upload-form { grid-template-columns:1fr; }
    .media-viewer { padding:0; }
    .media-viewer-dialog { min-height:100vh; border-radius:0; padding:12px; }
    .media-viewer-player { min-height:220px; }
    .media-viewer-bottom { grid-template-columns:1fr; }
    .media-filename { font-size:.88rem; }
}
@media (max-width:420px) {
    .media-grid { grid-template-columns:1fr; }
}


/* MiniReview 007 – External Browser Ladezustand */
.external-loading {
    padding: 16px 0;
    color: #64748b;
    font-weight: 600;
}


/* MiniReview 008 – Wiedergabefortschritt und Hover-Vorschau */
.media-watch-track {
    position: absolute;
    z-index: 6;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.28);
    pointer-events: none;
}

.media-watch-bar {
    width: 0;
    height: 100%;
    background: #ff0000;
    transition: width 180ms linear;
}

.media-hover-preview {
    position: absolute;
    z-index: 4;
    inset: 0;
    background-repeat: no-repeat;
    background-color: #111827;
    pointer-events: none;
}

.media-preview-time {
    position: absolute;
    z-index: 7;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    padding: 3px 7px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    pointer-events: none;
}


/* Release 008b: temporary player diagnostics */
.media-debug { margin-top:12px; padding:10px; border:1px solid #cbd5e1; border-radius:8px; background:#f8fafc; }
.media-debug-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.media-debug-log { box-sizing:border-box; width:100%; max-height:260px; margin:0; padding:10px; overflow:auto; border-radius:6px; background:#0f172a; color:#e2e8f0; font:12px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace; white-space:pre-wrap; overflow-wrap:anywhere; }

.comments-feed-list{display:flex;flex-direction:column;gap:9px;margin:14px 0}
.comments-feed-item{display:flex;align-items:flex-start;text-align:left;width:100%;gap:12px;padding:10px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;color:#0f172a;cursor:pointer}
.comments-feed-item:hover,.comments-feed-item:focus-visible{border-color:#2563eb;background:#eff6ff}
.comments-feed-thumb{width:128px;height:78px;flex:0 0 128px;object-fit:contain;border-radius:5px;background:#0f172a}
.comments-feed-body{min-width:0;display:flex;flex-direction:column;gap:5px}
.comments-feed-meta{font-size:.82rem;color:#475569}
.comments-feed-body strong,.comments-feed-text{overflow-wrap:anywhere}
.comments-feed-text{white-space:pre-wrap;line-height:1.4}
@media(max-width:550px){.comments-feed-thumb{width:90px;height:64px;flex-basis:90px}.comments-feed-item{gap:8px;padding:7px}}

/* Scene-linked activity cards: desktop, narrow phone and landscape. */
.comments-feed-item{align-items:stretch;min-height:94px;max-width:100%;box-sizing:border-box}
.comments-feed-thumb{align-self:flex-start;object-position:center}
.comments-feed-body{flex:1 1 auto;max-width:100%;line-height:1.3}
.comments-feed-body strong{font-size:.91rem;line-height:1.22}
.comments-feed-jump{display:inline-flex;align-self:flex-start;margin-top:2px;padding:5px 9px;border-radius:6px;background:#dbeafe;color:#1d4ed8;font-size:.82rem;font-weight:700;text-decoration:underline;text-underline-offset:2px}
.comments-feed-item:hover .comments-feed-jump,.comments-feed-item:focus-visible .comments-feed-jump{background:#bfdbfe;color:#1e40af}
@media(max-width:600px){.comments-feed-item{gap:9px;min-height:80px}.comments-feed-thumb{width:96px;height:64px;flex-basis:96px}.comments-feed-meta{font-size:.75rem}.comments-feed-body strong{font-size:.8rem}.comments-feed-text{font-size:.82rem}.comments-feed-jump{font-size:.78rem}}

.comments-feed-filters{display:flex;flex-wrap:wrap;gap:7px;margin:12px 0 8px}
.comments-feed-filter{appearance:none;border:1px solid #cbd5e1;border-radius:7px;background:#f1f5f9;color:#0f172a;padding:9px 15px;font-weight:700;cursor:pointer;touch-action:manipulation}
.comments-feed-filter.active,.comments-feed-filter[aria-pressed="true"]{background:#0f172a;color:white;border-color:#0f172a}
.comments-feed-filter:focus-visible{outline:3px solid #60a5fa;outline-offset:2px}
@media(max-width:420px){.comments-feed-filters{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.comments-feed-filter{padding:10px 4px;font-size:.86rem}}

.comments-feed-score{display:inline-block;margin-top:5px;padding:3px 8px;border-radius:5px;background:#fef3c7;color:#92400e;font-weight:800}


/* Easy touch/click play-pause directly on the video. */
.media-viewer-player.has-video-controls{position:relative}
.media-video-toggle{position:absolute;z-index:6;top:50%;left:50%;transform:translate(-50%,-50%);width:64px;height:64px;border-radius:50%;border:2px solid #fffc;background:#0f172acb;color:#fff;font-size:27px;cursor:pointer;display:grid;place-items:center;touch-action:manipulation}
.media-video-toggle.is-playing{display:none}
.media-video-toggle:focus-visible{outline:3px solid #60a5fa;outline-offset:4px}
@media(max-width:600px){.media-video-toggle{width:54px;height:54px;font-size:23px}}


/* Autoplay fallback: visible audio activation on all viewport sizes. */
.media-video-unmute{position:absolute;top:10px;right:10px;z-index:8;padding:10px 13px;border:1px solid #fff9;border-radius:8px;background:#0f172ae8;color:white;font-size:14px;font-weight:800;cursor:pointer;touch-action:manipulation}
.media-video-unmute.hidden{display:none}

/* Always-visible, touch-friendly play/pause control within the video picture. */
.media-viewer-player .media-video-toggle{top:12px;left:12px;transform:none;min-width:90px;width:auto;height:42px;padding:5px 12px;border-radius:9px;font-size:16px;font-weight:850;z-index:9;background:#0f172aef;border:2px solid #fff;color:white;display:flex;align-items:center;justify-content:center}
.media-viewer-player .media-video-toggle.is-playing{display:flex;opacity:.88}
@media(max-width:600px){.media-viewer-player .media-video-toggle{top:7px;left:7px;min-width:77px;height:38px;padding:4px 9px;font-size:14px}}
