:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --accent-blue: #38bdf8;
    --accent-indigo: #6366f1;
    --accent-purple: #a855f7;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    
    --blocker: #ef4444;
    --hoch: #f97316;
    --mittel: #eab308;
    --hinweis: #3b82f6;
    --nicht-pruefbar: #64748b;
    --success: #22c55e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.2rem;
    text-decoration: none;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 900;
    font-size: 1.1rem;
    -webkit-text-fill-color: initial;
    flex-shrink: 0;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.25);
}

.nav-link.active {
    color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.35);
}

.system-status {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.badge {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    flex-shrink: 0;
}

/* Hamburger Toggle Button */
.hamburger-btn {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    padding: 9px;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    z-index: 1001;
    transition: all 0.2s ease;
}

.hamburger-btn:hover {
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
}

.hamburger-bar {
    width: 20px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.open .hamburger-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.hamburger-btn.open .hamburger-bar:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.open .hamburger-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Dropdown Drawer */
.mobile-nav-drawer {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
    z-index: 999;
    flex-direction: column;
    gap: 0.75rem;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-drawer.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.mobile-nav-drawer .nav-link {
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.mobile-nav-drawer .mobile-status {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
}

/* Upload Control Bar */
.control-bar {
    margin-bottom: 2rem;
}

.dropzone {
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.05);
    transform: translateY(-2px);
}

.dropzone-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--accent-blue);
    transition: transform 0.2s ease;
}

.dropzone:hover .dropzone-icon {
    transform: scale(1.1);
}

.dropzone h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.dropzone p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.dropzone .file-types {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.type-pill {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Fira Code', monospace;
}

/* Quick Sample Toolbar */
.sample-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.sample-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.btn-sample {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: var(--accent-blue);
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sample:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

/* Loading Spinner */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(56, 189, 248, 0.15);
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-text {
    font-size: 0.95rem;
    color: var(--accent-blue);
    font-weight: 600;
}

/* Workspace Split View */
.workspace-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
    min-height: 580px;
}

@media (max-width: 900px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Inspector Left Panel */
.doc-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.info-box {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
}

.info-box .lbl {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.info-box .val {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-all;
}

.doc-viewer {
    background: #090d16;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
    flex: 1;
    overflow-y: auto;
    max-height: 420px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Audit Right Panel */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.4rem;
    text-align: center;
}

.stat-card .val {
    font-size: 1.3rem;
    font-weight: 800;
}

.stat-card .lbl {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--accent-blue);
    color: #0f172a;
    border-color: var(--accent-blue);
}

.befund-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    max-height: 380px;
    scroll-behavior: smooth;
    padding-right: 0.25rem;
}

.befund-card {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.befund-card:hover {
    border-color: var(--accent-blue);
}

.befund-card.BLOCKER { border-left: 4px solid var(--blocker); }
.befund-card.HOCH { border-left: 4px solid var(--hoch); }
.befund-card.MITTEL { border-left: 4px solid var(--mittel); }
.befund-card.HINWEIS { border-left: 4px solid var(--hinweis); }
.befund-card.NICHT_PRUEFBAR { border-left: 4px solid var(--nicht-pruefbar); }

.befund-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.befund-title {
    font-size: 0.9rem;
    font-weight: 700;
}

.sev-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
}

.sev-badge.BLOCKER { background: rgba(239, 68, 68, 0.2); color: var(--blocker); }
.sev-badge.HOCH { background: rgba(249, 115, 22, 0.2); color: var(--hoch); }
.sev-badge.MITTEL { background: rgba(234, 179, 8, 0.2); color: var(--mittel); }
.sev-badge.HINWEIS { background: rgba(59, 130, 246, 0.2); color: var(--hinweis); }
.sev-badge.NICHT_PRUEFBAR { background: rgba(100, 116, 139, 0.2); color: var(--nicht-pruefbar); }

.befund-desc {
    font-size: 0.82rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.befund-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
}

/* Sequential Streaming & Live Counter Animations */
@keyframes cardSlideIn {
    0% {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.befund-card.streaming-in {
    animation: cardSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes numberPulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.24); color: var(--accent-blue); }
    100% { transform: scale(1); }
}

.num.pulse-anim {
    animation: numberPulse 0.35s ease-out;
}

.live-progress-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
    color: var(--accent-blue);
    font-weight: 600;
    transition: all 0.3s ease;
}

.live-progress-badge.done {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.25);
    color: #4ade80;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-blue);
    box-shadow: 0 0 8px var(--accent-blue);
    animation: pulseDot 1s infinite alternate;
}

.live-progress-badge.done .live-dot {
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: none;
}

@keyframes pulseDot {
    0% { opacity: 0.4; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1.15); }
}

/* Action Export Bar */
.export-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.export-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.export-info span {
    font-size: 0.9rem;
    font-weight: 600;
}

.export-actions {
    display: flex;
    gap: 0.75rem;
}

.btn {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.65rem 1.1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    border-color: var(--accent-blue);
    background: #475569;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    color: #0f172a;
    border: none;
    font-weight: 700;
}

.btn-primary:hover {
    opacity: 0.9;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

/* ==========================================================================
   Mobile & Responsive Layout Optimizations (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
    header {
        padding: 0.75rem 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }

    .logo {
        font-size: 1.05rem;
    }

    .logo-icon {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }

    .header-nav .nav-links {
        display: none;
    }

    .system-status {
        display: none;
    }

    .hamburger-btn {
        display: flex;
    }

    .container {
        padding: 1rem 0.75rem;
    }

    .dropzone {
        padding: 1.75rem 1rem;
        border-radius: 12px;
    }

    .dropzone h3 {
        font-size: 1rem;
    }

    .dropzone p {
        font-size: 0.8rem;
    }

    .dropzone .file-types {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.35rem;
    }

    .type-pill {
        font-size: 0.68rem;
        padding: 0.2rem 0.45rem;
    }

    .sample-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .sample-label {
        text-align: center;
        font-size: 0.8rem;
    }

    .btn-sample {
        width: 100%;
        text-align: center;
        padding: 0.55rem 0.75rem;
        font-size: 0.8rem;
    }

    .workspace-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        min-height: auto;
    }

    .panel {
        padding: 1rem;
        border-radius: 12px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .doc-info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .info-box {
        padding: 0.5rem 0.65rem;
    }

    .info-box .lbl {
        font-size: 0.65rem;
    }

    .info-box .val {
        font-size: 0.85rem;
    }

    .doc-viewer {
        max-height: 260px;
        font-size: 0.75rem;
        padding: 0.75rem;
    }

    .stat-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
    }

    .stat-card {
        padding: 0.4rem 0.25rem;
    }

    .stat-card .val {
        font-size: 1.1rem;
    }

    .stat-card .lbl {
        font-size: 0.6rem;
    }

    .filter-bar {
        gap: 0.35rem;
    }

    .filter-btn {
        font-size: 0.72rem;
        padding: 0.3rem 0.55rem;
        flex: 1 1 auto;
        text-align: center;
    }

    .befund-list {
        max-height: 320px;
    }

    .befund-card {
        padding: 0.85rem;
    }

    .befund-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .befund-title {
        font-size: 0.85rem;
    }

    .befund-desc {
        font-size: 0.8rem;
    }

    .befund-meta {
        font-size: 0.72rem;
    }

    .export-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.75rem;
    }

    .export-info {
        justify-content: center;
    }

    .export-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .btn {
        width: 100%;
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
    }
}

