/* =========================
   Reset / Base
========================= */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #f4f6f9;
    --card: #ffffff;
    --border: #e5e7eb;
    --text: #1d2733;
    --muted: #6b7280;
    --danger: #c62828;
    --danger-soft: #fff1f1;
    --shadow: 0 3px 10px rgba(0, 0, 0, .08);
    --shadow-menu: 0 8px 24px rgba(0, 0, 0, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.container {
    max-width: 1360px;
    margin: 0 auto;
    padding: 20px;
}

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

.small {
    font-size: 12px;
}

.narrow {
    max-width: 520px;
    margin: 40px auto;
}

/* =========================
   Topbar / WebMachine Navigation
========================= */

.topbar {
    background: linear-gradient(135deg, #10243e, #1d3557);
    color: #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .14);
}

.topbar-inner {
    display: grid;
    grid-template-columns: 300px minmax(320px, 1fr) auto;
    align-items: center;
    gap: 28px;
    min-height: 76px;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.brand a {
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 24px;
    line-height: 1.1;
    white-space: nowrap;
}

.brand-context {
    color: #bfdbfe;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.nav-main {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.nav-main > a,
.nav-main > .nav-dropdown > .nav-dropdown-toggle {
    color: #dbeafe;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    padding: 6px 0;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    line-height: 1.3;
    transition: color .15s ease, border-color .15s ease;
}

.nav-main > a:hover,
.nav-main > .nav-dropdown > .nav-dropdown-toggle:hover {
    color: #fff;
    border-bottom-color: #93c5fd;
}

.nav-user {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.nav-user-link,
.nav-form button,
.nav-user > .nav-dropdown > .nav-dropdown-toggle {
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.35);
    background: rgba(255,255,255,.92);
    color: #1d3557;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.nav-user-link:hover,
.nav-form button:hover,
.nav-user > .nav-dropdown > .nav-dropdown-toggle:hover {
    background: #fff;
}

.nav-form {
    margin: 0;
    display: inline-flex;
}

.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.nav-dropdown-toggle {
    font-family: inherit;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid #dfe6ef;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.16);
    overflow: hidden;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}

.nav-main .nav-dropdown-menu {
    left: 0;
    right: auto;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-dropdown-menu a {
    display: block;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid #eef2f7;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.nav-dropdown-menu a:last-child {
    border-bottom: 0;
}

.nav-dropdown-menu a:hover {
    background: #eef4ff;
}

@media (max-width: 1100px) {
    .topbar-inner {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .nav-main {
        justify-content: flex-start;
        gap: 16px;
    }

    .nav-user {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 900px) {
    .nav-main,
    .nav-user {
        width: 100%;
    }

    .nav-dropdown {
        width: 100%;
        padding-bottom: 0;
    }

    .nav-dropdown-toggle,
    .nav-user-link,
    .nav-form,
    .nav-form button {
        width: 100%;
    }

    .nav-dropdown-menu,
    .nav-main .nav-dropdown-menu {
        position: static;
        width: 100%;
        min-width: 0;
        margin-top: 6px;
        transform: none;
        max-height: 0;
        overflow: hidden;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: max-height .2s ease;
    }

    .nav-dropdown:hover .nav-dropdown-menu,
    .nav-dropdown:focus-within .nav-dropdown-menu {
        max-height: 500px;
    }
}


/* =========================
   Cards / Alerts
========================= */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: var(--shadow);
    overflow: visible;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

.card.full-width {
    grid-column: 1 / -1;
    width: 100%;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin: 16px 0;
}

.alert-success {
    background: #e7f7eb;
    color: #1c6a33;
}

.alert-error {
    background: #fdeaea;
    color: #9c2020;
}
.alert input[type="text"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
}

/* =========================
   Forms / Buttons
========================= */

label {
    display: block;
    margin: 12px 0 6px;
    font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
input[type="number"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccd3db;
    border-radius: 8px;
    background: #fff;
}

.btn {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-light {
    background: #fff;
    color: #1d3557;
    border: 1px solid #d7deea;
}

.btn-light:hover {
    background: #eef4ff;
}

.btn-small {
    padding: 6px 10px;
    font-size: 13px;
}

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

.btn-danger:hover {
    background: #a61f1f;
}

/* =========================
   Layout Helpers
========================= */

.main-head,
.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.toolbar-actions,
.sidebar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-actions form {
    margin: 0;
}

.grid.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* =========================
   Explorer Layout
========================= */

.explorer-page {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}

.explorer-sidebar {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
}

.explorer-sidebar.collapsed {
    width: 70px;
    overflow: hidden;
}

.explorer-sidebar.collapsed .search-form,
.explorer-sidebar.collapsed .tree-wrap,
.explorer-sidebar.collapsed .shared-box,
.explorer-sidebar.collapsed h2 {
    display: none;
}

.explorer-main {
    overflow: visible;
}

.inline-rename-input {
    width: 100%;
    font-size: inherit;
    padding: 2px 4px;
}

/* =========================
   Search / Shared Box
========================= */

.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-form input[type="text"] {
    flex: 1;
}

.shared-box {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.shared-item {
    margin-bottom: 12px;
}

.list {
    padding-left: 18px;
}

.compact li {
    margin-bottom: 10px;
}

/* =========================
   Tree
========================= */

.tree,
.tree ul {
    list-style: none;
    margin: 0;
    padding-left: 16px;
}

.tree li {
    margin: 4px 0;
}

.tree-node {
    position: relative;
}

.tree-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    padding: 6px 10px;
    border-radius: 8px;
    max-width: calc(100% - 32px);
}

.tree-link:hover {
    background: #eef4ff;
}

.tree-link.active {
    background: var(--primary);
    color: #fff;
    font-weight: bold;
}

.tree-toggle,
.tree-spacer {
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    vertical-align: middle;
}

.tree-toggle {
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #4b5563;
    border-radius: 4px;
    padding: 0;
    font-size: 12px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.tree-toggle:hover {
    background: #eef2f7;
}

.tree-node.open > .tree-toggle {
    transform: rotate(90deg);
}

.tree-children {
    display: none;
    margin-left: 8px;
}

.tree-node.open > .tree-children {
    display: block;
}

.tree-node.open > .tree-toggle {
    transform: rotate(90deg);
}

.tree-wrap {
    max-height: 60vh;
    overflow: auto;
}

/* =========================
   Breadcrumbs
========================= */

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
}

.breadcrumbs a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    color: #9aa4b2;
}

/* =========================
   Explorer Header
========================= */

.explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    overflow: visible;
}

.explorer-header-left {
    min-width: 0;
    flex: 1;
    overflow: visible;
}

.explorer-header-right {
    flex: 0 0 auto;
}

.folder-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-bottom: 6px;
    overflow: visible;
}

.folder-title-row h1 {
    margin: 0;
    min-width: 0;
}

.explorer-subline {
    margin-top: 2px;
}

.folder-header-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    overflow: visible;
}

/* =========================
   Underfolders / Cards
========================= */

.item-main {
    flex: 1;
    min-width: 0;
}

.item-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.item-card {
    border: 1px solid #e4e9ef;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    overflow: visible;
}

.item-title {
    min-width: 0;
    margin-bottom: 8px;
}

.item-title a,
.item-title strong {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-actions {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    min-width: 60px;
    overflow: visible;
}

/* =========================
   Tables / Files
========================= */

.table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}

.table th,
.table td {
    border-bottom: 1px solid #e4e9ef;
    text-align: left;
    padding: 12px 10px;
    vertical-align: middle;
}

.table th {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    background: #f8fafc;
}

.table tr {
    transition: background 0.15s ease;
}

.table tr:hover td {
    background: #f1f5ff;
}

.table th:last-child,
.table td:last-child {
    width: 280px;
}

.table th:nth-child(1),
.table td:nth-child(1) {
    width: 34%;
}

.table th:nth-child(2),
.table td:nth-child(2) {
    width: 20%;
}

.table th:nth-child(3),
.table td:nth-child(3) {
    width: 12%;
}

.table th:nth-child(4),
.table td:nth-child(4) {
    width: 16%;
}

.table th:nth-child(5),
.table td:nth-child(5) {
    width: 18%;
}

.file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.file-icon {
    flex: 0 0 auto;
    font-size: 20px;
    line-height: 1;
}

.file-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.cell-muted {
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    width: auto;
    overflow: visible;
}

.table td {
    overflow: visible;
}

.table {
    overflow: visible;
}

/* =========================
   Action Buttons / Menus
========================= */

.action-menu-toggle {
    width: 40px;
    height: 36px;
    font-size: 18px;
    font-weight: bold;
}

.action-btn,
.action-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #d7deea;
    border-radius: 8px;
    background: #fff;
    color: #1d3557;
    text-decoration: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: all 0.15s ease;
}

.action-btn:hover,
.action-menu-toggle:hover {
    background: #eef4ff;
    border-color: #c7d2fe;
}

.action-menu {
    position: relative;
    overflow: visible;
}

.action-menu-list {
    display: none;
    position: absolute;
    right: 0;
    top: 40px;
    min-width: 240px;
    background: #fff;
    border: 1px solid #dfe6ef;
    border-radius: 10px;
    box-shadow: var(--shadow-menu);
    padding: 8px;
    z-index: 9999;
    animation: menuFade 0.15s ease;
}

.action-menu.open .action-menu-list {
    display: block;
}

.action-menu-list a,
.action-menu-list button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    background: transparent;
    text-align: left;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
}

.action-menu-list a:hover,
.action-menu-list button:hover {
    background: #f3f6fb;
}

.action-menu-list .danger {
    color: #b42318;
}

.action-menu-list form {
    margin: 0;
}

.menu-rename-form {
    padding: 6px 0;
}

.menu-rename-form input[type="text"] {
    width: 100%;
    margin-bottom: 8px;
    padding: 9px 10px;
    border: 1px solid #ccd3db;
    border-radius: 8px;
}

.menu-note {
    padding: 9px 10px;
    font-size: 13px;
    color: var(--muted);
}

@keyframes menuFade {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   Badges / Admin UI
========================= */

.table-inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.table-inline-form select {
    padding: 8px 10px;
    border: 1px solid #ccd3db;
    border-radius: 8px;
    background: #fff;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}

.status-active {
    background: #e7f7eb;
    color: #1c6a33;
}

.status-inactive {
    background: #fdeaea;
    color: #9c2020;
}

.admin-create-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    align-items: end;
}

.admin-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-edit-form,
.admin-password-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-edit-form input,
.admin-password-form input {
    min-width: 180px;
}

/*.audit-pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    max-width: 420px;
}

.audit-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

.audit-filter-grid select,
.audit-cleanup-form input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccd3db;
    border-radius: 8px;
    background: #fff;
}

.audit-filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.audit-cleanup-stack {
    display: grid;
    gap: 16px;
}

.audit-cleanup-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: end;
    margin-top: 12px;
}*/

.audit-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

.audit-filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.audit-cleanup-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.audit-cleanup-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: end;
}

.audit-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.audit-table th,
.audit-table td {
    padding: 12px 14px;
    vertical-align: top;
    text-align: left;
    border-bottom: 1px solid #d9dee7;
}

.audit-table th:nth-child(1),
.audit-table td:nth-child(1) {
    width: 160px;
}

.audit-table th:nth-child(2),
.audit-table td:nth-child(2) {
    width: 180px;
}

.audit-table th:nth-child(3),
.audit-table td:nth-child(3) {
    width: 170px;
}

.audit-table th:nth-child(4),
.audit-table td:nth-child(4) {
    width: 220px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.audit-table th:nth-child(5),
.audit-table td:nth-child(5) {
    width: 130px;
    white-space: nowrap;
}

.audit-table th:nth-child(6),
.audit-table td:nth-child(6) {
    width: auto;
}

.audit-pre {
    margin: 0;
    padding: 10px 12px;
    background: #f3f4f6;
    border: 1px solid #d8dde6;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

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

/* =========================
   Upload / Dropzone / Queue
========================= */

.progress {
    width: 100%;
    height: 12px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin: 12px 0;
}

.progress .bar {
    width: 0%;
    height: 100%;
    background: var(--primary);
}

#upload-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.upload-dropzone {
    border: 2px dashed #cbd5f5;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.upload-dropzone:hover {
    border-color: var(--primary);
    background: #eef4ff;
}

.upload-dropzone.dragover {
    border-color: var(--primary);
    background: #eef4ff;
}

.upload-queue {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.upload-item {
    border: 1px solid #e4e9ef;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
}

.upload-item-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    margin-bottom: 6px;
}

.upload-item-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-item-status {
    color: var(--muted);
    flex: 0 0 auto;
}

.upload-progress {
    height: 6px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
}

/* =========================
   Flash
========================= */

.flash-share-box {
    display: grid;
    gap: 8px;
}

.flash-share-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccd3db;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
}

.flash-share-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.flash-copy-state {
    font-size: 13px;
    color: #1c6a33;
    min-height: 18px;
}

/* =========================
   Trash
========================= */

.trash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.trash-header-left {
    flex: 1;
    min-width: 0;
}

.trash-header-right {
    flex: 0 0 auto;
}

.trash-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.trash-header-right form {
    margin: 0;
}

.trash-meta {
    margin-top: 8px;
}

.trash-list {
    display: grid;
    gap: 14px;
}

.trash-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 14px 16px;
    border: 1px solid #e4e9ef;
    border-radius: 12px;
    background: #fff;
    overflow: visible;
}

.trash-row-main {
    min-width: 0;
    flex: 1;
}

.trash-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-bottom: 6px;
}

.trash-icon {
    font-size: 20px;
    line-height: 1;
    flex: 0 0 auto;
}

.trash-name-text {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trash-meta-lines {
    display: grid;
    gap: 4px;
}

.trash-row-actions {
    flex: 0 0 auto;
    overflow: visible;
}

.inline-form {
    margin: 0;
}

/* =========================
   Toast
========================= */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: grid;
    gap: 10px;
}

.toast {
    min-width: 220px;
    max-width: 320px;
    padding: 12px 14px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    background: #1f2937;
    color: #fff;
    font-size: 14px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #166534;
}

.toast-error {
    background: #991b1b;
}

/* =========================
   Responsive
========================= */

@media (max-width: 1100px) {
    .explorer-page {
        grid-template-columns: 1fr;
    }

    .explorer-sidebar {
        position: static;
        max-height: none;
    }

    .grid.two {
        grid-template-columns: 1fr;
    }

    .item-card {
        flex-direction: column;
    }

    .item-actions {
        min-width: 100%;
    }

    .topbar-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

    @media (max-width: 1000px) {
    .admin-create-grid,
    .audit-filter-grid,
    .audit-cleanup-form {
        grid-template-columns: 1fr;
    }
}

    @media (max-width: 900px) {
    .table {
        table-layout: auto;
    }

    .table th:nth-child(2),
    .table td:nth-child(2),
    .table th:nth-child(4),
    .table td:nth-child(4) {
        display: none;
    }

    .table th:nth-child(1),
    .table td:nth-child(1) {
        width: auto;
    }

    .table th:nth-child(5),
    .table td:nth-child(5) {
        width: 120px;
    }

    .explorer-header {
        flex-direction: column;
        align-items: stretch;
    }

    .explorer-header-right {
        width: 100%;
    }

    .folder-title-row {
        flex-wrap: wrap;
    }

    .trash-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .trash-header-right {
        width: 100%;
    }

    .trash-header-actions {
        justify-content: flex-start;
    }

    .trash-row {
        flex-direction: column;
    }

    .trash-row-actions {
        width: 100%;
    }

    .upload-item-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========================
   QR-Code
========================= */

.qr-code-container img {
    display: block;
    max-width: 220px;
    padding: 10px;
    background: #fff;
    border: 1px solid #d9e0e7;
    border-radius: 12px;
}

.qr-wrap {
    display: inline-block;
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #d9e0e7;
}

.qr-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

/* =========================
   Share / Links Styling
========================= */

.flash-share-box {
    background: #eaf6ee;
    border: 1px solid #c7e7d3;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.flash-share-input {
    width: 100%;
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #cfd8e3;
    background: #fff;
    font-size: 13px;
}

.flash-share-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.flash-copy-state {
    font-size: 12px;
    color: #16a34a;
    margin-left: 6px;
}

/* =========================
   Link Cards
========================= */

.item-card input[type="text"] {
    width: 100%;
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #d9e0e7;
    font-size: 12px;
    background: #f8fafc;
}

/* =========================
   Buttons verbessern
========================= */

.btn-small {
    font-size: 12px;
    padding: 5px 10px;
}

.btn-light {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #d1d9e0;
}

.btn-light:hover {
    background: #e2e8f0;
}

/* =========================
   Tickets
========================= */

.ticket-table {
    table-layout: fixed;
    width: 100%;
}

.ticket-table th,
.ticket-table td {
    vertical-align: middle;
    white-space: nowrap;
}

.ticket-table th:nth-child(1),
.ticket-table td:nth-child(1) {
    width: 180px;
}

.ticket-table th:nth-child(2),
.ticket-table td:nth-child(2) {
    width: 30%;
}

.ticket-table th:nth-child(3),
.ticket-table td:nth-child(3) {
    width: 180px;
}

.ticket-table th:nth-child(4),
.ticket-table td:nth-child(4) {
    width: 120px;
}

.ticket-table th:nth-child(5),
.ticket-table td:nth-child(5) {
    width: 140px;
}

.ticket-table th:nth-child(6),
.ticket-table td:nth-child(6) {
    width: 180px;
}

.ticket-table th:nth-child(7),
.ticket-table td:nth-child(7) {
    width: 160px;
}

.ticket-table td:last-child {
    text-align: right;
}

.form-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
    gap:16px;
    margin-bottom:20px;
}

.ticket-preview{
    display:flex;
    align-items:center;
    min-height:44px;
    padding:10px 14px;
    border:1px solid var(--border);
    border-radius:10px;
    background:var(--panel);
    font-weight:600;
}

.form-grid label{
    margin-bottom:6px;
}

.form-grid .full-width,
form .full-width {
    grid-column: 1 / -1;
    width: 100%;
}

textarea.full-width {
    width: 100%;
    min-height: 180px;
}

/* =========================
   Muted Text
========================= */

.muted.small {
    font-size: 12px;
    color: #64748b;
}

/* =========================
   WebMachine Dashboard
========================= */

.dashboard-header {
    text-align: center;
}

.dashboard-header h1 {
    margin: 0 0 8px;
    font-size: 34px;
}

.dashboard-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.dashboard-module {
    text-decoration: none;
    color: inherit;
    transition: all .2s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-module:hover {
    transform: translateY(-3px);
}

.module-icon {
    font-size: 42px;
}

.module-title {
    font-size: 20px;
    font-weight: 700;
}

.module-description {
    color: var(--muted);
    font-size: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.stat-card {
    text-align: center;
}

.stat-value {
    font-size: 34px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

@media (max-width: 900px) {

    .dashboard-header h1 {
        font-size: 28px;
    }

    .module-icon {
        font-size: 36px;
    }

    .module-title {
        font-size: 18px;
    }

    .stat-value {
        font-size: 28px;
    }
}

/* =========================
   WebMachine Dashboard
========================= */

.dashboard-hero {
    margin-bottom: 24px;
}

.dashboard-hero h1 {
    margin: 0 0 10px;
    font-size: 32px;
}

.dashboard-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-module {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-module h2 {
    margin: 0;
}

.module-icon {
    font-size: 42px;
    line-height: 1;
}

.module-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0 12px;
}

.module-stats span {
    color: var(--muted);
}

.module-stats strong {
    color: var(--text);
    font-size: 18px;
}

.grid.two {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-module .btn {
    margin-top: auto;
}

@media (max-width: 768px) {

    .dashboard-hero h1 {
        font-size: 26px;
    }

    .grid.two {
        grid-template-columns: 1fr;
    }
}

/* =========================
   Settings
========================= */

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

/* =========================
   WebWiki Content
========================= */

.wiki-content {
    line-height: 1.7;
}

.wiki-content p {
    line-height: 1.65;
}

.wiki-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.wiki-content th,
.wiki-content td {
    border: 1px solid #dbe3ef;
    padding: 8px 10px;
}

.wiki-content blockquote {
    margin: 14px 0;
    padding: 10px 14px;
    border-left: 4px solid #cbd5e1;
    background: #f8fafc;
}

.wiki-content pre {
    white-space: pre-wrap;
    overflow: auto;
    padding: 14px;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
}

.wiki-content code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #f1f5f9;
}

.wiki-content pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.wiki-content img {
    max-width: 100%;
    height: auto;
}

.markdown-preview {
    min-height: 180px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    padding: 16px;
    background: #fff;
}

/* =========================
   WebWiki Editor - Final
========================= */

.wiki-page-form {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(220px, 1fr)) !important;
    gap: 20px !important;
    align-items: start !important;
    width: 100% !important;
}

.wiki-page-form > div {
    min-width: 0 !important;
}

.wiki-editor-full {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-width: 0 !important;
}

.wiki-editor-shell {
    width: 100% !important;
    display: block !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 14px !important;
    overflow: visible !important;
    background: #fff !important;
}

.wiki-editor-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 12px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    overflow: visible !important;
    white-space: normal !important;
}

.wiki-editor-toolbar button,
.wiki-docx-import {
    border: 1px solid #cbd5e1 !important;
    background: #fff !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font: inherit !important;
    cursor: pointer !important;
    color: #0f172a !important;
    line-height: 1.2 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 38px !important;
    width: auto !important;
    flex: 0 0 auto !important;
}

.wiki-editor-toolbar button:hover,
.wiki-docx-import:hover {
    background: #eef2ff !important;
    border-color: #2563eb !important;
}

.wiki-editor-separator {
    width: 1px !important;
    min-width: 1px !important;
    height: 28px !important;
    background: #cbd5e1 !important;
    margin: 2px 4px !important;
}

.wiki-docx-import input {
    display: none !important;
}

.wiki-editor {
    width: 100% !important;
    min-height: 700px !important;
    display: block !important;
    padding: 30px !important;
    line-height: 1.7 !important;
    outline: none !important;
    background: #fff !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
    overflow: auto !important;
}

.wiki-editor:focus {
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .18) !important;
}

.wiki-editor-actions {
    grid-column: 1 / -1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    margin-top: 6px !important;
    width: 100% !important;
}

.wiki-editor-actions .wiki-docx-import,
.wiki-editor-actions #discard_import {
    min-width: 170px !important;
}

.wiki-editor table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 16px 0 !important;
}

.wiki-editor td,
.wiki-editor th {
    border: 1px solid #cbd5e1 !important;
    padding: 8px 10px !important;
}

@media (max-width: 900px) {
    .wiki-page-form {
        grid-template-columns: 1fr !important;
    }

    .wiki-editor {
        min-height: 520px !important;
        padding: 20px !important;
    }

    .wiki-editor-actions {
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
    }
}

/* WebWiki Wide Editor Layout */

.wiki-page-form-wide {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
    align-items: start !important;
    width: 100% !important;
}

.wiki-page-form-wide .wiki-title-full,
.wiki-page-form-wide .wiki-editor-full,
.wiki-page-form-wide .wiki-editor-actions {
    grid-column: 1 / -1 !important;
    width: 100% !important;
}

.wiki-page-form-wide .wiki-editor-shell {
    width: 100% !important;
    max-width: none !important;
}

.wiki-page-form-wide .wiki-editor-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    overflow: visible !important;
    white-space: normal !important;
}

.wiki-page-form-wide .wiki-editor {
    width: 100% !important;
    min-height: 720px !important;
}

.wiki-page-form-wide .wiki-editor-actions {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 12px !important;
}

@media (max-width: 900px) {
    .wiki-page-form-wide {
        grid-template-columns: 1fr !important;
    }

    .wiki-page-form-wide .wiki-editor {
        min-height: 520px !important;
    }

    .wiki-page-form-wide .wiki-editor-actions {
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
    }
}



/* =========================
   WM-002.015.002 Explorer selection
========================= */
.wm-selectable-row {
    cursor: default;
    transition: background-color 120ms ease, box-shadow 120ms ease;
}

.wm-selectable-row > td {
    transition: background-color 120ms ease;
}

.wm-selectable-row.wm-is-selected > td {
    background: rgba(37, 99, 235, 0.12) !important;
}

.wm-selectable-row.wm-is-selected > td:first-child {
    box-shadow: inset 3px 0 0 #2563eb;
}

.wm-selectable-row.wm-is-selected:hover > td {
    background: rgba(37, 99, 235, 0.17) !important;
}

/* =========================
   WM-002.015.003 Selection toolbar
========================= */
.wm-selection-toolbar {
    position: sticky;
    top: 12px;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #b9c8dd;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 8px 24px rgba(26, 44, 70, 0.14);
    backdrop-filter: blur(8px);
}

.wm-selection-toolbar[hidden] {
    display: none !important;
}

.wm-selection-summary {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.wm-selection-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.wm-selection-actions .btn[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-danger {
    border-color: #c73737;
    background: #c73737;
    color: #fff;
}

@media (max-width: 900px) {
    .wm-selection-toolbar {
        position: static;
        align-items: stretch;
        flex-direction: column;
    }

    .wm-selection-summary,
    .wm-selection-actions {
        justify-content: flex-start;
    }
}

/* =========================
   WM-002.015.004 Version footer
========================= */
.app-footer {
    margin-top: 32px;
    border-top: 1px solid #dbe3ee;
    background: #f7f9fc;
    color: #68758a;
    font-size: 0.82rem;
}

.app-footer-inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.app-footer-separator {
    color: #9aa6b7;
}

.app-footer-channel {
    font-weight: 600;
}

@media (max-width: 640px) {
    .app-footer-inner {
        justify-content: center;
        flex-wrap: wrap;
        text-align: center;
    }
}

/* WM-002.015.005 batch selection actions */
.wm-selection-dialog {
    width: min(520px, calc(100vw - 32px));
    border: 0;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
}

.wm-selection-dialog::backdrop {
    background: rgba(15, 23, 42, .55);
}

.wm-selection-dialog form {
    display: grid;
    gap: 16px;
    padding: 20px;
}

.wm-selection-dialog-head,
.wm-selection-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wm-selection-dialog-head h3 {
    margin: 0;
}

.wm-selection-dialog-actions {
    justify-content: flex-end;
    margin-top: 4px;
}

/* =========================
   WM-002.016.001 Drag & Drop move
========================= */
.wm-selectable-row[draggable="true"] {
    cursor: grab;
}

.wm-selectable-row[draggable="true"]:active {
    cursor: grabbing;
}

.wm-selectable-row.wm-is-dragging {
    opacity: 0.48;
}

.wm-drop-target {
    transition: background-color 120ms ease, box-shadow 120ms ease, outline-color 120ms ease;
}

.wm-drag-active .wm-drop-target {
    outline: 1px dashed rgba(37, 99, 235, 0.32);
    outline-offset: -2px;
}

.wm-drop-target.wm-is-drop-target,
.wm-drop-target.wm-is-drop-target > td {
    background: rgba(22, 163, 74, 0.14) !important;
}

.wm-drop-target.wm-is-drop-target {
    box-shadow: inset 0 0 0 2px #16a34a;
    outline: none;
}

.tree-link.wm-is-drop-target {
    border-radius: 7px;
    color: #166534;
}

.folder-title-row.wm-is-drop-target {
    border-radius: 9px;
    padding: 6px 8px;
}

/* =========================
   WM-002.017.002 Office preview
========================= */
.office-preview-page {
    min-width: 0;
}

.office-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.office-preview-header h1 {
    margin: 0.15rem 0 0;
    overflow-wrap: anywhere;
}

.office-preview-header p {
    margin: 0;
}

.office-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.office-preview-notice {
    margin-bottom: 1.25rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color, #d9dee7);
    border-radius: 8px;
    background: var(--surface-muted, #f7f8fa);
    font-size: 0.9rem;
}

.office-document-preview {
    max-width: 920px;
    min-height: 700px;
    margin: 0 auto;
    padding: clamp(1.25rem, 4vw, 4rem);
    border: 1px solid var(--border-color, #d9dee7);
    background: #fff;
    color: #1f2937;
    box-shadow: 0 10px 30px rgba(20, 30, 50, 0.08);
    line-height: 1.6;
}

.office-document-preview h1,
.office-document-preview h2,
.office-document-preview h3,
.office-document-preview h4 {
    color: #111827;
}

.office-table-wrap {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--border-color, #d9dee7);
    border-radius: 8px;
    background: #fff;
}

.office-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    color: #1f2937;
    background: #fff;
}

.office-table th,
.office-table td {
    min-width: 90px;
    max-width: 420px;
    padding: 0.5rem 0.65rem;
    border: 1px solid #dfe3e8;
    text-align: left;
    vertical-align: top;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.office-table th {
    background: #f3f4f6;
    font-weight: 600;
}

.office-row-number {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 48px !important;
    width: 48px;
    text-align: right !important;
}

.office-sheet-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.office-sheet-tab {
    border: 1px solid var(--border-color, #d9dee7);
    border-radius: 7px 7px 0 0;
    background: var(--surface-muted, #f7f8fa);
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}

.office-sheet-tab.active {
    background: var(--primary, #2563eb);
    border-color: var(--primary, #2563eb);
    color: #fff;
}

.office-sheet-panel h2 {
    margin-top: 0;
}

.office-slides-preview {
    display: grid;
    gap: 1.25rem;
}

.office-slide {
    position: relative;
    aspect-ratio: 16 / 9;
    min-height: 300px;
    overflow: auto;
    border: 1px solid var(--border-color, #d9dee7);
    border-radius: 10px;
    background: #fff;
    color: #111827;
    box-shadow: 0 8px 24px rgba(20, 30, 50, 0.08);
}

.office-slide-number {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0.35rem 0.65rem;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    color: #4b5563;
    font-size: 0.82rem;
}

.office-slide-content {
    display: flex;
    min-height: calc(100% - 34px);
    flex-direction: column;
    justify-content: center;
    padding: clamp(1.5rem, 5vw, 4rem);
}

.office-slide-content h2 {
    margin-top: 0;
    font-size: clamp(1.5rem, 3vw, 2.6rem);
    color: #111827;
}

.office-slide-content p {
    font-size: clamp(1rem, 1.6vw, 1.35rem);
}

.office-preview-limit {
    margin-top: 1rem;
    padding: 0.65rem 0.8rem;
    border-left: 4px solid #d97706;
    background: #fffbeb;
    color: #78350f;
}

@media (max-width: 760px) {
    .office-preview-header {
        flex-direction: column;
    }

    .office-preview-actions {
        justify-content: flex-start;
    }

    .office-document-preview {
        min-height: 0;
        padding: 1rem;
    }

    .office-slide {
        aspect-ratio: auto;
        min-height: 360px;
    }
}

/* WM-002.017.003: Medien- und Archivvorschau */
.rich-preview-page {
    min-width: 0;
}

.rich-preview-notice {
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border-left: 4px solid var(--primary, #2563eb);
    background: #eff6ff;
    color: #1e3a8a;
}

.media-preview-stage {
    display: flex;
    min-height: 340px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: clamp(1rem, 4vw, 3rem);
    border-radius: 12px;
    background: #111827;
}

.media-preview-player {
    width: min(100%, 960px);
}

.media-preview-video {
    max-height: 72vh;
    border-radius: 8px;
    background: #000;
}

.media-preview-audio-icon {
    display: grid;
    width: 120px;
    height: 120px;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    font-size: 3.4rem;
}

.archive-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.archive-summary-grid > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.9rem;
    border: 1px solid var(--border-color, #d9dee7);
    border-radius: 9px;
    background: var(--surface-muted, #f7f8fa);
}

.archive-summary-grid strong {
    overflow: hidden;
    font-size: 1.2rem;
    text-overflow: ellipsis;
}

.archive-summary-grid span {
    color: var(--muted, #6b7280);
    font-size: 0.85rem;
}

.archive-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
}

.archive-toolbar label {
    width: min(100%, 460px);
}

.archive-toolbar .input {
    width: 100%;
}

.archive-table-wrap {
    max-height: 65vh;
    overflow: auto;
    border: 1px solid var(--border-color, #d9dee7);
    border-radius: 9px;
}

.archive-table {
    margin: 0;
}

.archive-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-muted, #f7f8fa);
}

.archive-entry-icon {
    display: inline-block;
    width: 1.5rem;
}

@media (max-width: 760px) {
    .archive-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .archive-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .media-preview-stage {
        min-height: 260px;
        padding: 1rem;
    }
}

/* =========================
   WM-002.019.000 Search
========================= */
.search-page { display: grid; gap: 1rem; }
.search-hero { display: grid; gap: .9rem; }
.search-hero h1 { margin: 0; }
.global-search-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: .65rem; }
.global-search-form input[type="search"] { width: 100%; min-height: 44px; padding: .7rem .85rem; border: 1px solid var(--border-color, #d9dee7); border-radius: 8px; font: inherit; }
.search-status { min-height: 1.3rem; }
.search-result-card { padding: 0; overflow: hidden; }
.search-result-card h2 { margin: 0; padding: 1rem 1.1rem; border-bottom: 1px solid var(--border-color, #d9dee7); }
.search-result-list { display: grid; }
.search-result-item { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto auto; align-items: center; gap: .8rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border-color, #e5e7eb); color: inherit; text-decoration: none; }
.search-result-item:last-child { border-bottom: 0; }
.search-result-item:hover { background: var(--surface-muted, #f7f8fa); }
.search-result-icon { font-size: 1.35rem; }
.search-result-main, .search-result-item > span:nth-child(2) { min-width: 0; color: inherit; text-decoration: none; }
.search-result-item strong, .search-result-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-item small { margin-top: .2rem; color: var(--muted, #6b7280); }
.search-result-meta { color: var(--muted, #6b7280); white-space: nowrap; }
.badge { display: inline-block; min-width: 1.7rem; margin-left: .35rem; padding: .15rem .45rem; border-radius: 999px; background: var(--surface-muted, #eef2f7); font-size: .78rem; text-align: center; }
@media (max-width: 760px) {
    .global-search-form { grid-template-columns: 1fr 1fr; }
    .global-search-form input { grid-column: 1 / -1; }
    .search-result-item { grid-template-columns: 2rem minmax(0, 1fr) auto; }
    .search-result-meta { grid-column: 2; }
}

/* WM-002.021.000 - Papierkorb 2.0 */
.trash-stat-grid{display:flex;gap:12px;flex-wrap:wrap;margin-top:14px}.trash-stat-grid>div{min-width:110px;padding:10px 14px;border:1px solid #e4e9ef;border-radius:10px;background:#f8fafc}.trash-stat-grid strong,.trash-stat-grid span{display:block}.trash-stat-grid span{font-size:12px;color:#667085;margin-top:2px}.trash-filter-form{display:grid;grid-template-columns:minmax(240px,1fr) minmax(190px,260px) auto auto;gap:12px;align-items:end}.trash-filter-form label,.trash-batch-bar label{display:grid;gap:6px}.trash-section-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:16px}.trash-select-all{display:flex;align-items:center;gap:8px;white-space:nowrap}.trash-selectable-row{cursor:pointer;align-items:center}.trash-selectable-row>input{width:18px;height:18px;flex:0 0 auto}.trash-selectable-row:has(input:checked){border-color:#4f7cff;background:#f3f6ff}.trash-batch-bar{position:sticky;bottom:12px;z-index:20;display:flex;justify-content:space-between;align-items:end;gap:16px;margin-top:18px;padding:14px 16px;border:1px solid #d7deea;border-radius:12px;background:rgba(255,255,255,.96);box-shadow:0 8px 24px rgba(16,24,40,.12);backdrop-filter:blur(8px)}.trash-batch-bar label{min-width:min(420px,100%)}.trash-batch-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}.trash-row-actions{display:flex;gap:8px;flex-wrap:wrap}.trash-row-actions form{margin:0}@media(max-width:850px){.trash-filter-form{grid-template-columns:1fr}.trash-section-heading,.trash-batch-bar{align-items:stretch;flex-direction:column}.trash-batch-actions{justify-content:stretch}.trash-batch-actions .btn{width:100%}}

/* WM-003.002 Notification Center */
.notification-nav-link { position: relative; display: inline-flex; align-items: center; gap: .35rem; }
.notification-badge { display: inline-flex; min-width: 1.25rem; height: 1.25rem; padding: 0 .3rem; align-items: center; justify-content: center; border-radius: 999px; background: #b42318; color: #fff; font-size: .72rem; font-weight: 700; }
.notification-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.notification-list { padding: 0; overflow: hidden; }
.notification-item { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.15rem; border-bottom: 1px solid rgba(0,0,0,.08); }
.notification-item:last-child { border-bottom: 0; }
.notification-item.is-unread { background: rgba(45,108,223,.07); }
.notification-dot { width: .65rem; height: .65rem; border-radius: 50%; background: #9ca3af; flex: 0 0 auto; }
.notification-item.is-unread .notification-dot { background: #2d6cdf; }
.notification-content { flex: 1 1 auto; min-width: 0; }
.notification-content p { margin: .25rem 0; }
.notification-content small { color: #6b7280; }
@media (max-width: 720px) { .notification-header, .notification-item { align-items: flex-start; } .notification-header { flex-direction: column; } }

/* WM-003.003 Global Search */
.global-search-form select { min-width: 12rem; }
.search-result-description { display:block; margin-top:.35rem; color:var(--muted,#6b7280); font-size:.9rem; white-space:normal; }
@media (max-width:760px){.global-search-form select{width:100%;}.search-result-description{display:none;}}

/* WebMachine 3.0.004 - Platform Dashboard */
.platform-dashboard-hero{display:flex;align-items:center;justify-content:space-between;gap:24px}.dashboard-search{display:flex;gap:10px;min-width:min(480px,100%)}.dashboard-search input{flex:1;min-width:220px}.dashboard-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:16px;margin:0 0 24px}.dashboard-kpi{display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;gap:2px 12px;text-decoration:none;color:inherit;align-items:center}.dashboard-kpi>span{grid-row:1/3;font-size:30px}.dashboard-kpi strong{font-size:24px;line-height:1.1}.dashboard-kpi small{color:var(--muted)}.dashboard-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin-bottom:24px}.dashboard-widget{min-width:0}.dashboard-widget-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:14px}.dashboard-widget-head h2{margin:0 0 4px}.dashboard-widget-head a{font-weight:700;text-decoration:none;white-space:nowrap}.dashboard-list{display:grid;gap:8px}.dashboard-list-item{display:flex;gap:12px;align-items:flex-start;padding:11px;border:1px solid var(--border);border-radius:10px;text-decoration:none;color:inherit;background:var(--surface)}.dashboard-list-item:hover{border-color:var(--primary);transform:translateY(-1px)}.dashboard-list-item.is-unread{background:rgba(37,99,235,.06);border-color:rgba(37,99,235,.25)}.dashboard-list-icon{font-size:20px;line-height:1.2}.dashboard-list-content{display:grid;gap:3px;min-width:0}.dashboard-list-content strong,.dashboard-list-content small{overflow:hidden;text-overflow:ellipsis}.dashboard-list-content small{color:var(--muted);white-space:normal}.dashboard-quick-actions{margin-bottom:24px}.dashboard-activity{margin-bottom:24px}@media(max-width:900px){.platform-dashboard-hero{align-items:stretch;flex-direction:column}.dashboard-search{min-width:0}.dashboard-grid{grid-template-columns:1fr}}@media(max-width:560px){.dashboard-search{flex-direction:column}.dashboard-search input{min-width:0}.dashboard-widget-head{flex-direction:column;gap:6px}}

/* WM-003.013 Notification Center */
.notification-filter{display:grid;grid-template-columns:minmax(240px,1fr) minmax(160px,220px) auto auto;gap:12px;align-items:end;margin-bottom:16px}.notification-filter label{display:grid;gap:6px}.notification-filter input,.notification-filter select{width:100%}.notification-bulk-form{display:grid;gap:18px}.notification-bulk-bar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 16px;position:sticky;top:8px;z-index:5}.notification-select-all{display:flex;align-items:center;gap:8px}.notification-bulk-actions{display:flex;gap:10px;flex-wrap:wrap}.notification-group{display:grid;gap:8px}.notification-group h2{margin:0;font-size:1rem}.notification-checkbox{width:18px;height:18px;flex:0 0 auto}.notification-empty{padding:24px}.notification-item:has(.notification-checkbox:checked){outline:2px solid rgba(45,108,223,.35);outline-offset:-2px}@media(max-width:760px){.notification-filter{grid-template-columns:1fr}.notification-bulk-bar{align-items:stretch;flex-direction:column;position:static}.notification-bulk-actions{width:100%}.notification-bulk-actions .btn{flex:1}.notification-item{flex-wrap:wrap}.notification-content{flex-basis:calc(100% - 70px)}}

/* WebMachine 4.0 RC1 B2 - Explorer command bar, paging and grid mode */
.explorer-commandbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.explorer-commandbar-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1 1 auto;
    min-width: 0;
}

.explorer-result-summary {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    white-space: nowrap;
}

.explorer-sort-form {
    display: flex;
    align-items: end;
    gap: .75rem;
    flex-wrap: wrap;
}

.explorer-sort-form label {
    display: grid;
    gap: .25rem;
    margin: 0;
}

.explorer-sort-form label > span {
    font-size: .78rem;
    color: var(--muted, #687386);
}

.explorer-sort-form select {
    min-width: 8.5rem;
}

.explorer-view-switch {
    display: flex;
    gap: .4rem;
    flex: 0 0 auto;
}

.explorer-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.explorer-pagination .disabled {
    pointer-events: none;
    opacity: .45;
}

.explorer-items-grid table,
.explorer-items-grid thead,
.explorer-items-grid tbody,
.explorer-items-grid tr,
.explorer-items-grid td {
    display: block;
}

.explorer-items-grid thead {
    display: none;
}

.explorer-items-grid tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: .85rem;
}

.explorer-items-grid .table {
    border: 0;
    background: transparent;
}

.explorer-items-grid .wm-selectable-row {
    position: relative;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid var(--border, #dfe4ea);
    border-radius: .75rem;
    background: var(--surface, #fff);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.explorer-items-grid .wm-selectable-row:hover {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

.explorer-items-grid .wm-selectable-row > td {
    padding: .2rem 0;
    border: 0;
}

.explorer-items-grid .wm-selectable-row > td:first-child {
    padding-bottom: .75rem;
    font-weight: 600;
    word-break: break-word;
}

.explorer-items-grid .file-icon,
.explorer-items-grid .folder-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.explorer-items-grid .table-actions {
    position: absolute;
    right: .7rem;
    bottom: .7rem;
    width: auto;
}

@media (max-width: 900px) {
    .explorer-commandbar,
    .explorer-commandbar-main {
        align-items: stretch;
        flex-direction: column;
    }

    .explorer-view-switch {
        align-self: flex-end;
    }
}

/* WebMachine 4 RC1 B6: Preview and advanced WebDrive search */
.drive-search-filter{margin-bottom:1rem}.drive-search-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem}.drive-search-grid label{display:flex;flex-direction:column;gap:.35rem;font-weight:600}.drive-search-check{justify-content:flex-end;flex-direction:row!important;align-items:center}.drive-search-results{display:flex;flex-direction:column}.drive-search-summary{display:flex;justify-content:space-between;gap:1rem;margin-bottom:.75rem}.drive-search-item{display:grid;grid-template-columns:64px minmax(0,1fr) 120px 42px;align-items:center;gap:.8rem;padding:.65rem 0;border-bottom:1px solid var(--border-color,#e3e7eb)}.drive-search-item:last-child{border-bottom:0}.drive-search-thumb{width:56px;height:48px;display:flex;align-items:center;justify-content:center;font-size:1.8rem;overflow:hidden;border-radius:.4rem;background:#f3f5f7}.drive-search-thumb img{width:100%;height:100%;object-fit:cover}.drive-search-main{display:flex;min-width:0;flex-direction:column;gap:.2rem;text-decoration:none}.drive-search-main strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.drive-search-main small{color:var(--muted-color,#6b7280)}.drive-search-size{text-align:right}.text-preview-card{overflow:auto;padding:0}.text-preview-card pre{margin:0;padding:1rem;min-height:20rem;tab-size:4;line-height:1.5;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;font-size:.9rem;white-space:pre;counter-reset:line}.text-preview-card code{display:block}.text-preview-page .alert{margin-bottom:1rem}@media(max-width:1000px){.drive-search-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:650px){.drive-search-grid{grid-template-columns:1fr}.drive-search-item{grid-template-columns:52px minmax(0,1fr) 38px}.drive-search-size{display:none}}
