/* ==========================================================================
   Espace Fichiers — feuille de style
   Base sobre (une couleur d'accent) + couche « verre » assumée en fin de fichier (section GLASS).
   ========================================================================== */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --border: #e2e5e9;
    --border-strong: #cfd4da;
    --text: #1c2230;
    --text-2: #475467;
    --muted: #6b7280;
    --accent: #1f5aa6;
    --accent-hover: #184a8a;
    --accent-soft: #e9f0fa;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --success: #1f7a4a;
    --success-soft: #e7f5ed;
    --warning: #b25e09;
    --warning-soft: #fdf3e6;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
    --sidebar-w: 248px;
    --topbar-h: 60px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
p { margin: 0 0 .75em; }
code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.icon.sm { width: 15px; height: 15px; }
.icon.inline { vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.num { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }
.only-mobile { display: none !important; }

/* ---------------------------------------------------------------- Boutons */

.btn {
    display: inline-flex; align-items: center; gap: 7px; justify-content: center;
    height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important;
    transition: background-color .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: #b9c0c9; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #912018; border-color: #912018; }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: #f1b8b3; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(0, 0, 0, .04); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13.5px; }
.btn-block { width: 100%; height: 40px; }
.btn .icon { width: 17px; height: 17px; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: rgba(0, 0, 0, .06); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------------------------------------------------------------- Formulaires */

.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; }
.field > span:first-child, .field legend { font-weight: 500; font-size: 14px; color: var(--text); padding: 0; }
.field legend { margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=tel], select, textarea {
    height: 38px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled { background: var(--surface-2); color: var(--muted); }
select { padding-right: 28px; }
.select-sm { height: 32px; font-size: 13.5px; width: auto; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.input-suffix { display: inline-flex; align-items: center; gap: 8px; }
.input-suffix input { width: 110px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* ---------------------------------------------------------------- Alertes */

.alert {
    display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm);
    margin-bottom: 16px; border: 1px solid transparent; font-size: 14px;
}
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--success-soft); color: #14532d; border-color: #bfe3cd; }
.alert-error { background: var(--danger-soft); color: #7a1a12; border-color: #f3c3be; }
.alert-info { background: var(--accent-soft); color: #173f73; border-color: #c9d9f0; }
.notice {
    display: flex; gap: 10px; align-items: center; padding: 10px 14px; margin-bottom: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); font-size: 14px;
}
.notice .icon { color: var(--accent); }

/* ---------------------------------------------------------------- Authentification */

body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px 16px; }
.auth-card {
    width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 32px; box-shadow: var(--shadow);
}
.auth-card.is-wide { max-width: 520px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card > .muted { margin-bottom: 22px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; font-weight: 600; font-size: 16px; }
.auth-foot { margin: 20px 0 0; text-align: center; font-size: 14px; }
.checklist { list-style: none; padding: 0; margin: 0 0 24px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 14px; }
.checklist li:first-child { border-top: 0; }
.checklist li small { margin-left: auto; color: var(--muted); text-align: right; word-break: break-all; }
.checklist .ok .icon { color: var(--success); }
.checklist .ko .icon { color: var(--danger); }
.checklist .ko { background: var(--danger-soft); }

.brand-mark {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border-radius: 8px; background: var(--accent); color: #fff;
}
.brand-mark .icon { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- Structure */

body.app { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface);
    border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 18px; font-weight: 600; font-size: 15.5px; }
.sidebar-nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-link {
    display: flex; align-items: center; gap: 11px; padding: 0 10px 0 6px; height: 42px; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500; text-decoration: none !important; white-space: nowrap; overflow: hidden;
    --c: #475467; --c-soft: #eef0f3;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active { background: var(--c-soft); color: var(--text); font-weight: 600; }
/* Icône colorée dans une pastille teintée : repère visuel sans surcharge. */
.nav-icon {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 30px; height: 30px; border-radius: 8px; background: var(--c-soft); color: var(--c);
}
.nav-icon .icon { width: 17px; height: 17px; }
.nav-link.is-active .nav-icon { background: var(--c); color: #fff; }
.nav-blue   { --c: #2f6fd0; --c-soft: #e8f0fc; }
.nav-teal   { --c: #0e8a7d; --c-soft: #e3f5f2; }
.nav-amber  { --c: #c27a0e; --c-soft: #fcf2e1; }
.nav-violet { --c: #7c4dbd; --c-soft: #f1ebfa; }
.nav-red    { --c: #c4422f; --c-soft: #fcebe8; }
.nav-slate  { --c: #4b5a70; --c-soft: #edf0f4; }
.nav-sep { height: 1px; background: var(--border); margin: 8px 6px; }
.sidebar-toggle {
    display: flex; align-items: center; gap: 11px; height: 44px; padding: 0 18px; border: 0; border-top: 1px solid var(--border);
    background: transparent; color: var(--muted); cursor: pointer; font-size: 13.5px; white-space: nowrap; overflow: hidden; width: 100%;
}
.sidebar-toggle:hover { background: var(--surface-2); color: var(--text); }
.sidebar-toggle .icon { transition: transform .15s; }
.storage-meter { padding: 16px 18px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); white-space: nowrap; }
.storage-meter-label { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.meter { height: 6px; border-radius: 99px; background: #e9ecef; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.is-warning > span { background: var(--warning); }
.meter.is-danger > span { background: var(--danger); }
.sidebar-backdrop { display: none; }

.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
    padding: 0 24px; background: rgba(245, 246, 248, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border);
}
.search { position: relative; flex: 1; max-width: 560px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; background: var(--surface); height: 38px; }
.user-menu { margin-left: 4px; }

/* Compte à rebours de déconnexion automatique */
/* Badge vert ; orange pendant les 5 dernières minutes */
.idle-timer {
    margin-left: auto; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
    border: 1px solid #1a6b40; border-radius: 99px; background: #1f8a4c; color: #fff;
    font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: 0 1px 2px rgba(16, 24, 40, .12);
}
.idle-timer .icon { width: 16px; height: 16px; color: #d4f3df; }
.idle-label { color: #e3f7ea; }
.idle-remaining { font-weight: 700; color: #fff; min-width: 52px; }
.idle-timer.is-warning { border-color: #b25e09; background: #d97706; }
.idle-timer.is-warning .icon, .idle-timer.is-warning .idle-label { color: #fff3e0; }

/* Menu réduit (ordinateur) : icônes seules, libellés en info-bulle */
@media (min-width: 901px) {
    .sidebar, .shell { transition: width .18s ease, margin-left .18s ease; }
    body.sidebar-collapsed { --sidebar-w: 72px; }
    body.sidebar-collapsed .sidebar-brand { padding: 0; justify-content: center; }
    body.sidebar-collapsed .brand-name,
    body.sidebar-collapsed .nav-label { display: none; }
    body.sidebar-collapsed .nav-link { justify-content: center; padding: 0; }
    body.sidebar-collapsed .storage-meter { padding: 14px 12px; }
    body.sidebar-collapsed .storage-meter-label { justify-content: center; margin-bottom: 6px; }
    body.sidebar-collapsed .sidebar-toggle { justify-content: center; padding: 0; }
    body.sidebar-collapsed .sidebar-toggle .icon { transform: scaleX(-1); }
}
.user-btn { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 4px 8px 4px 4px; border-radius: 99px; cursor: pointer; }
.user-btn:hover { background: rgba(0, 0, 0, .05); }
.avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
    background: #dde6f3; color: #1d3f6e; font-weight: 600; font-size: 13px; flex: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-org { background: var(--success-soft); color: var(--success); }
.user-name { font-weight: 500; }

.main { padding: 24px; flex: 1; width: 100%; max-width: 1400px; }
.page { position: relative; }
.page.narrow, .form-narrow { max-width: 760px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; min-height: 38px; flex-wrap: wrap; }
.page-title { font-size: 20px; }
.page-intro { margin-top: -6px; margin-bottom: 18px; max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.breadcrumb { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 18px; font-weight: 600; min-width: 0; }
.breadcrumb a { color: var(--text-2); padding: 2px 6px; border-radius: var(--radius-sm); }
.breadcrumb a:hover { background: rgba(0, 0, 0, .05); text-decoration: none; color: var(--text); }
.breadcrumb .is-current { color: var(--text); padding: 2px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.breadcrumb .sep { color: #a0a7b1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
    padding: 9px 14px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
    white-space: nowrap; text-decoration: none !important;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-title { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.card-link { font-size: 13.5px; font-weight: 500; }
.card-highlight { border-color: #bcd0ec; background: #f6f9fe; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 .card { margin-bottom: 0; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font-size: 14px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; word-break: break-word; }

/* ---------------------------------------------------------------- Liste de fichiers */

.browser { display: flex; gap: 18px; align-items: flex-start; }
.file-list { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 240px; }
.file-table, .table { width: 100%; border-collapse: collapse; }
.page > .file-table, .page > .table, .table-scroll { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-scroll { overflow-x: auto; }
.table-scroll .table { border: 0; box-shadow: none; }
.file-table th, .table th {
    text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 10px 12px;
    border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
.file-table thead tr th:first-child, .table thead tr th:first-child { border-top-left-radius: var(--radius); }
.file-table thead tr th:last-child, .table thead tr th:last-child { border-top-right-radius: var(--radius); }
.file-table td, .table td { padding: 0 12px; height: 48px; border-bottom: 1px solid #eef0f3; font-size: 14px; }
.table td { padding: 10px 12px; height: auto; }
.file-table tbody tr:last-child td, .table tbody tr:last-child td { border-bottom: 0; }
.file-table tbody tr:hover, .table-hover tbody tr:hover { background: #f8f9fb; }
.file-table tbody tr.is-selected { background: var(--accent-soft); }
.file-table tbody tr.is-flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { background: #fff4d6; } 100% { background: transparent; } }
.col-check { width: 44px; text-align: center; padding-right: 0 !important; }
.col-date { width: 170px; color: var(--text-2); white-space: nowrap; }
.col-size { width: 110px; color: var(--text-2); white-space: nowrap; }
.col-actions { width: 52px; text-align: right; }
.col-actions-wide { width: 170px; text-align: right; white-space: nowrap; }
.col-name { max-width: 0; }
.col-name .item-link, .item-link { display: inline-flex; align-items: center; gap: 11px; color: var(--text); max-width: 100%; min-width: 0; vertical-align: middle; text-decoration: none !important; }
.item-link:hover .item-name { color: var(--accent); text-decoration: underline; }
.item-link.is-static:hover .item-name { color: inherit; text-decoration: none; }
.item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.item-meta { font-size: 12.5px; color: var(--muted); }
.badge-shared { display: inline-flex; color: var(--muted); margin-left: 6px; vertical-align: middle; }
.tag {
    display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 8px; border-radius: 99px;
    background: #eef1f4; color: var(--text-2); font-size: 12px; font-weight: 500; vertical-align: middle;
}
.sort-link { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.sort-link.is-active { color: var(--text); }
.sort-link:hover { color: var(--text); text-decoration: none; }

.file-icon { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 6px; flex: none; }
.file-icon .icon { width: 20px; height: 20px; }
.kind-folder { color: #5b82b8; }
.kind-folder .icon { width: 24px; height: 24px; }
.kind-file { color: #7b8494; }
.kind-pdf { color: #c2410c; }
.kind-doc { color: #2563a8; }
.kind-sheet { color: #1b7f4b; }
.kind-slide { color: #c26a0a; }
.kind-image { color: #7c4dbd; }
.kind-video { color: #b83268; }
.kind-audio { color: #0f7f86; }
.kind-archive { color: #8a6a3a; }

.selection-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 8px 10px 8px 16px; margin-bottom: 12px; background: var(--accent-soft); border: 1px solid #c9d9f0;
    border-radius: var(--radius-sm); font-weight: 500; color: #173f73;
}
.selection-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.empty-state { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty-state h1, .empty-state h2 { font-size: 17px; margin-bottom: 6px; color: var(--text); }
.empty-icon { display: inline-flex; width: 56px; height: 56px; border-radius: 50%; background: #eef1f4; align-items: center; justify-content: center; margin-bottom: 14px; color: #8a93a2; }
.empty-icon .icon { width: 26px; height: 26px; }

.drop-overlay {
    position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
    background: rgba(233, 240, 250, .9); border: 2px dashed var(--accent); border-radius: var(--radius);
    color: var(--accent); font-weight: 600; text-align: center; pointer-events: none;
}
.drop-overlay .icon { width: 36px; height: 36px; margin-bottom: 8px; }

/* ---------------------------------------------------------------- Panneau de détails */

.details {
    width: 320px; flex: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 40px); overflow-y: auto;
}
.details-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 12px 12px 16px; border-bottom: 1px solid var(--border); }
.details-head h2 { font-size: 15px; word-break: break-word; flex: 1; padding-top: 5px; }
.details-preview { display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-bottom: 1px solid var(--border); min-height: 140px; }
.details-preview img { max-width: 100%; max-height: 220px; display: block; }
.details-preview .file-icon { width: 64px; height: 64px; }
.details-preview .file-icon .icon { width: 48px; height: 48px; }
.details-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.details-body { padding: 14px 16px 18px; }
.details-body h3 { font-size: 13px; color: var(--muted); font-weight: 500; margin: 16px 0 8px; text-transform: none; }
.details-body .props { font-size: 13.5px; gap: 6px 14px; }
.mini-shares { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.mini-shares li { display: flex; align-items: center; gap: 8px; }
.mini-shares .muted { margin-left: auto; font-size: 12.5px; }

/* ---------------------------------------------------------------- Menus déroulants */

.dropdown { position: relative; }
.dropdown-menu, .context-menu {
    position: absolute; z-index: 60; min-width: 210px; padding: 6px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: none;
}
.dropdown.is-open .dropdown-menu { display: block; }
.dropdown-menu { top: calc(100% + 6px); left: 0; }
.dropdown-menu.align-right { left: auto; right: 0; }
.context-menu { position: fixed; display: block; }
.dropdown-menu a, .dropdown-menu button, .context-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent;
    border-radius: var(--radius-sm); color: var(--text); text-align: left; cursor: pointer; font-size: 14px; text-decoration: none !important;
}
.dropdown-menu a:hover, .dropdown-menu button:hover, .context-menu button:hover, .context-menu button:focus { background: var(--surface-2); outline: none; }
.context-menu button.danger { color: var(--danger); }
.context-menu button.danger:hover { background: var(--danger-soft); }
.context-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }
.dropdown-header { padding: 6px 10px 8px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; word-break: break-all; }

/* ---------------------------------------------------------------- Fenêtres modales */

.modal-backdrop {
    position: fixed; inset: 0; z-index: 80; background: rgba(16, 24, 40, .45);
    display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; overflow-y: auto;
}
.modal { width: 100%; max-width: 460px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); }
.modal.is-wide { max-width: 560px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 0 22px; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 14px 22px 4px; }
.modal-body p { color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; flex-wrap: wrap; }
.modal .field { margin-bottom: 4px; }

.picker { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.picker-path { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 13.5px; }
.picker-path button { border: 0; background: transparent; color: var(--accent); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.picker-path button:hover { background: rgba(0, 0, 0, .05); }
.picker-path span { padding: 2px 4px; font-weight: 500; }
.picker-list { list-style: none; margin: 0; padding: 4px; max-height: 280px; overflow-y: auto; min-height: 120px; }
.picker-list li button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent;
    border-radius: var(--radius-sm); cursor: pointer; text-align: left;
}
.picker-list li button:hover { background: var(--surface-2); }
.picker-list li button:disabled { opacity: .5; cursor: default; }
.picker-list li button .icon:last-child { margin-left: auto; color: var(--muted); }
.picker-empty { padding: 28px 10px; text-align: center; color: var(--muted); font-size: 14px; }

.share-add { display: flex; gap: 8px; position: relative; }
.share-add input { flex: 1; }
.share-add select { width: auto; }
.suggestions {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 5; list-style: none; margin: 0; padding: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.suggestions button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 7px 10px; border: 0; background: transparent; border-radius: 4px; cursor: pointer; text-align: left; }
.suggestions button:hover, .suggestions button.is-active { background: var(--surface-2); }
.suggestions small { color: var(--muted); }
.share-section-title { font-size: 13px; font-weight: 500; color: var(--muted); margin: 20px 0 8px; }
.share-list { list-style: none; margin: 0; padding: 0; }
.share-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #eef0f3; }
.share-list li:first-child { border-top: 0; }
.share-target { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.share-target span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-target small { display: block; color: var(--muted); }
.share-level-fixed { font-size: 13.5px; padding: 0 8px; }
.toggle-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.toggle-row input { margin-top: 3px; }
.toggle-row strong { display: block; font-weight: 500; }
.toggle-row small { color: var(--muted); }
.share-groups { display: flex; flex-direction: column; gap: 12px; }
.share-group { padding: 14px 18px; margin: 0; }
.share-group-head { margin-bottom: 6px; }

/* ---------------------------------------------------------------- Panneau de dépôt */

.upload-panel {
    position: fixed; right: 20px; bottom: 20px; z-index: 70; width: 380px; max-width: calc(100vw - 24px);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
}
.upload-panel-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.upload-panel-head strong { flex: 1; font-size: 14px; }
.upload-panel.is-collapsed .upload-list { display: none; }
.upload-panel.is-collapsed [data-upload-toggle] .icon { transform: rotate(180deg); }
.upload-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.upload-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px 10px 16px; border-top: 1px solid #eef0f3; font-size: 13.5px; }
.upload-item:first-child { border-top: 0; }
.upload-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.upload-item .state { color: var(--muted); font-size: 12.5px; grid-column: 1; }
.upload-item .meter { grid-column: 1 / -1; height: 4px; margin-top: 4px; }
.upload-item .icon-btn { width: 28px; height: 28px; grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.upload-item.is-done .state { color: var(--success); }
.upload-item.is-error .state { color: var(--danger); }

/* ---------------------------------------------------------------- Notifications */

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
    display: flex; align-items: center; gap: 14px; padding: 11px 14px 11px 16px; border-radius: var(--radius);
    background: #1f2633; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; pointer-events: auto; max-width: min(560px, calc(100vw - 32px));
}
.toast.is-error { background: #7a1a12; }
.toast button { border: 0; background: transparent; color: #9cc3ff; font-weight: 600; cursor: pointer; padding: 2px 4px; }

/* ---------------------------------------------------------------- Administration */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.stat-label { color: var(--muted); font-size: 13.5px; }
.stat-value { font-size: 24px; font-weight: 600; }
.stat-sub { color: var(--muted); font-size: 13px; }
.activity { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.activity li { padding: 7px 0; border-top: 1px solid #eef0f3; }
.activity li:first-child { border-top: 0; }
.activity-what { font-weight: 500; }
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { width: auto; min-width: 200px; flex: 0 1 280px; }
.status { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.status-active { background: var(--success-soft); color: var(--success); }
.status-invited { background: var(--warning-soft); color: var(--warning); }
.status-disabled { background: #eef0f3; color: var(--muted); }
tr.is-muted td { color: var(--muted); }
.strong-link { font-weight: 500; color: var(--text); }
.action-rows { display: flex; flex-direction: column; }
.action-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid #eef0f3; }
.action-row:first-child { border-top: 0; padding-top: 0; }
.action-row p { margin: 2px 0 0; font-size: 13.5px; }
.matrix td, .matrix th { vertical-align: middle; }
.action-tag { font-size: 13px; font-weight: 500; }
.action-auth { color: #475467; }
.action-share { color: var(--accent); }
.action-user, .action-role, .action-settings { color: #7c4dbd; }

/* ---------------------------------------------------------------- Reconnexion et pré-inscription */

.reauth-user {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 18px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.avatar-lg { width: 42px; height: 42px; font-size: 15px; }
.reauth-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.reauth-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reauth-who small { color: var(--muted); font-size: 13px; }
.reauth-lock { color: var(--muted); }
.step-label { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.question-box {
    display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
    background: var(--accent-soft); border: 1px solid #c9d9f0; color: #173f73; font-weight: 600; font-size: 15px;
}
.question-box .icon { margin-top: 2px; flex: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.text-danger { color: var(--danger); }
.grid-registrations { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
.reg-list { list-style: none; margin: 0; padding: 0; }
.reg-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid #eef0f3; }
.reg-list li:first-child { border-top: 0; padding-top: 0; }
.reg-main { min-width: 0; font-size: 14px; }
.settings-save { margin-bottom: 18px; }

/* ---------------------------------------------------------------- Lecteur de documents */

body.viewer-open { overflow: hidden; }
.viewer {
    position: fixed; inset: 0; z-index: 85; display: flex; flex-direction: column;
    background: rgba(20, 24, 32, .94);
}
.viewer-bar {
    display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 10px 0 16px; flex: none;
    background: #1b212c; color: #e7eaf0; border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.viewer-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; font-weight: 500; }
.viewer-title .file-icon { background: rgba(255, 255, 255, .92); }
.viewer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-count { color: #9aa3b2; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.viewer-bar .icon-btn, .viewer-bar .viewer-btn { color: #d5dae3; }
.viewer-bar .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.viewer-btn {
    display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, .18); background: transparent; cursor: pointer; font-size: 13.5px; text-decoration: none !important; white-space: nowrap;
}
.viewer-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.viewer-sep { width: 1px; height: 24px; background: rgba(255, 255, 255, .15); margin: 0 4px; }
.viewer-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
.viewer-content > iframe { width: 100%; height: 100%; border: 0; border-radius: 6px; background: #fff; max-width: 1200px; }
.viewer-content > img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 8px 30px rgba(0, 0, 0, .4); background: #fff; }
.viewer-content > video { max-width: 100%; max-height: 100%; border-radius: 6px; background: #000; }
.viewer-content > audio { width: min(520px, 100%); }
.viewer-message { text-align: center; color: #d5dae3; max-width: 440px; }
.viewer-message .file-icon { width: 72px; height: 72px; background: rgba(255, 255, 255, .92); border-radius: 14px; margin-bottom: 14px; }
.viewer-message .file-icon .icon { width: 44px; height: 44px; }
.viewer-message p { color: #aab2c0; }
.viewer-message .btn { margin-top: 8px; }
.viewer-loading { position: absolute; color: #9aa3b2; font-size: 14px; }
.viewer-content { position: relative; width: 100%; height: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; }

/* Documents Office (affichés dans le navigateur par les bibliothèques de public/assets/vendor) */
.office-view { width: 100%; height: 100%; max-width: 1200px; overflow: auto; border-radius: 6px; background: #e9ebef; color: #1c2230; }
.office-docx .docx-wrapper { background: #e9ebef !important; padding: 24px 12px !important; }
.office-docx .docx-wrapper > section.docx { box-shadow: 0 2px 10px rgba(16, 24, 40, .18) !important; margin-bottom: 24px !important; }
.office-sheet { display: flex; flex-direction: column; background: #fff; }
.sheet-view { flex: 1; min-height: 0; overflow: auto; }
.sheet-table { border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.sheet-table th, .sheet-table td { border-right: 1px solid #e1e4e8; border-bottom: 1px solid #e1e4e8; padding: 4px 8px; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; height: 26px; }
.sheet-table thead th { position: sticky; top: 0; z-index: 2; background: #f1f3f5; color: #5b6472; font-weight: 600; text-align: center; min-width: 64px; }
.sheet-table tbody th { position: sticky; left: 0; z-index: 1; background: #f1f3f5; color: #5b6472; font-weight: 500; text-align: right; min-width: 44px; }
.sheet-table thead th:first-child { left: 0; z-index: 3; }
.sheet-table td.num { text-align: right; }
.sheet-tabs { display: flex; gap: 2px; padding: 6px 8px 0; background: #f1f3f5; border-top: 1px solid #e1e4e8; overflow-x: auto; flex: none; }
.sheet-tabs button {
    border: 1px solid transparent; border-bottom: 0; background: transparent; padding: 6px 14px; border-radius: 6px 6px 0 0;
    font-size: 13px; color: #5b6472; cursor: pointer; white-space: nowrap;
}
.sheet-tabs button:hover { background: #e6e9ed; }
.sheet-tabs button.is-active { background: #fff; border-color: #e1e4e8; color: #1f7a4a; font-weight: 600; }
.sheet-note, .sheet-empty { margin: 12px; color: var(--muted); font-size: 13px; }
.office-slides { background: #2a2f38; padding: 20px 16px; display: block; }
.pptx-slide-wrap { margin: 0 auto 22px; width: max-content; }
.pptx-slide-wrap figcaption { color: #9aa3b2; font-size: 12.5px; text-align: center; margin-top: 6px; }
.pptx-slide {
    position: relative; overflow: hidden; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); color: #1c2230;
    font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; line-height: 1.15;
}
.pptx-shape { position: absolute; box-sizing: border-box; overflow: hidden; }
.pptx-shape > img { width: 100%; height: 100%; object-fit: fill; display: block; }
.pptx-p { margin: 0 0 .25em; overflow-wrap: anywhere; }
.pptx-bullet { display: inline-block; width: 1.1em; margin-left: -1.1em; padding-left: .1em; }
.pptx-p:has(.pptx-bullet) { padding-left: 1.1em; }
.pptx-table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
.pptx-table td { border: 1px solid #cfd4da; vertical-align: top; overflow: hidden; }
.pptx-unsupported { display: flex; align-items: center; justify-content: center; background: #f1f3f5; color: #6b7280; font-size: 12px; border: 1px dashed #cfd4da; }
.viewer-nav {
    position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0;
    background: rgba(0, 0, 0, .45); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2;
}
.viewer-nav:hover { background: rgba(0, 0, 0, .7); }
.viewer-nav.prev { left: 14px; }
.viewer-nav.next { right: 14px; }
.viewer-nav .icon { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- Fiche utilisateur, rôles */

.section-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 16px; }
.section-nav a {
    padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text-2); font-size: 13px; text-decoration: none !important;
}
.section-nav a:hover { border-color: var(--accent); color: var(--accent); }
.section-nav a.danger:hover { border-color: var(--danger); color: var(--danger); }
.card[id] { scroll-margin-top: calc(var(--topbar-h) + 12px); }
.card-danger { border-color: #f1c4bf; }
.card-danger .card-title { color: var(--danger); }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat-row > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid #eef0f3; border-radius: var(--radius-sm); background: var(--surface-2); }
.stat-row strong { font-size: 17px; }
.stat-row small { font-size: 12.5px; }
.action-row-top { border-top: 1px solid #eef0f3 !important; margin-top: 16px; padding-top: 14px !important; }
.check-select select { width: auto; height: 32px; margin-left: 6px; display: inline-block; }
.plain-link { color: inherit; }
.plain-link:hover { color: var(--accent); }
.dropdown-menu a.danger, .dropdown-menu button.danger { color: var(--danger); }
.dropdown-menu form { margin: 0; }
.users-table .col-actions { width: 52px; }
.users-table td { vertical-align: middle; }
.roles-manage { margin-top: 22px; align-items: start; }
.role-list { list-style: none; margin: 0; padding: 0; }
.role-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid #eef0f3; }
.role-list li:first-child { border-top: 0; padding-top: 0; }
.role-edit { display: flex; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
.role-edit input[name=name] { flex: 1 1 140px; height: 32px; }
.role-edit input[name=description] { flex: 2 1 180px; height: 32px; }

/* ---------------------------------------------------------------- Base de données */

.auth-card.is-xwide { max-width: 980px; }
body.auth:has(.is-xwide) { align-items: flex-start; }
.db-status { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.db-verdict { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; }
.db-verdict .icon { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.db-verdict strong { display: block; font-size: 15px; }
.db-verdict span { font-size: 13.5px; }
.db-verdict.is-ok { background: var(--success-soft); border-color: #bfe3cd; color: #14532d; }
.db-verdict.is-warning { background: var(--warning-soft); border-color: #f0c98e; color: #7a4306; }
.db-verdict.is-error { background: var(--danger-soft); border-color: #f3c3be; color: #7a1a12; word-break: break-word; }
.db-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 14px 10px; margin: 0; }
.db-group legend { font-weight: 600; padding: 0 6px; }
.db-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-top: 1px solid #eef0f3; padding: 4px 0; }
.db-item:first-of-type { border-top: 0; }
.db-item .check { flex: 1; min-width: 0; }
.db-sql { flex: none; max-width: 55%; }
.db-sql summary { cursor: pointer; color: var(--accent); font-size: 13px; padding: 6px 0; text-align: right; }
.db-sql pre {
    margin: 4px 0 8px; padding: 10px 12px; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word;
    background: #1f2633; color: #dfe6f0; border-radius: var(--radius-sm); font-size: 12px; line-height: 1.45;
}
.db-confirm { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.db-report, .db-notices { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.db-report li, .db-notices li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-top: 1px solid #eef0f3; }
.db-report li:first-child, .db-notices li:first-child { border-top: 0; }
.db-report li.ok .icon { color: var(--success); }
.db-report li.ko .icon { color: var(--danger); }
.db-report li.ko small { color: var(--danger); word-break: break-word; }
.db-notices .icon { color: var(--muted); flex: none; margin-top: 2px; }
.db-page .page-head form { margin: 0; }

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 1100px) {
    .details { position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 100vw); max-height: none; border-radius: 0; z-index: 50; box-shadow: var(--shadow-lg); }
    .grid-2, .grid-registrations { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .18s ease; box-shadow: none; }
    body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 35; }
    .shell { margin-left: 0; }
    .sidebar-toggle { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .db-status { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .db-item { flex-direction: column; }
    .db-sql { max-width: 100%; width: 100%; }
    .db-sql summary { text-align: left; }
    .viewer-btn span, .viewer-sep, .viewer-count { display: none; }
    .viewer-btn { padding: 0 9px; }
    .viewer-stage { padding: 8px; }
    .viewer-nav { width: 38px; height: 38px; }
    .idle-label { display: none; }
    .idle-timer { padding: 0 10px; }
    .only-mobile { display: inline-flex !important; }
    span.only-mobile { display: block !important; }
    .hide-mobile { display: none !important; }
    .topbar { padding: 0 12px; }
    .main { padding: 16px; }
    .user-name { display: none; }
    .stats { grid-template-columns: 1fr; }
    .col-name { max-width: none; }
    .col-name .item-link { max-width: calc(100vw - 150px); }
    .file-table td { height: auto; padding-top: 9px; padding-bottom: 9px; }
    .item-meta { margin-left: 39px; }
    .page-actions .btn span { display: none; }
    .page-actions .btn { padding: 0 11px; }
    .breadcrumb { font-size: 16px; }
    .breadcrumb .is-current { max-width: 60vw; }
    .auth-card { padding: 24px 20px; }
    .action-row { flex-direction: column; align-items: flex-start; }
    .col-actions-wide .btn span { display: none; }
    .col-actions-wide { width: auto; }
    .props { grid-template-columns: 1fr; gap: 2px; }
    .props dd { margin-bottom: 8px; }
    .modal-backdrop { padding-top: 16px; }
    .share-add { flex-wrap: wrap; }
}


/* ==========================================================================
   GLASS — effet verre dépoli, annoncé et assumé.
   Tout l'effet tient ici : fond coloré fixe + panneaux translucides floutés.
   Pour revenir à un design plat, supprimer cette section.
   ========================================================================== */

:root {
    --glass-bg: rgba(255, 255, 255, .58);
    --glass-bg-strong: rgba(255, 255, 255, .84);
    --glass-border: rgba(255, 255, 255, .7);
    --glass-blur: 18px;
    --glass-shadow: 0 8px 32px rgba(31, 52, 96, .14), inset 0 1px 0 rgba(255, 255, 255, .75);
    --surface-2: rgba(255, 255, 255, .45);
    --border: rgba(31, 52, 96, .12);
    --border-strong: rgba(31, 52, 96, .2);
    --radius: 16px;
    --radius-sm: 10px;
}

/* Fond : dégradé + halos colorés fixes, sous tout le contenu */
html { background: #dfe7f5; }
body.app, body.auth {
    background:
        radial-gradient(1200px 800px at 0% 0%, #c8dcff 0%, transparent 60%),
        radial-gradient(900px 700px at 100% 0%, #f3d6ff 0%, transparent 55%),
        radial-gradient(1000px 800px at 100% 100%, #c9f2e6 0%, transparent 55%),
        linear-gradient(135deg, #e6edfb 0%, #eef0fb 50%, #e8f6f2 100%);
    background-attachment: fixed;
    position: relative;
    isolation: isolate;
}
body.app::before, body.app::after, body.auth::before, body.auth::after {
    content: ""; position: fixed; z-index: -1; border-radius: 50%; filter: blur(70px); opacity: .5; pointer-events: none;
}
body.app::before, body.auth::before { width: 460px; height: 460px; left: 18%; top: 12%; background: #7aa7ff; }
body.app::after, body.auth::after { width: 420px; height: 420px; right: 8%; bottom: 6%; background: #b38bff; }

/* Panneaux de verre */
.glass, .card, .file-list, .details, .upload-panel, .auth-card, .user-pages,
.toggle-row, .picker, .checklist, .section-nav a {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
}
.card, .file-list, .details { border-radius: var(--radius); }
.card-highlight { background: rgba(232, 240, 255, .7); border-color: rgba(122, 167, 255, .55); }
.card-danger { border-color: rgba(196, 66, 47, .35); background: rgba(255, 240, 238, .6); }

/* Barre latérale et barre du haut */
.sidebar {
    background: rgba(255, 255, 255, .5);
    border: 0; border-right: 1px solid var(--glass-border);
    box-shadow: 4px 0 30px rgba(31, 52, 96, .08);
}
.topbar {
    background: rgba(255, 255, 255, .42);
    border: 0; border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 24px rgba(31, 52, 96, .06);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    backdrop-filter: blur(20px) saturate(170%);
}
.nav-link:hover { background: rgba(255, 255, 255, .55); }
.nav-link.is-active { background: rgba(255, 255, 255, .82); box-shadow: 0 2px 10px rgba(31, 52, 96, .1); }
.nav-icon { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6); }
.nav-sep { background: rgba(31, 52, 96, .1); }
.storage-meter, .sidebar-toggle { border-color: rgba(31, 52, 96, .08); }
.sidebar-toggle:hover { background: rgba(255, 255, 255, .45); }
.meter { background: rgba(31, 52, 96, .1); }
.meter > span { background: linear-gradient(90deg, #4f8cff, #8a5cff); }
.brand-mark { background: linear-gradient(135deg, #3d7bff, #8a5cff); box-shadow: 0 4px 14px rgba(77, 110, 255, .4); }

/* Champs et boutons */
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number],
input[type=date], input[type=tel], select, textarea {
    background: rgba(255, 255, 255, .7); border-color: rgba(31, 52, 96, .16);
}
input:focus, select:focus, textarea:focus { background: rgba(255, 255, 255, .94); }
.search input { background: rgba(255, 255, 255, .6); border-radius: 99px; }
.btn { background: rgba(255, 255, 255, .65); border-color: rgba(31, 52, 96, .16); }
.btn:hover { background: rgba(255, 255, 255, .92); border-color: rgba(31, 52, 96, .24); }
.btn-primary { background: linear-gradient(135deg, #2f6fe0, #5a4fe0); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(63, 90, 224, .35); }
.btn-primary:hover { background: linear-gradient(135deg, #2560cc, #4b41cc); border-color: transparent; }
.btn-danger { background: linear-gradient(135deg, #d0402c, #b42318); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(180, 35, 24, .3); }
.btn-danger:hover { background: linear-gradient(135deg, #b8351f, #912018); border-color: transparent; }
.btn-danger-ghost:hover { background: rgba(253, 236, 234, .85); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgba(255, 255, 255, .55); }
.icon-btn:hover { background: rgba(255, 255, 255, .6); }
.user-btn:hover { background: rgba(255, 255, 255, .55); }

/* Tableaux et listes posés sur le verre */
.file-list th, .card th { background: transparent; }
.file-list tbody tr:hover td, .card tbody tr:hover td { background: rgba(255, 255, 255, .45); }
.file-list td, .file-list th, .card td, .card th { border-color: rgba(31, 52, 96, .08); }
.activity li, .action-row, .reg-list li, .role-list li, .upload-item, .checklist li { border-color: rgba(31, 52, 96, .08); }
.action-row-top { border-top-color: rgba(31, 52, 96, .08) !important; }
.stat-row > div { background: rgba(255, 255, 255, .5); border-color: var(--glass-border); }
.empty-icon { background: rgba(255, 255, 255, .7); box-shadow: var(--glass-shadow); }
.details-head, .details-preview, .details-actions, .upload-panel-head, .picker-path { border-color: rgba(31, 52, 96, .08); }
.upload-panel-head, .picker-path, .details-preview { background: rgba(255, 255, 255, .4); }

/* Menus, modales, notifications : verre plus opaque pour rester lisible */
.dropdown-menu, .context-menu, .suggestions, .modal {
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    box-shadow: 0 18px 50px rgba(31, 52, 96, .22), inset 0 1px 0 rgba(255, 255, 255, .8);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
}
.modal { border-radius: 20px; }
.modal-backdrop { background: rgba(20, 30, 60, .28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.toast { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.alert { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-radius: var(--radius-sm); }
.alert-success { background: rgba(231, 245, 237, .8); }
.alert-error { background: rgba(253, 236, 234, .82); }
.alert-info { background: rgba(233, 240, 250, .82); }

/* Badge du compte à rebours : vert vitré */
.idle-timer { background: linear-gradient(135deg, rgba(31, 138, 76, .94), rgba(22, 112, 62, .94)); border-color: rgba(255, 255, 255, .35); box-shadow: 0 4px 14px rgba(31, 138, 76, .3); }
.idle-timer.is-warning { background: linear-gradient(135deg, rgba(217, 119, 6, .95), rgba(178, 94, 9, .95)); }

/* Pages d'un utilisateur (administration) : une page par sujet, en pastilles */
.user-pages { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-radius: 14px; margin: 0 0 18px; }
.user-pages a {
    display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px;
    color: var(--text-2); font-weight: 500; font-size: 14px; text-decoration: none !important; white-space: nowrap;
}
.user-pages a:hover { background: rgba(255, 255, 255, .6); color: var(--text); }
.user-pages a.is-active { background: rgba(255, 255, 255, .94); color: var(--accent); box-shadow: 0 2px 10px rgba(31, 52, 96, .12); }
.user-pages a.danger { color: var(--danger); }
.user-pages a.danger.is-active { color: #fff; background: linear-gradient(135deg, #d0402c, #b42318); }
.user-pages .icon { width: 16px; height: 16px; }

/* Onglets d'administration */
.tabs {
    border-bottom: 0; gap: 4px; padding: 6px; border-radius: 14px;
    background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
}
.tab { border-radius: 10px; border-bottom-color: transparent !important; margin-bottom: 0 !important; }
.tab:hover { background: rgba(255, 255, 255, .6); }
.tab.is-active { background: rgba(255, 255, 255, .94); box-shadow: 0 2px 10px rgba(31, 52, 96, .12); }
.section-nav a { border-radius: 99px; }

/* Pages sans connexion */
.auth-card { background: rgba(255, 255, 255, .55); border-radius: 22px; box-shadow: 0 24px 60px rgba(31, 52, 96, .2), inset 0 1px 0 rgba(255, 255, 255, .8); }

/* Navigateurs sans backdrop-filter, ou transparence réduite demandée : blanc presque opaque */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root { --glass-bg: rgba(255, 255, 255, .92); --glass-bg-strong: #fff; }
    .sidebar, .topbar { background: rgba(255, 255, 255, .95); }
}
@media (prefers-reduced-transparency: reduce) {
    :root { --glass-bg: rgba(255, 255, 255, .95); --glass-bg-strong: #fff; }
    .sidebar, .topbar { background: rgba(255, 255, 255, .97); }
}

/* Téléphone : le menu glisse par-dessus le contenu, verre plus opaque */
@media (max-width: 900px) {
    .sidebar { background: rgba(255, 255, 255, .86); }
    .sidebar-backdrop { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
}

/* Barre du haut : flottante, centrée et arrondie en haut de page ; dès que le contenu
   défile jusqu'à elle (classe is-stuck posée par app.js), elle s'étend de façon animée
   sur toute la largeur et se colle en haut. Son contenu reste aligné sur la page. */
.main { margin: 0 auto; }
.topbar {
    top: 12px; margin: 12px auto 0; width: calc(100% - 48px); max-width: 1352px;
    border: 1px solid var(--glass-border); border-radius: 18px;
    background: rgba(255, 255, 255, .55);
    box-shadow: 0 10px 30px rgba(31, 52, 96, .12), inset 0 1px 0 rgba(255, 255, 255, .8);
    transition: top .35s cubic-bezier(.2, .8, .2, 1), width .35s cubic-bezier(.2, .8, .2, 1),
        max-width .35s cubic-bezier(.2, .8, .2, 1), padding .35s cubic-bezier(.2, .8, .2, 1),
        border-radius .35s ease, background-color .35s ease, box-shadow .35s ease, border-color .35s ease;
}
.topbar.is-stuck {
    top: 0; width: 100%; max-width: 100%; border-radius: 0;
    border-color: transparent transparent var(--glass-border);
    padding: 0 max(24px, calc((100% - 1352px) / 2 + 24px));
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 6px 24px rgba(31, 52, 96, .1);
}
@media (max-width: 900px) {
    .topbar { top: 8px; margin-top: 8px; width: calc(100% - 16px); padding: 0 12px; border-radius: 14px; }
    .topbar.is-stuck { top: 0; width: 100%; padding: 0 16px; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .topbar { transition: none; }
}
