/* WT DataRoom — charte Water Technology + interface Drive */
/* Sofia Pro : ajouter les .woff2 dans public/assets/fonts/sofia-pro/ puis @import url('sofia-pro.css'); */

:root, [data-theme="light"] {
    --wt-navy: #1e3058;
    --wt-navy-deep: #0b1320;
    --wt-aqua: #09a8dc;
    --wt-aqua-hover: #0797c8;
    --wt-aqua-light: #e6f7fb;
    --wt-aqua-deep: #0b4e63;

    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e6ecf3;
    --border-strong: #d1dae5;

    --text: #0b1320;
    --text-muted: #5b6677;
    --text-subtle: #8a95a7;

    --accent: var(--wt-aqua);
    --accent-hover: var(--wt-aqua-hover);
    --danger: #b23a48;
    --success: #1e8a6b;

    --gradient-brand: linear-gradient(135deg, #1e3058 0%, #0b4e63 55%, #09a8dc 100%);

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-bold: 700;
    --fw-light: 200;
    --tracking-eyebrow: 0.12em;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(11, 19, 32, 0.07);
    --shadow-lg: 0 12px 40px rgba(11, 19, 32, 0.12);
    --shadow-focus: 0 0 0 3px rgba(9, 168, 220, 0.22);

    --sidebar-w: 268px;
    --header-h: 56px;
    --upload-bar-h: 48px;
}

[data-theme="dark"] {
    --bg: #0b1320;
    --surface: #141c2b;
    --border: #1e2a3d;
    --border-strong: #2a384f;

    --text: #e8edf4;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;

    --wt-aqua-light: rgba(9, 168, 220, 0.12);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: var(--font);
    font-weight: var(--fw-regular);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; }

.hidden { display: none !important; }

/* ── Auth ── */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: var(--gradient-brand);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 100%, rgba(9, 168, 220, 0.25) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.auth-card {
    position: relative;
    z-index: 1;
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.auth-brand {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: 1.75rem;
    width: 100%;
    max-width: 420px;
}

.auth-brand img {
    max-width: min(300px, 85vw);
    height: auto;
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.15));
}

.auth-brand .product-name {
    font-size: 1.125rem;
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #fff;
}

.auth-brand .product-tagline {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    font-weight: var(--fw-light);
    text-transform: uppercase;
    letter-spacing: var(--tracking-eyebrow);
    color: rgba(255, 255, 255, 0.65);
}

.auth-card h2 {
    font-size: 1rem;
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 1.5rem;
}

.auth-error {
    margin: -0.5rem 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm, 6px);
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
    font-size: 0.875rem;
    line-height: 1.4;
}

.auth-card label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    font-weight: var(--fw-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.auth-card input {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}

.auth-card button[type="submit"] {
    width: 100%;
    padding: 0.8rem;
    margin-top: 0.5rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: background 0.15s;
}

.auth-card button[type="submit"]:hover { background: var(--accent-hover); }

.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.72rem; color: var(--text-subtle); }
.auth-footer a { color: var(--accent); text-decoration: none; }

/* ── Drive layout ── */
.drive-app {
    display: flex;
    height: 100dvh;
    min-height: 100vh;
    overflow: hidden;
}

.drive-sidebar {
    width: var(--sidebar-w);
    height: 100dvh;
    background: var(--wt-navy);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 50;
    overflow: hidden;
}

.sidebar-brand {
    padding: 1.25rem 1rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand img { max-width: 100%; max-height: 48px; object-fit: contain; }

.sidebar-brand .product-tag {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.62rem;
    font-weight: var(--fw-light);
    text-transform: uppercase;
    letter-spacing: var(--tracking-eyebrow);
    color: rgba(255, 255, 255, 0.4);
}

.workspace-select {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.45rem 0.5rem;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.preview-comments { display: flex; flex-direction: column; height: 100%; padding: 1rem; }
.preview-comments-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.preview-comments-list { flex: 1; overflow-y: auto; margin-bottom: 1rem; }
.comment-item { padding: 0.75rem 0; border-bottom: 1px solid var(--border-subtle, #eee); }
.comment-item .comment-date { font-size: 0.75rem; color: var(--text-muted, #888); margin-left: 0.5rem; }
.comment-form textarea { width: 100%; margin-bottom: 0.5rem; resize: vertical; }

.tag-filter-bar { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.5rem 1rem 0; min-height: 0; }
.tag-filter-bar:empty { display: none; }
.tag-chip {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle, #ddd);
    background: var(--surface-2, #f4f4f5);
    cursor: pointer;
    white-space: nowrap;
}
.tag-chip.active { background: var(--wt-aqua, #2563eb); color: #fff; border-color: transparent; }
.tag-filter-clear {
    margin: 0 1rem 0.5rem;
    font-size: 0.75rem;
    background: none;
    border: none;
    color: var(--wt-aqua, #2563eb);
    cursor: pointer;
}
.tag-filter-clear.hidden { display: none; }
.file-tags { display: block; margin-top: 0.25rem; }
.file-tags .tag-chip { cursor: default; margin-right: 0.2rem; }

.sidebar-actions { padding: 1rem; }

.btn-new {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--wt-aqua);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: var(--fw-medium);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(9, 168, 220, 0.35);
    transition: background 0.15s, transform 0.1s;
}

.btn-new:hover { background: var(--wt-aqua-hover); }
.btn-new:active { transform: scale(0.98); }

.new-menu-wrap { position: relative; }

.new-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 60;
}

.new-dropdown button {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
}

.new-dropdown button:hover { background: var(--wt-aqua-light); }

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    padding: 0.25rem 0.75rem 0.5rem;
    flex-shrink: 0;
}

.sidebar-nav-group {
    margin-bottom: 0.35rem;
}

.sidebar-nav-label {
    display: block;
    padding: 0.65rem 0.85rem 0.35rem;
    font-size: 0.65rem;
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.35);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-tree {
    flex: 1;
    min-height: 80px;
    overflow-y: auto;
    padding: 0.25rem 0 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 0.25rem;
}

.sidebar-tree-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.sidebar-tree-label {
    padding: 0.65rem 1rem 0.35rem;
    font-size: 0.65rem;
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
}

.tree-node {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tree-toggle {
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tree-toggle.invisible { visibility: hidden; }

.tree-label {
    flex: 1;
    padding: 0.35rem 0.5rem;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-label:hover, .tree-label.active {
    background: rgba(9, 168, 220, 0.15);
    color: #fff;
}

.tree-add {
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.12s, color 0.12s, background 0.12s;
}

.tree-node:hover .tree-add,
.tree-add:focus-visible {
    opacity: 1;
}

.tree-add:hover {
    color: #fff;
    background: rgba(9, 168, 220, 0.25);
}

.tree-empty, .tree-loading {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
}

.sidebar-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-install-pwa {
    flex: 1 1 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.8rem;
    font-weight: var(--fw-medium);
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.btn-install-pwa:hover {
    background: rgba(255, 255, 255, 0.12);
}

.user-chip {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

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

.user-name {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
}

.btn-icon:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.sidebar-btn { flex-shrink: 0; }

/* App shell */
.app-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100dvh;
    overflow: hidden;
}

.app-workspace {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}

.app-workspace .drop-overlay {
    position: absolute;
    inset: 0;
    margin: 0;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--header-h);
    padding: 0 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 40;
}

.topbar-search {
    flex: 1;
    max-width: 560px;
    margin: 0 auto;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    margin-left: auto;
}

.topbar-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: background 0.12s, color 0.12s;
}

.topbar-btn:hover { background: var(--wt-aqua-light); color: var(--text); }

.topbar-btn-accent {
    width: auto;
    padding: 0 0.85rem;
    border-radius: 20px;
    background: var(--accent);
    color: #fff;
}

.topbar-btn-accent:hover { background: var(--accent-hover); color: #fff; }
.topbar-btn-label { font-size: 0.8rem; font-weight: var(--fw-medium); }

.topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--wt-aqua);
    color: #fff;
    font-size: 0.85rem;
    font-weight: var(--fw-medium);
    cursor: pointer;
}

.topbar-profile { position: relative; }

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
}

.profile-dropdown-header {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.profile-dropdown-header strong { font-size: 0.875rem; }
.profile-dropdown-header span { font-size: 0.75rem; color: var(--text-muted); }

.profile-dropdown a,
.profile-dropdown button {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
}

.profile-dropdown a:hover,
.profile-dropdown button:hover { background: var(--wt-aqua-light); }

.page-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.page-panel.active { display: flex; }

#page-dashboard {
    overflow-y: auto;
    padding: 1.5rem;
}

.drive-toolbar.hidden { display: none; }

/* View header (titre de page + fil d'Ariane contenu) */
.view-header {
    padding: 0.85rem 1.5rem 0.65rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.view-header.hidden { display: none; }

.view-breadcrumb {
    margin-bottom: 0.2rem;
}

.view-breadcrumb.hidden {
    display: none;
}

.view-title {
    font-size: 1.35rem;
    font-weight: var(--fw-medium);
    line-height: 1.25;
    margin: 0;
    color: var(--text);
    letter-spacing: -0.01em;
}

.topbar-page-title {
    display: none;
    font-size: 0.95rem;
    font-weight: var(--fw-medium);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    flex-shrink: 1;
    min-width: 0;
}

/* Main area */
.drive-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.drive-header {
    display: none;
}

.mobile-menu { display: none; color: var(--text-muted); background: none; }

.search-wrap {
    flex: 1;
    max-width: 720px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-subtle);
    pointer-events: none;
}

.search-wrap input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.75rem;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--bg);
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.search-wrap input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
    background: var(--surface);
}

.drive-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    min-height: 48px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
}

.breadcrumb-link {
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-link:hover { background: var(--wt-aqua-light); color: var(--wt-aqua-deep); }

.breadcrumb-sep { color: var(--text-subtle); font-size: 0.75rem; user-select: none; }

.breadcrumb-current {
    font-size: 0.8125rem;
    font-weight: var(--fw-medium);
    color: var(--text-muted);
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toolbar-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

.sort-select {
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
}

.view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.view-btn {
    width: 36px;
    height: 34px;
    border: none;
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn.active { background: var(--wt-aqua-light); color: var(--wt-aqua-deep); }
.view-btn + .view-btn { border-left: 1px solid var(--border); }

/* Content */
.drive-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem 2rem;
    position: relative;
}

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

.drive-item {
    position: relative;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.12s, box-shadow 0.12s, transform 0.12s, border-color 0.12s;
    user-select: none;
}

.view-grid .drive-item {
    padding: 0.85rem 0.75rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(11, 19, 32, 0.04);
}

.view-grid .drive-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.view-grid .drive-item.selected {
    background: var(--wt-aqua-light);
    border-color: rgba(9, 168, 220, 0.35);
}

.item-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 72px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    border-radius: var(--radius-xs, 6px);
}

.item-thumb svg { width: 48px; height: 48px; }

.drive-item-image .item-thumb {
    height: auto;
    aspect-ratio: 4 / 3;
    background: var(--bg);
    cursor: zoom-in;
}

.drive-item-image .item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.15s ease;
}

.drive-item-image:hover .item-thumb img {
    transform: scale(1.03);
}

.item-thumb-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.drive-item-folder .item-thumb svg { color: var(--wt-aqua); stroke: var(--wt-aqua); }
.drive-item-file .item-thumb svg { color: var(--text-subtle); }

/* Glisser-déposer : déplacer un fichier vers un dossier */
.drive-item-file[draggable="true"] {
    cursor: grab;
}

.drive-item-file.is-dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.drive-item-folder.drop-target-active,
.tree-node.drop-target-active,
.breadcrumb-link.drop-target-active {
    outline: 2px dashed var(--wt-aqua);
    outline-offset: 2px;
    background: var(--wt-aqua-light);
}

.view-grid .drive-item-folder.drop-target-active {
    border-color: var(--wt-aqua);
    box-shadow: 0 0 0 3px rgba(9, 168, 220, 0.2);
}

.tree-node.drop-target-active .tree-label {
    color: var(--wt-aqua-deep, #067a9e);
    font-weight: var(--fw-medium);
}

body.wtdr-file-drag .drive-item-folder,
body.wtdr-file-drag .tree-label,
body.wtdr-file-drag .breadcrumb-link[data-folder-id] {
    cursor: copy;
}

.item-meta { min-width: 0; }

.item-name {
    display: block;
    font-size: 0.82rem;
    font-weight: var(--fw-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-sub { font-size: 0.72rem; color: var(--text-subtle); margin-top: 0.15rem; }

.item-menu-btn {
    position: absolute;
    top: 6px;
    right: 4px;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--text-subtle);
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    font-size: 1rem;
    line-height: 1;
    transition: opacity 0.12s, background 0.12s;
}

.drive-item:hover .item-menu-btn { opacity: 1; }
.item-menu-btn:hover { background: rgba(0, 0, 0, 0.06); }

/* List view */
.file-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.list-header {
    display: grid;
    grid-template-columns: 1fr 140px 100px 36px;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    font-size: 0.72rem;
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-subtle);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.view-list .drive-item {
    display: grid;
    grid-template-columns: 28px 1fr 140px 100px 36px;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.view-list .drive-item:last-child { border-bottom: none; }
.view-list .drive-item:hover { background: var(--wt-aqua-light); }
.view-list .drive-item.selected { background: rgba(9, 168, 220, 0.12); }

.view-list .item-icon svg { width: 22px; height: 22px; color: var(--wt-aqua); }
.view-list .drive-item-file .item-icon svg { color: var(--text-subtle); }

.view-list .item-date, .view-list .item-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.view-list .item-menu-btn { position: static; opacity: 1; }

/* Empty & loading */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-icon { color: var(--wt-aqua); opacity: 0.5; margin-bottom: 1rem; }
.empty-title { font-size: 1.1rem; font-weight: var(--fw-medium); margin-bottom: 0.35rem; }
.empty-desc { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.empty-actions { display: flex; gap: 0.75rem; }

.btn-primary, .btn-secondary {
    padding: 0.55rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: var(--fw-medium);
    cursor: pointer;
    border: none;
    transition: background 0.15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }

.loading-state { display: none; }

/* Skeleton loading */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.skeleton-card {
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
}

.skeleton-thumb {
    height: 64px;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

.skeleton-line-short { width: 60%; }

.skeleton-list { display: flex; flex-direction: column; gap: 0.65rem; }

.skeleton-row {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Drop overlay */
.drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 168, 220, 0.08);
    border: 2px dashed var(--accent);
    border-radius: var(--radius);
    margin: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
}

.drop-overlay-inner {
    text-align: center;
    color: var(--wt-aqua-deep);
}

.drop-overlay-inner svg { margin-bottom: 0.5rem; }

/* Masquer l'UI DragDrop d'Uppy si encore présente (remplacée par DropTarget) */
.uppy-DragDrop-container {
    display: none !important;
}

/* Upload bar (bottom fixed) */
.upload-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w);
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 24px rgba(11, 19, 32, 0.08);
    z-index: 250;
    transition: transform 0.2s ease;
}

[data-theme="dark"] .upload-bar {
    background: rgba(20, 28, 43, 0.95);
    backdrop-filter: blur(12px);
}

.upload-bar.minimized .upload-bar-expanded { display: none; }
.upload-bar:not(.minimized) .upload-bar-collapsed { display: none; }

.upload-bar-collapsed {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    height: var(--upload-bar-h);
}

.upload-bar-toggle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    border: none;
    background: none;
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    padding: 0.5rem 0;
}

.upload-bar-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: var(--fw-medium);
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
}

.upload-bar-mini-progress {
    width: 120px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.upload-bar-mini-bar {
    height: 100%;
    background: var(--accent);
    width: 0;
    transition: width 0.2s;
}

.upload-bar-expanded {
    max-height: 320px;
    display: flex;
    flex-direction: column;
}

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

.upload-bar-title h2 {
    font-size: 0.875rem;
    font-weight: var(--fw-medium);
    margin: 0;
}

.upload-bar-stats {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.upload-bar-header-actions { display: flex; gap: 0.25rem; }

.upload-bar-list {
    overflow-y: auto;
    max-height: 240px;
    padding: 0.5rem;
}

.upload-item {
    display: grid;
    grid-template-columns: 1fr auto 28px;
    grid-template-rows: auto auto;
    gap: 0.25rem 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.35rem;
    background: var(--bg);
}

.upload-item-info { grid-column: 1; }
.upload-item-name {
    display: block;
    font-size: 0.8rem;
    font-weight: var(--fw-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.upload-item-meta { font-size: 0.7rem; color: var(--text-muted); }

.upload-item-progress {
    grid-column: 1 / -1;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.upload-item-bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.15s;
}

.upload-item-pct {
    font-size: 0.75rem;
    color: var(--text-muted);
    align-self: center;
}

.upload-item-cancel {
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
}

.upload-item-cancel:hover { color: var(--danger); }
.upload-item-done .upload-item-bar { background: var(--success); }
.upload-item-processing .upload-item-bar {
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-muted, #6b9fd4) 50%, var(--accent) 100%);
    background-size: 200% 100%;
    animation: upload-finalize 1.2s ease-in-out infinite;
}
.upload-item-error .upload-item-bar { background: var(--danger); }

@keyframes upload-finalize {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.drive-app.upload-active .app-body { padding-bottom: var(--upload-bar-h); }
.drive-app.upload-active.expanded-upload .app-body { padding-bottom: 320px; }

/* Upload drawer (legacy) */
.upload-drawer { display: none !important; }

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

.drawer-header h2 {
    font-size: 0.95rem;
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#upload-manager { flex: 1; padding: 0.5rem; overflow: auto; }

.upload-progress {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.upload-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.upload-progress-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: inherit;
    background: var(--accent);
    border-radius: 2px;
}

.upload-progress-text { font-size: 0.8rem; color: var(--text-muted); min-width: 36px; }

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 19, 32, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 1rem;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 1rem;
    font-weight: var(--fw-medium);
    margin-bottom: 0.35rem;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.modal-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    margin-bottom: 1.25rem;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}

.modal-actions { display: flex; justify-content: flex-end; gap: 0.65rem; }

/* Sélecteur de dossier (déplacement de fichiers) */
.move-picker { max-width: 460px; }
.move-tree {
    max-height: 50vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    padding: 0.35rem 0;
}
.move-row { display: flex; align-items: center; gap: 0.25rem; }
.move-toggle {
    flex: 0 0 auto;
    width: 1.4rem;
    height: 1.4rem;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.15s ease;
}
.move-toggle.expanded { transform: rotate(90deg); }
.move-toggle.invisible { visibility: hidden; cursor: default; }
.move-pick {
    flex: 1 1 auto;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.move-pick:hover { background: var(--accent-soft, rgba(37, 99, 235, 0.1)); color: var(--accent); }
.move-loading, .move-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.4rem 0.5rem;
}

/* Context menu */
.context-menu {
    position: fixed;
    min-width: 168px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 400;
    overflow: hidden;
    padding: 0.35rem 0;
}

.context-menu button {
    display: block;
    width: 100%;
    padding: 0.55rem 1rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
}

.context-menu button:hover { background: var(--wt-aqua-light); }
.context-menu button.danger { color: var(--danger); }
.context-menu button.danger:hover { background: #fdf0f1; }

/* Preview panel */
.preview-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(520px, 100vw);
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 150;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
}

.preview-panel.open {
    transform: translateX(0);
}

.preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.preview-title h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}

.preview-meta {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.preview-body {
    flex: 1;
    overflow: auto;
    padding: 1rem;
}

.preview-error {
    margin: 0;
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--wt-aqua-light);
    color: var(--text);
    font-size: 0.875rem;
}

@media (min-width: 1025px) {
    .drive-main.preview-open,
    .app-workspace.preview-open .drive-main {
        margin-right: min(520px, 45vw);
        transition: margin-right 0.25s ease;
    }
}

.drive-item-file .item-thumb {
    cursor: pointer;
}

.drive-item-file .item-thumb:hover {
    opacity: 0.85;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: calc(1.5rem + var(--upload-bar-h));
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.drive-app:not(.upload-active) #toast-container {
    bottom: 1.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s;
    font-size: 0.875rem;
    border-left: 4px solid var(--accent);
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast-error { border-left-color: var(--danger); }
.toast-success { border-left-color: var(--success); }

/* Video player (preview) — ratio réservé = moins de CLS */
.video-player {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    width: 100%;
    max-height: 70vh;
}
.video-player__media,
.video-player video {
    width: 100%;
    height: 100%;
    display: block;
    max-height: 70vh;
    object-fit: contain;
}
.video-player-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.video-player-loading.hidden { opacity: 0; visibility: hidden; }
.video-player-spinner {
    width: 2.25rem;
    height: 2.25rem;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: video-spin 0.75s linear infinite;
}
.video-player-loading-text { font-size: 0.875rem; opacity: 0.9; }
.video-player-retry {
    margin-top: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
}

.video-player-retry-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}

.video-player-status.video-player-error {
    background: rgba(180, 40, 40, 0.92);
}
.video-player-status {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    margin: 0;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.8125rem;
}
@keyframes video-spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* Responsive */
@media (max-width: 1024px) {
    html:has(body.drive-app),
    html:has(body.share-page) {
        overflow-x: hidden;
    }

    body.drive-app,
    body.share-page {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .drive-sidebar {
        height: 100dvh;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(var(--sidebar-w), 85vw);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: var(--shadow-lg);
    }

    .drive-sidebar.open {
        transform: translateX(0);
    }

    body.mobile-sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(11, 19, 32, 0.45);
        z-index: 45;
    }

    .app-body {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .app-topbar {
        flex-wrap: wrap;
        align-items: center;
        height: auto;
        min-height: var(--header-h);
        padding: 0.5rem 0.75rem;
        gap: 0.35rem 0.5rem;
    }

    .topbar-breadcrumb { display: none; }

    .topbar-page-title { display: block; }

    .view-title { display: none; }

    .view-breadcrumb {
        display: flex;
        margin-bottom: 0;
    }

    .view-header:has(.view-breadcrumb.hidden) {
        display: none;
    }

    .topbar-search {
        order: 10;
        flex: 1 1 100%;
        max-width: none;
        margin: 0;
    }

    .topbar-actions {
        margin-left: auto;
        flex-shrink: 0;
    }

    .mobile-menu { display: flex; }

    .upload-bar {
        left: 0;
        right: 0;
        width: 100%;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .drive-main.preview-open,
    .app-workspace.preview-open .drive-main {
        margin-right: 0;
    }

    .preview-panel {
        width: 100%;
        max-width: 100%;
    }

    .share-page.preview-open .share-main-with-panel {
        margin-right: 0;
    }

    .share-page .preview-panel.open {
        top: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
    }

    .list-header, .view-list .drive-item {
        grid-template-columns: 24px 1fr 36px;
    }

    .view-list .item-date, .view-list .item-size, .list-header .col-date, .list-header .col-size {
        display: none;
    }

    #page-dashboard {
        padding: 1rem;
    }

    .drive-content {
        padding: 1rem 0.75rem 1.5rem;
    }

    .drive-toolbar {
        padding: 0.65rem 0.75rem;
    }

    .settings-page,
    .admin-page,
    .system-page {
        padding: 1rem 0.75rem 1.5rem;
    }
}

@media (max-width: 600px) {
    .drive-toolbar {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.5rem;
    }

    .toolbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .selection-bar {
        flex-wrap: wrap;
        padding: 0.5rem 0.75rem;
    }

    .share-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.85rem 1rem;
    }

    .share-main {
        padding: 1.25rem 1rem;
    }

    .share-file-actions {
        flex-wrap: wrap;
    }

    .modal-share {
        max-width: none;
    }

    .notifications-panel {
        position: fixed;
        top: calc(var(--header-h) + 0.5rem);
        left: 0.75rem;
        right: 0.75rem;
        width: auto;
        max-height: min(420px, calc(100vh - var(--header-h) - 1.5rem));
    }
}

@media (max-width: 480px) {
    .file-grid.view-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .topbar-btn-label { display: none; }

    #btn-topbar-folder {
        display: none;
    }

    .dashboard-quick {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-hero h1 {
        font-size: 1.35rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    .auth-card {
        padding: 1.75rem 1.25rem;
    }
}

/* Dashboard home */
.dashboard-home {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.dashboard-hero {
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dashboard-hero h1 {
    font-size: 1.75rem;
    font-weight: var(--fw-medium);
    margin-bottom: 0.35rem;
}

.dashboard-hero p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.dashboard-quick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.quick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    padding: 1.25rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    text-decoration: none;
    color: var(--text);
}

.quick-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.quick-icon { color: var(--accent); }
.quick-label { font-size: 0.875rem; font-weight: var(--fw-medium); }

.dashboard-section { margin-bottom: 2rem; }

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

.section-header h2 {
    font-size: 1rem;
    font-weight: var(--fw-medium);
}

.section-link {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
}

.dashboard-recent {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.12s;
}

.recent-item:hover { background: var(--wt-aqua-light); }

.recent-icon {
    width: 24px;
    height: 24px;
    color: var(--accent);
    flex-shrink: 0;
}

.recent-icon svg { width: 100%; height: 100%; }

.recent-name {
    flex: 1;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-meta { font-size: 0.75rem; color: var(--text-muted); }

.dashboard-empty,
.dashboard-activity-placeholder p {
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

.placeholder-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    flex: 1;
}

.placeholder-icon {
    color: var(--accent);
    opacity: 0.6;
    margin-bottom: 1.25rem;
}

.placeholder-page h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.placeholder-page p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 360px;
}

/* Selection bar */
.selection-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 1.25rem;
    background: var(--wt-aqua-light);
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .selection-bar {
    background: rgba(9, 168, 220, 0.1);
}

.selection-count {
    font-size: 0.875rem;
    font-weight: var(--fw-medium);
}

.selection-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.selection-clear {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.25rem;
    width: 28px;
    height: 28px;
}

.drive-item.selected {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background: var(--wt-aqua-light);
}

.load-more-sentinel {
    height: 1px;
    width: 100%;
}

.preview-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    display: block;
    margin: 0 auto;
}

.preview-pdf-wrap {
    overflow: auto;
    max-height: calc(100vh - 120px);
}

.preview-pdf-wrap canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
}

/* Share public page */
.share-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

@media (min-width: 1025px) {
    .share-page.preview-open .share-main-with-panel {
        margin-right: min(420px, 45vw);
    }
}

.share-page .preview-panel.open {
    position: fixed;
    top: 57px;
    right: 0;
    width: min(420px, 45vw);
    height: calc(100vh - 57px);
    z-index: 50;
    border-left: 1px solid var(--border);
    background: var(--surface);
    overflow-y: auto;
    padding: 1rem;
}

.share-preview-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1.25rem;
    z-index: 2;
}

.share-file-card {
    position: relative;
}

.share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.share-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: var(--fw-medium);
    color: var(--text-muted);
}

.share-brand img { height: 36px; width: auto; }

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

.share-main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.share-hero h1 {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

.share-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.share-lock-card {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: var(--shadow);
}

.share-lock-icon {
    color: var(--accent);
    margin-bottom: 1rem;
}

.share-unlock-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.share-unlock-form input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.share-file-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.share-preview-host {
    margin: 1.25rem 0;
}

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

.item-download {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    text-decoration: none;
    color: var(--text);
    font-size: 0.9rem;
}

.drive-item-file { position: relative; }

.share-error-card p { color: var(--text-muted); margin-top: 0.5rem; }

/* Share modal */
.modal-share {
    max-width: 560px;
    width: 100%;
}

.modal-share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.share-create-form {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
}

.share-form-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.share-field span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.share-field input,
.share-field select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.share-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.share-existing h4 {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.share-existing-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 240px;
    overflow-y: auto;
}

.share-list-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.share-list-info { flex: 1; min-width: 0; }

.share-url-input {
    width: 100%;
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    margin-bottom: 0.35rem;
}

.share-list-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.share-list-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.share-empty, .share-loading {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.btn-secondary.danger { color: var(--danger); }

/* Settings & Admin pages */
.page-header {
    margin-bottom: 1.75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.settings-page,
.admin-page,
.system-page {
    padding: 1.5rem 1.75rem 2rem;
    max-width: 960px;
}

.settings-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 2rem;
}

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

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.settings-nav-item,
.admin-tab {
    padding: 0.6rem 0.85rem;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.settings-nav-item:hover,
.admin-tab:hover {
    background: var(--surface);
    color: var(--text);
}

.settings-nav-item.active,
.admin-tab.active {
    background: var(--wt-aqua-light);
    color: var(--accent);
    font-weight: var(--fw-medium);
}

[data-theme="dark"] .settings-nav-item.active,
[data-theme="dark"] .admin-tab.active {
    background: rgba(9, 168, 220, 0.12);
}

.settings-panel,
.admin-panel {
    display: none;
}

.settings-panel.active,
.admin-panel.active {
    display: block;
}

.settings-panel h2,
.system-info h2 {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
}

.form-username-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 480px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 560px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-field span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.875rem;
}

.form-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-meta strong {
    color: var(--text);
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.4;
}

.settings-pwa {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.settings-pwa h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.settings-pwa [data-pwa-install] {
    margin-top: 0.75rem;
}

.settings-storage {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.settings-storage h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.storage-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: var(--fw-semibold);
    color: var(--accent);
}

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

.skeleton-stat {
    min-height: 80px;
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

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

.admin-toolbar input[type="search"] {
    flex: 1;
    min-width: 200px;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

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

.admin-table th {
    font-weight: var(--fw-medium);
    color: var(--text-muted);
    background: var(--bg);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

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

.admin-table tr.row-inactive {
    opacity: 0.55;
}

.table-actions {
    display: flex;
    gap: 0.35rem;
    white-space: nowrap;
}

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

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--wt-aqua-light);
    border-radius: 4px;
    font-size: 0.75rem;
}

[data-theme="dark"] .badge {
    background: rgba(9, 168, 220, 0.15);
}

.status-active { color: var(--success, #22c55e); }
.status-inactive { color: var(--danger); }

.admin-table code {
    font-size: 0.75rem;
    background: var(--bg);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.info-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.75rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    font-size: 0.875rem;
}

.info-grid dt {
    color: var(--text-muted);
    font-weight: var(--fw-medium);
}

.info-grid .system-warn-label {
    color: var(--danger, #c0392b);
}

.info-grid .system-warn {
    color: var(--danger, #c0392b);
    line-height: 1.5;
}

.info-grid .system-ok {
    color: var(--success, #1e7e34);
}

.modal-admin-user {
    max-width: 480px;
    width: 100%;
}

/* Watermark preview */
.preview-watermark-wrap {
    position: relative;
    overflow: hidden;
}

.preview-watermark {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: repeating-linear-gradient(
        -35deg,
        transparent,
        transparent 80px,
        rgba(9, 168, 220, 0.04) 80px,
        rgba(9, 168, 220, 0.04) 81px
    );
}

.preview-watermark::after {
    content: 'Confidentiel — WT DataRoom';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-25deg);
    font-size: 1.25rem;
    font-weight: var(--fw-semibold);
    color: rgba(9, 168, 220, 0.18);
    white-space: nowrap;
    letter-spacing: 0.05em;
}

[data-theme="dark"] .preview-watermark::after {
    color: rgba(255, 255, 255, 0.08);
}

.share-preview-host.preview-watermark-wrap,
.share-preview-host .preview-watermark-wrap {
    min-height: 120px;
}

/* Dashboard activity */
.dashboard-activity {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.activity-action {
    flex: 1;
    min-width: 0;
}

.activity-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Notifications */
.notifications-wrap {
    position: relative;
}

.notifications-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.65rem;
    font-weight: var(--fw-semibold);
    line-height: 16px;
    text-align: center;
    background: var(--danger);
    color: #fff;
    border-radius: 8px;
}

.notifications-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg, 0 8px 32px rgba(0,0,0,0.12));
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.notifications-header h3 {
    font-size: 0.9rem;
    font-weight: var(--fw-semibold);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

.notifications-list {
    overflow-y: auto;
    max-height: 340px;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 1rem;
    text-align: left;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

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

.notification-item.unread {
    background: var(--wt-aqua-light);
}

[data-theme="dark"] .notification-item.unread {
    background: rgba(9, 168, 220, 0.08);
}

.notification-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.notification-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.notification-title {
    font-size: 0.85rem;
    font-weight: var(--fw-medium);
}

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

.notification-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.notifications-empty,
.notifications-loading {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}
