:root,
html[data-theme="dark"] {
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --bg-hover: #293548;
    --bg-active: #1d4ed826;
    --border: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.45);
    --radius: 10px;
}

html[data-theme="light"] {
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-active: #dbeafe;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #059669;
    --warning: #d97706;
    --shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--text-muted);
}

.small {
    font-size: 0.82rem;
}

/* Buttons & Inputs */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.08s;
    color: var(--text);
    background: var(--bg-elevated);
}

.btn:hover {
    background: var(--bg-hover);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-ghost {
    background: transparent;
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 0.7rem 1.35rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.input,
select.input,
textarea.input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
    outline: none;
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.form-group {
    margin-bottom: 0.9rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Alerts */
.alert {
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

html[data-theme="light"] .alert-error {
    color: #b91c1c;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

html[data-theme="light"] .alert-success {
    color: #047857;
}

/* Auth Screen */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.auth-card {
    width: 100%;
    max-width: 410px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.auth-logo {
    font-size: 2.6rem;
    margin-bottom: 0.5rem;
}

.auth-card h1 {
    margin: 0 0 0.4rem;
    font-size: 1.4rem;
}

/* Main SPA Layout */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.85rem;
    gap: 0.85rem;
    z-index: 60;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.sidebar-close-btn {
    display: none;
    margin-left: auto;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 50;
}

.brand-icon {
    font-size: 1.45rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}

.nav-item:hover {
    background: var(--bg-hover);
}

.nav-item.active {
    background: var(--bg-active);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.drag-over {
    outline: 2px dashed var(--primary);
    background: var(--bg-active);
}

.sidebar-spacer {
    flex: 1;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quota-box {
    font-size: 0.78rem;
}

.quota-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
}

.quota-bar {
    height: 6px;
    background: var(--bg);
    border-radius: 99px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.quota-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.25s;
}

.sidebar-actions {
    display: flex;
    gap: 0.35rem;
}

.sidebar-actions .btn {
    flex: 1;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 8px;
    flex: 1;
    min-width: 0;
}

.user-info:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-meta strong {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content Area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg);
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.mobile-menu-btn {
    display: none;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    max-width: 420px;
}

.search-icon {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.45rem 0.75rem 0.45rem 2.1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.88rem;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
}

.search-kbd {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: inherit;
    pointer-events: none;
    line-height: 1;
}

.top-actions {
    display: flex;
    gap: 0.45rem;
    margin-left: auto;
    flex-shrink: 0;
}

.dropdown-wrap {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 205px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 0.35rem;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item-danger {
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

.view-mode-toggle {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.view-mode-toggle .btn.active {
    background: var(--bg-active);
    border-color: var(--primary);
    color: var(--primary);
}

/* Sub-Bar: Breadcrumbs & Bulk Toolbar */
.sub-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    border-bottom: 1px solid var(--border);
    min-height: 48px;
    flex-wrap: wrap;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.crumb {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
}

.crumb:hover,
.crumb.drag-over {
    background: var(--bg-hover);
    color: var(--text);
}

.crumb.active {
    color: var(--text);
    font-weight: 700;
}

.crumb-sep {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.bulk-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.bulk-count {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    margin-right: 0.35rem;
}

/* Upload Progress Panel */
.upload-progress-panel {
    margin: 0.75rem 1.25rem 0;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
}

.upload-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

/* File Viewport */
.file-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem 2.5rem;
}

.file-table-wrap {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.file-table th,
.file-table td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.file-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
    user-select: none;
}

.th-sort-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    position: relative;
}

.th-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.12s;
}

.th-sort-btn:hover,
.th-sort-btn.active {
    color: var(--text);
}

.th-sort-arrow {
    font-size: 0.68rem;
    color: var(--primary);
}

.th-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 0.12rem 0.42rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s;
}

.th-filter-btn:hover {
    border-color: var(--primary);
    color: var(--text);
}

.th-filter-btn.active {
    background: var(--bg-active);
    border-color: var(--primary);
    color: var(--primary);
}

.th-filter-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 195px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 0.3rem;
    z-index: 60;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}

.th-filter-menu .dropdown-item.active {
    background: var(--bg-active);
    color: var(--primary);
    font-weight: 600;
}

.file-table tbody tr {
    transition: background 0.1s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.file-table tbody tr:hover {
    background: var(--bg-hover);
}

.file-table tbody tr.selected {
    background: var(--bg-active);
}

.file-table tbody tr.drag-over {
    outline: 2px dashed var(--primary);
    background: var(--bg-active);
}

.file-table tbody tr.touch-armed,
.grid-card.touch-armed {
    outline: 2px solid var(--primary);
    background: var(--bg-active);
    transform: scale(0.985);
}

.touch-drag-ghost {
    position: fixed;
    z-index: 300;
    pointer-events: none;
    transform: translate(-50%, -115%);
    background: var(--bg-elevated);
    border: 2px solid var(--primary);
    color: var(--text);
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-table tbody tr:last-child td {
    border-bottom: none;
}

.item-cell-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-fav {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem 0.25rem;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, transform 0.15s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-fav:hover {
    color: #f59e0b;
    transform: scale(1.22);
}

.btn-fav.is-fav {
    color: #f59e0b;
}

.item-cell {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    min-width: 200px;
}

.item-thumb {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--bg);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.item-icon {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--bg);
    flex-shrink: 0;
}

.item-name-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    min-width: 0;
}

.item-name {
    font-weight: 500;
    word-break: break-word;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.12rem 0.45rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.badge-vault {
    border-color: var(--warning);
    color: var(--warning);
}

.badge-shared {
    border-color: var(--primary);
    color: var(--primary);
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
}

/* Grid View */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 0.65rem;
}

.grid-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    cursor: pointer;
    position: relative;
    transition: transform 0.12s, border-color 0.12s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.grid-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.grid-card.selected {
    background: var(--bg-active);
    border-color: var(--primary);
}

.grid-card.drag-over {
    outline: 2px dashed var(--primary);
}

.grid-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid-preview {
    height: 82px;
    border-radius: 7px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
    overflow: hidden;
}

.grid-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-title {
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Dual-Pane Split View */
.split-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: stretch;
    height: calc(100vh - 150px);
    min-height: 420px;
}

.split-pane {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.split-pane.pane-drop-target {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.split-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.split-pane-crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem;
    font-size: 0.85rem;
}

.split-pane .file-table-wrap {
    border: none;
    border-radius: 0;
    flex: 1;
    overflow-y: auto;
}

.split-pane .file-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 2;
}

@media (max-width: 960px) {
    .split-workspace {
        grid-template-columns: 1fr;
        height: auto;
    }

    .split-pane {
        height: 440px;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3.5rem 1rem;
    background: var(--bg-elevated);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* Non-blocking Drag & Drop Indicator Pill */
.drop-overlay {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    z-index: 200;
    pointer-events: none;
}

.drop-overlay-box {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    border: 2px solid var(--primary);
    border-radius: 999px;
    padding: 0.65rem 1.35rem;
    font-weight: 600;
    font-size: 0.92rem;
    background: var(--bg-elevated);
    box-shadow: var(--shadow);
    color: var(--text);
}

.drop-icon {
    font-size: 1.3rem;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-dialog {
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-dialog.modal-lg {
    max-width: 880px;
}

.modal-dialog.modal-xl {
    max-width: 1060px;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    word-break: break-all;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.code-box {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

.preview-media-wrap {
    text-align: center;
    background: var(--bg);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.preview-media-wrap img,
.preview-media-wrap video {
    max-width: 100%;
    max-height: 62vh;
    border-radius: 6px;
}

.preview-pdf-frame {
    width: 100%;
    height: 65vh;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.editor-textarea {
    width: 100%;
    min-height: 360px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.86rem;
    line-height: 1.5;
    resize: vertical;
}

/* Tabs inside Modals */
.tabs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    padding-bottom: 0.45rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.tab-btn.active {
    background: var(--bg-active);
    color: var(--primary);
}

/* Public Share View Page */
.share-page-body {
    min-height: 100vh;
    padding: 1.5rem 1rem;
}

.share-container {
    max-width: 880px;
    margin: 0 auto;
}

.share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.share-header .brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.share-file-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.25rem 1.5rem;
    text-align: center;
}

.share-file-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

.share-preview-box {
    margin: 1.25rem auto;
    max-width: 680px;
}

.share-preview-box img,
.share-preview-box video {
    max-width: 100%;
    max-height: 460px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.share-dropzone {
    background: var(--bg-elevated);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
}

.vault-share-form {
    max-width: 440px;
    margin: 1rem auto 0;
}

.item-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.item-link:hover {
    color: var(--primary);
}

.empty-cell {
    text-align: center !important;
    padding: 2rem !important;
    color: var(--text-muted);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 250;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.7rem 1rem;
    border-radius: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

/* Right-Click / Long-Touch Context Menu */
.context-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 140;
    background: transparent;
}

.context-menu {
    position: fixed;
    z-index: 150;
    min-width: 235px;
    max-width: 300px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    user-select: none;
    -webkit-user-select: none;
}

.context-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.7rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.2rem;
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--text-muted);
}

.context-menu-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.context-menu-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    margin-left: auto;
}
.context-menu-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* 3-Dots Quick Action Button */
.btn-item-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.12s, color 0.12s, transform 0.1s;
    user-select: none;
    -webkit-user-select: none;
}
.btn-item-more:hover,
.btn-item-more:focus-visible {
    background: var(--bg-hover);
    color: var(--text);
}
.btn-item-more:active {
    background: var(--bg-active);
    transform: scale(0.92);
}
.grid-card-top .btn-item-more {
    width: 24px;
    height: 24px;
    font-size: 1.15rem;
}

/* Context Menu Submenus */
.ctx-submenu-item {
    position: relative;
    width: 100%;
}
.ctx-submenu-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
}
.ctx-submenu-arrow {
    font-size: 0.72rem;
    opacity: 0.65;
    margin-left: auto;
    padding-left: 0.5rem;
    transition: transform 0.15s ease;
}
.ctx-submenu {
    display: none;
    position: absolute;
    left: calc(100% + 2px);
    top: -4px;
    min-width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 0.35rem;
    flex-direction: column;
    gap: 0.15rem;
    z-index: 170;
}
.ctx-submenu.flip-left {
    left: auto;
    right: calc(100% + 2px);
}
@media (min-width: 769px) {
    .ctx-submenu-item:hover > .ctx-submenu,
    .ctx-submenu-item.open > .ctx-submenu {
        display: flex;
    }
}
@media (max-width: 768px) {
    .ctx-submenu {
        position: static;
        box-shadow: none;
        border: none;
        border-left: 2px solid var(--primary);
        border-radius: 0;
        background: rgba(148, 163, 184, 0.06);
        margin: 0.15rem 0 0.25rem 0.6rem;
        padding: 0.25rem 0 0.25rem 0.5rem;
    }
    .ctx-submenu-item.open > .ctx-submenu {
        display: flex;
    }
    .ctx-submenu-item.open .ctx-submenu-arrow {
        transform: rotate(90deg);
    }
}

/* Search Results Location Badges */
.item-location-subline {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.15rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 4px;
    padding: 1px 5px;
    background: rgba(148, 163, 184, 0.08);
    width: fit-content;
}
.item-location-subline:hover {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.15);
}

.grid-location-subline {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-radius: 4px;
    padding: 1px 5px;
    background: rgba(148, 163, 184, 0.08);
    margin-top: 0.2rem;
    transition: all 0.15s ease;
}
.grid-location-subline:hover {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.15);
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -260px;
        transition: left 0.2s;
    }

    .sidebar.open {
        left: 0;
        box-shadow: var(--shadow);
    }

    .sidebar-close-btn {
        display: inline-flex;
    }

    .mobile-menu-btn {
        display: inline-flex;
        flex-shrink: 0;
    }

    .top-bar {
        padding: 0.55rem 0.75rem;
        gap: 0.45rem;
    }

    .hide-mobile {
        display: none !important;
    }

    .th-col-tag {
        width: 36px !important;
        text-align: center;
        padding-left: 0.2rem !important;
        padding-right: 0.2rem !important;
    }
    .cell-tag {
        width: 36px !important;
        text-align: center;
        padding-left: 0.2rem !important;
        padding-right: 0.2rem !important;
    }

    .th-col-actions,
    .cell-actions {
        width: 38px !important;
        text-align: center;
        padding-left: 0.1rem !important;
        padding-right: 0.1rem !important;
    }

    .file-table th,
    .file-table td {
        padding: 0.55rem 0.4rem;
    }

    .file-viewport {
        padding: 0.75rem 0.75rem 2.5rem;
    }

    .sub-bar {
        padding: 0.45rem 0.75rem;
    }

    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
        gap: 0.45rem;
    }

    .grid-card {
        padding: 0.4rem 0.45rem;
        gap: 0.25rem;
        border-radius: 8px;
    }

    .grid-preview {
        height: 54px;
        font-size: 1.65rem;
        border-radius: 6px;
    }

    .grid-title {
        font-size: 0.76rem;
    }

    .grid-meta {
        font-size: 0.68rem;
    }

    .context-menu-backdrop {
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(2px);
    }

    .context-menu {
        left: 0.6rem !important;
        right: 0.6rem !important;
        bottom: 0.85rem !important;
        top: auto !important;
        max-width: none !important;
        max-height: 78vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 16px;
        box-shadow: 0 -4px 28px rgba(0, 0, 0, 0.45);
        padding: 0.55rem;
    }

    .context-menu-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .context-menu .dropdown-item {
        padding: 0.65rem 0.85rem;
        font-size: 0.95rem;
        min-height: 42px;
    }

    .btn-item-more {
        width: 32px;
        height: 32px;
        font-size: 1.35rem;
        color: var(--text);
    }
}

/* Color Tags & Highlights */
.color-tag-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.color-tag-dot.color-red { background: #ef4444; }
.color-tag-dot.color-orange { background: #f97316; }
.color-tag-dot.color-yellow { background: #eab308; }
.color-tag-dot.color-green { background: #22c55e; }
.color-tag-dot.color-blue { background: #3b82f6; }
.color-tag-dot.color-purple { background: #a855f7; }

.cell-tag {
    width: 48px;
    text-align: center;
    white-space: nowrap;
}
.cell-tag .color-tag-dot {
    margin: 0 auto;
    width: 9px;
    height: 9px;
}

.color-picker-bar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.color-dot-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.12s, border-color 0.12s;
    outline: none;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--text-muted);
}
.color-dot-btn:hover {
    transform: scale(1.22);
    border-color: rgba(255, 255, 255, 0.7);
}
.color-dot-btn.btn-clear-color {
    background: transparent;
    border: 1px dashed var(--border-focus);
}

/* Item Notes & Version Badges */
.item-note-icon {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.82rem;
    margin-left: 0.35rem;
    opacity: 0.75;
    transition: opacity 0.15s, transform 0.15s;
    user-select: none;
    vertical-align: middle;
}
.item-note-icon:hover {
    opacity: 1;
    transform: scale(1.18);
}

.item-version-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.35rem;
    border-radius: 99px;
    font-size: 0.68rem;
    font-weight: 600;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--primary);
    margin-left: 0.35rem;
    cursor: pointer;
    vertical-align: middle;
}
.item-version-badge:hover {
    border-color: var(--primary);
    background: var(--bg-active);
}

/* Version Modal Styling */
.version-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    margin-bottom: 0.45rem;
    gap: 0.6rem;
}
.version-list-item.is-current {
    border-color: var(--primary);
    background: var(--bg-active);
}

/* Spotlight Quick Search (Strg+K) */
.spotlight-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 1200;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 12vh;
    animation: fadeIn 0.12s ease-out;
}
.spotlight-dialog {
    width: 100%;
    max-width: 580px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.spotlight-input-wrap {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    gap: 0.65rem;
}
.spotlight-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.05rem;
    color: var(--text);
    outline: none;
}
.spotlight-results {
    max-height: 380px;
    overflow-y: auto;
    padding: 0.4rem 0.4rem;
}
.spotlight-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s ease;
    text-decoration: none;
    color: inherit;
}
.spotlight-item:hover, .spotlight-item.active {
    background: var(--primary-light, rgba(37, 99, 235, 0.1));
}
.spotlight-item-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}
.spotlight-item-text {
    flex: 1;
    min-width: 0;
}
.spotlight-item-name {
    font-weight: 500;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.spotlight-item-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.spotlight-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.9rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Floating Audio Dock Player */
.audio-dock-player {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1050;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    padding: 0.65rem 0.85rem;
    min-width: 320px;
    max-width: 440px;
    animation: slideUp 0.18s ease-out;
}
.audio-dock-inner {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.audio-dock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.audio-dock-title {
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text);
    flex: 1;
    min-width: 0;
}
.audio-dock-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.audio-dock-counter {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.audio-dock-actions {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
}
.audio-dock-ctrl {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.audio-dock-ctrl:hover:not(:disabled) {
    color: var(--text);
    background: var(--bg-secondary);
}
.audio-dock-ctrl:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}
.audio-dock-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}
.audio-dock-close:hover {
    color: var(--text);
    background: var(--bg-secondary);
}
.audio-dock-player audio {
    width: 100%;
    height: 36px;
    outline: none;
}
@media (max-width: 640px) {
    .audio-dock-player {
        bottom: 0;
        left: 0;
        right: 0;
        max-width: none;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
    }
}

/* Duplicate Finder */
.dup-group-box {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 0.85rem;
    background: var(--bg);
    overflow: hidden;
}
.dup-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.85rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.84rem;
    font-weight: 600;
}
.dup-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.84rem;
}
.dup-item-row:last-child {
    border-bottom: none;
}

/* OCR Modal & Workspace */
.ocr-split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    min-height: 340px;
    max-height: 52vh;
}
@media (max-width: 640px) {
    .ocr-split-view {
        grid-template-columns: 1fr;
        max-height: 60vh;
    }
}
.ocr-panel {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
}
.ocr-panel-header {
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ocr-panel-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 0.5rem;
    background: var(--bg);
}
.ocr-textarea {
    width: 100%;
    height: 100%;
    min-height: 280px;
    resize: none;
    border: none;
    border-radius: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.86rem;
    line-height: 1.5;
    padding: 0.75rem;
    background: transparent;
    color: var(--text);
    outline: none;
}

/* Batch Rename */
.batch-rename-table {
    width: 100%;
    font-size: 0.82rem;
    border-collapse: collapse;
}
.batch-rename-table th, .batch-rename-table td {
    padding: 0.45rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.batch-rename-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 600;
}
.rename-arrow {
    color: var(--primary);
    font-weight: bold;
    padding: 0 0.35rem;
}
.rename-mode-nav {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

/* Image Optimizer */
.optimize-compare-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    min-height: 220px;
    max-height: 45vh;
}
@media (max-width: 600px) {
    .optimize-compare-wrap {
        grid-template-columns: 1fr;
    }
}
.optimize-preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    overflow: hidden;
}
.optimize-preview-box img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.savings-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Storage Radar */
.storage-meter {
    height: 12px;
    width: 100%;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    margin: 0.85rem 0 0.65rem;
}
.storage-segment {
    height: 100%;
    transition: width 0.3s ease;
}
.radar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    font-size: 0.8rem;
}
.radar-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.radar-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.radar-rank-badge {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
}

/* Badges for Lock & Alias */
.item-locked-badge {
    color: #ef4444;
    font-size: 0.85rem;
    margin-left: 0.35rem;
    line-height: 1;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
}
.grid-locked-corner {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    padding: 2px 4px;
    line-height: 1;
    z-index: 2;
}
.item-alias-badge {
    color: var(--primary);
    font-size: 0.8rem;
    margin-left: 0.25rem;
    font-weight: bold;
}

/* Voice Memo Recorder */
.voice-recorder-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    gap: 1rem;
}
.record-pulse-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: #ef4444;
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.record-pulse-btn.recording {
    animation: recordPulse 1.2s infinite;
}
@keyframes recordPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* PDF Signature Workspace */
.sig-canvas-wrap {
    border: 2px dashed var(--border);
    border-radius: 8px;
    background: #ffffff;
    cursor: crosshair;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}
.sig-canvas {
    width: 100%;
    height: 140px;
    touch-action: none;
}
.pdf-sign-preview-wrap {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 50vh;
}
.signature-drag-box {
    position: absolute;
    border: 2px dashed var(--primary);
    background: rgba(59, 130, 246, 0.12);
    cursor: move;
    user-select: none;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* EXIF Data Grid */
.exif-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}
.exif-table td {
    padding: 0.4rem 0.65rem;
    border-bottom: 1px solid var(--border);
}
.exif-table td:first-child {
    font-weight: 600;
    color: var(--text-muted);
    width: 35%;
}

@media (max-width: 768px) {
    .pdf-sign-layout {
        grid-template-columns: 1fr !important;
    }
}

/* Pinned Bar */
.pinned-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    margin-bottom: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    white-space: nowrap;
}
.pinned-bar-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-right: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.pinned-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.pinned-chip:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
}
.pinned-chip-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pinned-chip-remove {
    background: none;
    border: none;
    padding: 0 2px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1;
    border-radius: 50%;
}
.pinned-chip-remove:hover {
    color: #ef4444;
}

/* Folder README Box */
.folder-readme-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.folder-readme-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.84rem;
}
.folder-readme-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
}
.folder-readme-content {
    padding: 0.85rem 1.15rem;
    font-size: 0.88rem;
    line-height: 1.6;
    max-height: 350px;
    overflow-y: auto;
}
.folder-readme-content.collapsed {
    display: none;
}
.folder-readme-content h1, .folder-readme-content h2, .folder-readme-content h3 {
    margin-top: 0.6rem;
    margin-bottom: 0.35rem;
    font-weight: 700;
}
.folder-readme-content h1 { font-size: 1.25rem; }
.folder-readme-content h2 { font-size: 1.05rem; }
.folder-readme-content h3 { font-size: 0.95rem; }
.folder-readme-content ul, .folder-readme-content ol {
    padding-left: 1.4rem;
    margin-bottom: 0.5rem;
}
.folder-readme-content code {
    background: var(--bg-secondary);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.82rem;
}
.folder-readme-content pre {
    background: var(--bg-secondary);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    overflow-x: auto;
}

/* Templates Modal */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.template-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}
.template-card:hover, .template-card.active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
}
.template-card-icon {
    font-size: 1.6rem;
    margin-bottom: 0.35rem;
}
.template-card-title {
    font-size: 0.85rem;
    font-weight: 600;
}
.template-card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Bundles Grid View */
.bundles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    padding: 0.5rem 0;
}
.bundle-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}
.bundle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

/* ==========================================================================
   ZIP Inspector & Extractor UI
   ========================================================================== */
.zip-stats-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
}
.zip-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.5rem;
    background: rgba(148, 163, 184, 0.12);
    border-radius: 6px;
    font-weight: 500;
}
.zip-stat-pill strong {
    color: var(--text);
}
.zip-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.zip-search-box {
    position: relative;
    flex: 1 1 220px;
    max-width: 380px;
}
.zip-search-box input {
    width: 100%;
    padding-left: 2rem;
    font-size: 0.85rem;
    height: 34px;
}
.zip-search-box .search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.5;
    font-size: 0.85rem;
}
.zip-filter-chips {
    display: flex;
    gap: 0.35rem;
}
.zip-filter-btn {
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}
.zip-filter-btn.active, .zip-filter-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}
.zip-entries-table-wrap {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    margin-bottom: 0.85rem;
}
.zip-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.zip-table th {
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 2;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
}
.zip-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    vertical-align: middle;
}
.zip-table tr:hover td {
    background: var(--bg-hover);
}
.zip-entry-name {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    word-break: break-all;
}
.zip-entry-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
}
.zip-entry-actions .btn {
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
    line-height: 1.2;
}

/* ZIP Entry Inline Preview Drawer */
.zip-preview-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    position: relative;
    max-height: 380px;
    overflow: auto;
}
.zip-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.zip-preview-media {
    max-height: 320px;
    max-width: 100%;
    display: block;
    margin: 0 auto;
    border-radius: 6px;
    object-fit: contain;
}
.zip-preview-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.75rem;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 280px;
    overflow-y: auto;
    line-height: 1.45;
}

/* ==========================================================================
   CSV Chart Builder UI
   ========================================================================== */
.csv-chart-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.csv-chart-controls {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
}
.csv-chart-type-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.chart-type-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.chart-type-chip:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
}
.chart-type-chip.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}
.csv-chart-grid-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.65rem;
    align-items: flex-end;
}
.csv-ctrl-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.csv-chart-canvas-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    position: relative;
    min-height: 340px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.csv-chart-canvas-wrap canvas {
    max-height: 380px !important;
    width: 100% !important;
}
.csv-chart-stats-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.2rem 0.25rem;
}
.csv-data-table-toggle-wrap {
    max-height: 220px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    margin-top: 0.5rem;
}
.csv-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.csv-data-table th, .csv-data-table td {
    padding: 0.4rem 0.65rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    white-space: nowrap;
}
.csv-data-table th {
    background: var(--bg-hover);
    position: sticky;
    top: 0;
    font-weight: 600;
}

/* ==========================================================================
   Code Preview, Syntax Highlighting & Beautifier UI
   ========================================================================== */
.code-editor-header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.65rem;
    font-size: 0.82rem;
}
.code-mode-pills {
    display: inline-flex;
    background: rgba(148, 163, 184, 0.12);
    padding: 2px;
    border-radius: 6px;
    gap: 2px;
}
.code-mode-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.25rem 0.65rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.code-mode-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.code-minified-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius);
    padding: 0.5rem 0.85rem;
    margin-bottom: 0.65rem;
    font-size: 0.82rem;
    color: #f59e0b;
}
.code-preview-pane {
    max-height: 60vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #181c24;
    margin-bottom: 0.75rem;
}
.code-preview-pane pre {
    margin: 0 !important;
    padding: 1rem 1rem 1rem 3.8rem !important;
    background: transparent !important;
    font-size: 0.84rem !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    line-height: 1.5 !important;
    min-height: 140px;
}
.code-preview-pane pre.code-wrap,
.code-editor-textarea.code-wrap {
    white-space: pre-wrap !important;
    word-break: break-all !important;
}
.code-editor-textarea {
    width: 100%;
    height: 55vh;
    min-height: 250px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.84rem;
    line-height: 1.5;
    padding: 0.85rem;
    background: #181c24;
    color: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    tab-size: 4;
    resize: vertical;
    white-space: pre;
    overflow: auto;
    box-sizing: border-box;
}
.line-numbers-rows {
    border-right: 1px solid rgba(148, 163, 184, 0.2) !important;
    padding-right: 8px !important;
}
.line-numbers-rows > span:before {
    color: #64748b !important;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ==========================================================================
   Weboffice Modal & Fullscreen Viewport
   ========================================================================== */
.modal-dialog.modal-fullscreen {
    max-width: 98vw;
    width: 98vw;
    height: 94vh;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
}

.modal-dialog.modal-fullscreen .modal-body {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.office-modal-header-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
    flex-wrap: wrap;
}

.office-modal-header-tools .office-tools-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.office-modal-header-tools .office-badge {
    background: #0284c7;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.office-modal-header-tools .office-tools-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.office-modal-frame-wrap {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 520px;
    background: #1e1e1e;
    position: relative;
}

#office-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ==========================================================================
   Notifications Badge & Dropdown Menu
   ========================================================================== */
.notif-btn {
    position: relative;
    font-size: 1.05rem;
}

.notif-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 9999px;
    min-width: 16px;
    text-align: center;
    line-height: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.notif-dropdown {
    min-width: 310px;
    max-width: 360px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.84rem;
    font-weight: 600;
    background: var(--bg-card);
}

.notif-item {
    display: flex;
    flex-direction: column;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.notif-item:hover {
    background: var(--bg-card);
}

.notif-item.unread {
    background: rgba(14, 165, 233, 0.08);
    border-left: 3px solid var(--primary);
}

.notif-title {
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.notif-msg {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.notif-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.84rem;
}

/* ==========================================================================
   Image Gallery / Lightbox Navigation Overlay & Zoom
   ========================================================================== */
.preview-media-wrap {
    position: relative;
    user-select: none;
}

.preview-media-wrap.gallery-zoom-container {
    background: #000000;
    padding: 0;
    overflow: hidden;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 280px;
    max-height: 65vh;
    overflow: hidden;
    padding: 0.5rem;
}

#gallery-current-img {
    max-width: 100%;
    max-height: 62vh;
    object-fit: contain;
    border-radius: 4px;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
    cursor: zoom-in;
}

.gallery-zoom-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 20px;
    padding: 3px 6px;
    gap: 3px;
    z-index: 12;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.gallery-zoom-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    padding: 0;
}

.gallery-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.12);
}

.gallery-zoom-btn:active {
    transform: scale(0.95);
}

.gallery-zoom-label {
    color: #f1f5f9;
    font-size: 0.74rem;
    font-weight: 600;
    min-width: 38px;
    text-align: center;
    user-select: none;
    font-variant-numeric: tabular-nums;
    padding: 0 3px;
}

.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.65);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 12;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.gallery-nav-btn:hover {
    background: rgba(15, 23, 42, 0.95);
    transform: translateY(-50%) scale(1.08);
}

.gallery-prev-btn {
    left: 12px;
}

.gallery-next-btn {
    right: 12px;
}

.gallery-counter {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    z-index: 12;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Admin Audit & Protokoll Badges & Table
   ========================================================================== */
.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.audit-table th,
.audit-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.audit-table th {
    background: var(--bg-card);
    font-weight: 600;
    color: var(--text-muted);
}

.severity-pill {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.severity-pill.info {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.severity-pill.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.severity-pill.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

