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

body {
  font-family: system-ui, sans-serif;
  font-size: 15px;
  background: #f5f5f5;
  color: #1a1a1a;
  height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ── Auth ─────────────────────────────────────────────── */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 1.5rem;
}

.auth-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  width: min(360px, 92vw);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  animation: fadeIn 0.2s ease-in-out;
}

.auth-header {
  margin-bottom: 1.25rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.auth-logo {
  width: 28px;
  height: 28px;
}

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

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeIn 0.35s ease-in-out;
}

.auth-microcopy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0.9rem;
  border-radius: 10px;
  background: #f7f7f7;
  border: 1px solid #eee;
}

.auth-subtitle {
  font-size: 1rem;
  color: #1a1a1a;
  font-weight: 600;
}

.auth-hint {
  font-size: 0.85rem;
  color: #666;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.auth-form label {
  font-size: 0.85rem;
  color: #444;
  font-weight: 600;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon input {
  padding-right: 2.8rem;
}

input.is-valid {
  border-color: #2d8a4a;
}

input.is-invalid {
  border-color: #c0392b;
}

.field-feedback {
  display: none;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  min-height: 1.1em;
}

.field-feedback.is-valid {
  display: flex;
  color: #2d8a4a;
}

.field-feedback.is-invalid {
  display: flex;
  color: #c0392b;
}

.field-status-icon {
  width: 16px;
  height: 16px;
}

.auth-form .toggle-password,
.profile-form .toggle-password {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  padding: 0.2rem;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  color: #666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
  z-index: 2;
}

.toggle-password:hover {
  color: #ccc;
  background: transparent;
}
.toggle-password:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.25);
}
.toggle-password svg,
.toggle-password i[data-lucide] {
  width: 18px;
  height: 18px;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: #555;
}

.input-with-icon input {
  width: 100%;
  padding: 0.6rem 0.8rem 0.6rem 0.8rem;
  padding-right: 2.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
}

.auth-security {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #2d8a4a;
}

.auth-security .icon,
.auth-security [data-lucide] {
  width: 16px;
  height: 16px;
}

.password-strength {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: #555;
}

.strength-meter {
  flex: 1;
  height: 6px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
}

.strength-meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: #c0392b;
  transition: width 0.2s ease-in-out;
}

.password-strength.strength-medium .strength-meter span {
  background: #f39c12;
}

.password-strength.strength-strong .strength-meter span {
  background: #2d8a4a;
}

button {
  padding: 0.6rem 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease-in-out;
}

button:hover {
  background: #f0f0f0;
}
button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
button[disabled]:hover {
  background: white;
}

.btn-primary {
  background: #1a1a1a;
  color: white;
  border-color: #1a1a1a;
}
.btn-primary:hover {
  background: #333;
}

.btn-secondary {
  background: #f5f5f5;
  border-color: #e0e0e0;
}
.btn-secondary:hover {
  background: #eaeaea;
}

.btn-danger-solid {
  background: #c0392b;
  color: white;
  border-color: #c0392b;
}
.btn-danger-solid:hover {
  background: #a93226;
}

.btn-container {
  display: flex;
  justify-content: right;
  align-items: center;
}

.icon {
  width: 16px;
  height: 16px;
}

.auth-form .auth-submit {
  background: #1a1a1a;
  color: white;
  border-color: #1a1a1a;
  display: flex;
  justify-content: center;
  align-items: center;
}

.auth-form .auth-submit:hover {
  background: #333;
}

.auth-submit[disabled],
.auth-submit[disabled]:hover {
  background: #333;
  border-color: #333;
}

.auth-submit {
  position: relative;
  gap: 0.5rem;
}

.auth-submit.is-loading {
  cursor: progress;
  opacity: 0.9;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin 0.8s linear infinite;
}

.auth-submit.is-loading .btn-spinner {
  display: inline-block;
}

.auth-links {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #1a1a1a;
}

.auth-link {
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease-in-out;
}

.auth-link:visited {
  color: #1a1a1a;
}

.auth-link:hover {
  color: #000;
}

.form-error {
  color: #c0392b;
  font-size: 0.85rem;
  min-height: 1.2em;
}

.form-error:empty {
  display: none;
}

/* ── Modals ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease-in-out;
}

.modal {
  width: min(420px, 100%);
  background: white;
  border-radius: 14px;
  border: 1px solid #eee;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease-in-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-header h3 {
  font-size: 1.1rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #ededed;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-body p {
  color: #555;
  line-height: 1.4;
}

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

body.modal-open {
  overflow: hidden;
}

/* ── Avatar modal fullscreen ─────────────────────────────────── */
.avatar-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  pointer-events: none;
}

.avatar-modal:not(.hidden) {
  pointer-events: auto;
}

.avatar-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
}

.avatar-modal-content {
  position: relative;
  max-width: min(90vw, 900px);
  max-height: min(90vh, 90vw);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.85);
  padding: 0.8rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  z-index: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-modal-content img {
  width: 100%;
  height: auto;
  max-height: 90vh;
  border-radius: 12px;
  object-fit: contain;
}

.avatar-modal-close {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.avatar-modal-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

.fade-in-quick {
  animation: fadeIn 0.15s ease-in-out;
}

.fade-out {
  animation: fadeOut 0.3s ease;
}

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

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

/* ── Global Loader ───────────────────────────────────────────── */
.global-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  animation: fadeIn 0.3s ease-in-out;
}

.global-loader.hidden {
  display: none;
}

.loader-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader-text {
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
}

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

/* ── App layout ───────────────────────────────────────── */
#app-screen {
  display: flex;
  height: 100vh;
  position: relative;
}

#sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  flex-shrink: 0;
  transition: all 0.2s ease-in-out;
}

#user-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#user-info:hover {
  background-color: #f8f9fa;
}

#user-info.clickable:active {
  background-color: #e9ecef;
}

#user-info.active {
  background-color: #1a1a1a;
  color: white;
}

#user-info.active .user-meta span {
  color: white;
}

#user-info.active .avatar-fallback {
  background: white;
  color: #1a1a1a;
}

.user-avatar {
  position: relative;
  width: 48px;
  height: 48px;
  margin-bottom: 0.5rem;
}

.profile-avatar {
  cursor: pointer;
}

.profile-avatar.has-avatar {
  cursor: pointer;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #1a1a1a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
}

.avatar-fallback:not(.active) {
  display: none;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.user-meta span {
  font-size: 0.9rem;
  font-weight: 500;
  color: #1a1a1a;
}

/* Styles pour sidebar collapsed */
body.sidebar-collapsed #user-info {
  padding: 0.75rem 0.5rem;
}

body.sidebar-collapsed .user-avatar {
  width: 40px;
  height: 40px;
  margin-bottom: 0;
}

body.sidebar-collapsed .user-meta span {
  display: none;
}

#sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  width: 100%;
}

#sidebar-header .workspace-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #e8e8e8;
  padding-top: 1rem;
  width: 100%;
}

#sidebar-header h2 {
  font-size: 0.9rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
#new-workspace-btn, #mobile-new-workspace-btn .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  font-size: 1.4rem;
  cursor: pointer;
  color: #fff;
  padding: 0 0.25rem;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  transition: all 0.2s ease-in-out;
}

#mobile-new-workspace-btn {
  width: 100%;
  height: 100%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#new-workspace-btn:hover, #mobile-new-workspace-btn:hover .icon {
  transform: translateY(-2px);
  background: #0a0a0a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#workspace-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}
#workspace-list li {
  margin-bottom: 0.25rem;
}

.show-all-workspaces-btn {
  display: block;
  width: calc(100% - 1rem);
  margin: 0.35rem 0.5rem 0.5rem;
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #2563EB;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.show-all-workspaces-btn:hover {
  background: #f5f5f5;
  color: #1D4ED8;
  border-color: #bbb;
}

body.sidebar-collapsed .show-all-workspaces-btn {
  display: none;
}

#sidebar-header .label-short {
  display: none;
}

#sidebar-footer {
  padding: 0.75rem 1rem 0;
  border-top: 1px solid #f0f0f0;
  margin-top: 0.5rem;
}

.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: #f9f9f9;
}

.btn-logout svg {
  width: 18px;
  height: 18px;
}

.sidebar-toggle {
  position: absolute;
  top: 1rem;
  left: 240px;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #e1e1e1;
  background: white;
  color: #555;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s ease-in-out;
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
}

.rotate {
  transform: rotate(180deg);
  transition: transform 0.3s ease;
}

.workspace-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.ws-initials {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f0f0f0;
  color: #555;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.icon-sidebar-toggle {
  font-size: 16px;
  font-weight: bold;
}

body.sidebar-collapsed #sidebar {
  width: 72px;
  transition: all 0.2s ease-in-out;
}
body.sidebar-collapsed #sidebar-toggle {
  left: 72px;
  transition: all 0.2s ease-in-out;
}
body.sidebar-collapsed #user-name {
  display: none;
}
body.sidebar-collapsed #sidebar-header {
  justify-content: center;
}
body.sidebar-collapsed #sidebar-header .label-full {
  display: none;
}
body.sidebar-collapsed #sidebar-header .label-short,
body.sidebar-collapsed #sidebar-header h2 {
  display: inline;
}
body.sidebar-collapsed #new-workspace-btn {
  display: none;
}
body.sidebar-collapsed .workspace-item {
  justify-content: center;
}
body.sidebar-collapsed .workspace-item .ws-name {
  display: none;
}
body.sidebar-collapsed .workspace-item .ws-initials {
  display: flex;
}
body.sidebar-collapsed .btn-logout {
  justify-content: center;
}
body.sidebar-collapsed .btn-logout span {
  display: none;
}
.sidebar-collapsed button#logout-btn.btn-logout {
  width: 50px;
  height: 50px;
  margin-left: -5px;
}

#mobile-bottom-nav {
  display: none;
}

.mobile-bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 900;
  height: 60px;
  border-top: 1px solid #e8e8e8;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.25rem;
  padding: 0 0.5rem;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

.bottom-nav-btn {
  border: none;
  background: transparent;
  flex: 1;
  color: #444;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  cursor: pointer;
  font-size: 0.8rem;
}

.bottom-nav-btn i,
.bottom-nav-btn [data-lucide] {
  width: 20px;
  height: 20px;
}

.bottom-nav-btn.active,
.bottom-nav-btn:hover {
  color: #1a1a1a;
}

@media (max-width: 900px) {
  #mobile-bottom-nav {
    display: flex;
  }

  #mobile-bottom-nav.hidden {
    display: flex !important;
  }

  .mobile-dropdown-wrap {
    position: relative;
    flex: 1;
  }

  .mobile-dropdown {
    position: absolute;
    bottom: 100%;
    left: -50%;
    width: 200px !important;
    max-height: min(260px, 40vh);
    overflow-y: auto;
    padding: 0.35rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.15);
    z-index: 930;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .mobile-workspace-list {
    list-style: none;
    margin: 0.25rem 0 0 0;
    padding: 0;
    border-top: 1px solid #999;
    width: 100%;
  }

  .mobile-workspace-item {
    width: 100%;
    max-width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    color: #272727;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-workspace-item:hover,
  .mobile-workspace-item.active {
    background: #f0f0f0;
  }

  .mobile-show-all-workspaces-item {
    list-style: none;
    width: 100%;
    padding: 0.25rem 0.5rem 0.35rem;
  }

  .mobile-show-all-workspaces-btn {
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #2563EB;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }

  .mobile-show-all-workspaces-btn:hover {
    background: #f5f5f5;
    color: #1D4ED8;
    border-color: #aaa;
  }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.2s ease-in-out;
    z-index: 920;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
  }

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

  #sidebar-toggle {
    display: none;
  }

  #main-content {
    padding-bottom: 70px;
  }

  #mobile-bottom-nav {
    display: flex;
  }

  .label-full {
    display: none !important;
  }

  #workspace-view,
  #page-view,
  #dashboard-view,
  #profile-view {
    margin-bottom: 3rem;
  }
}

.workspace-item {
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 6px;
  margin: 0.1rem 0.5rem;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace-item:hover {
  background: #f5f5f5;
}
.workspace-item.active {
  background: #1a1a1a;
  color: white;
}
.empty-hint {
  padding: 0.5rem 1rem;
  color: #aaa;
  font-size: 0.85rem;
}

/* Style spécifique pour l'état vide des pages partagées */
#shared-page-list .empty-hint {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 2rem;
  color: #888;
  font-size: 1rem;
  font-style: italic;
  border: 2px dashed #e0e0e0;
  border-radius: 12px;
  background: #fafafa;
  margin: 1rem 0;
}

#shared-page-list .empty-hint::before {
  content: "📄";
  display: block;
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ── Main content ─────────────────────────────────────── */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

#empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #aaa;
}

#dashboard-view .period-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.period-btn {
  border: 1px solid #ddd;
  background: #fff;
  color: #333;
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
}

.period-btn.active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

#stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: #fff;
  border: 1px solid #e1e1e1;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.stat-label {
  font-size: 0.85rem;
  color: #666;
}

.stat-trend {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #5b5b5b;
}

.dashboard-chart {
  margin-bottom: 1rem;
}

.dashboard-chart-inner {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 0.8rem;
  min-height: 120px;
  overflow-x: auto;
}

.chart-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.chart-label,
.chart-value {
  font-size: 0.8rem;
  color: #3f3f3f;
}

.chart-bar {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #f0f0f0;
  overflow: hidden;
}

.chart-bar-fill.pages {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #2a8be3;
}

.chart-bar-fill.comments {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #f49635;
}

.dashboard-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.meta-card {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 0.9rem;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
}

.meta-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.top-workspaces-list {
  list-style: decimal inside;
  margin: 0;
  padding: 0;
  color: #333;
}

.top-workspaces-list li {
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

#workspace-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
#workspace-title {
  font-size: 1.4rem;
  flex: 1;
}

#workspace-collab {
  background: white;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.collab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  position: relative;
}

.collab-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-close {
  background: #f0f0f0;
  border: 1px solid #aaa;
  padding: 0.25rem;
  border-radius: 50%;
  cursor: pointer;
  color: #666;
  transition: all 0.2s ease;
  position: absolute;
  right: -2rem;
  top: -2rem;
}

.btn-close:hover {
  background: #e0e0e0;
  color: #333;
}

.btn-close i {
  width: 16px;
  height: 16px;
}

.role-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid #ddd;
  border-radius: 999px;
  background: #fafafa;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Couleurs uniques pour chaque rôle - Harmonie blanc/noir */
.role-badge.owner {
  background: #1a1a1a;
  color: #ffffff;
  border-color: #000000;
}

.role-badge.admin {
  background: #404040;
  color: #ffffff;
  border-color: #2a2a2a;
}

.role-badge.editor {
  background: #666666;
  color: #ffffff;
  border-color: #4a4a4a;
}

.role-badge.viewer {
  background: #f5f5f5;
  color: #1a1a1a;
  border-color: #d0d0d0;
}

.collab-invite {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.form-input {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
}

.form-input input {
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background: #ffffff;
}

.form-input input:focus {
  outline: none;
  border-color: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.form-input input::placeholder {
  color: #999;
}

.collab-invite select {
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.collab-invite select:focus {
  outline: none;
  border-color: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

#invite-btn {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  background: #1a1a1a;
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
}

#invite-btn:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#invite-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#invite-btn i {
  width: 16px;
  height: 16px;
}

#invite-error {
  text-align: center;
  margin: 1rem 0;
  color: #dc2626;
  font-size: 0.875rem;
}

#member-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 0.3rem;
}

/* Responsive pour mobile - grille des membres */
@media (max-width: 768px) {
  #member-list {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
  }

  .member-card {
    padding: 0.875rem;
    gap: 0.625rem;
  }

  .member-avatar {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .member-name {
    font-size: 0.9rem;
  }

  .member-email {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  #member-list {
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }

  .member-card {
    padding: 0.75rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .member-info {
    width: 100%;
    gap: 0.5rem;
  }

  .member-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
  }

  .member-name {
    font-size: 0.875rem;
  }

  .member-email {
    font-size: 0.75rem;
  }

  .member-actions {
    margin-top: 0.5rem;
    width: 100%;
    justify-content: flex-end;
  }

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

/* Member Cards */
.member-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 1rem;
  background: white;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.member-card:hover {
  border-color: #ddd;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1a1a1a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
  position: relative;
  overflow: hidden;
}

.member-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.member-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
}

.member-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.member-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: #1a1a1a;
}

.member-email {
  font-size: 0.85rem;
  color: #666;
}

.member-role {
  font-size: 0.75rem;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

.member-actions button {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

/* ── Partages de pages ───────────────────────────────────── */
.share-modal {
  width: min(620px, 100%);
}

.all-workspaces-modal {
  width: min(520px, 100%);
}

.all-workspaces-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(420px, 55vh);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.all-workspaces-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  min-width: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.all-workspaces-item:hover {
  background: #f5f5f5;
}

.all-workspaces-item.active {
  background: #1a1a1a;
  color: white;
}

.all-workspaces-initials {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f0f0f0;
  color: #555;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.all-workspaces-item.active .all-workspaces-initials {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.all-workspaces-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.all-workspaces-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
}

.all-workspaces-page-indicator {
  flex: 1;
  text-align: center;
  font-size: 0.88rem;
  color: #666;
}

.all-workspaces-pagination .btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.share-form-row input {
  flex: 1;
}

.share-form-row select {
  width: 140px;
}

.share-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.share-total {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #e0e0e0;
  background: #f5f5f5;
  color: #666;
}

.share-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 260px;
  overflow-y: auto;
}

.share-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #fff;
}

.share-item:hover {
  border-color: #ddd;
}

.share-item-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.share-item-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.share-item-email {
  font-size: 0.8rem;
  color: #666;
}

.share-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.share-item-actions select {
  width: 120px;
}

.shared-pages-subtitle {
  color: #666;
  margin-top: -0.75rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

#shared-page-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.shared-page-item {
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.shared-page-item:hover {
  border-color: #ddd;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.shared-page-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1a1a1a;
}
.shared-page-meta {
  font-size: 0.82rem;
  color: #666;
  margin-top: 0.25rem;
}

.shared-page-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.permission-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #ddd;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.permission-badge.read {
  background: #f5f5f5;
  color: #1a1a1a;
  border-color: #d0d0d0;
}

.permission-badge.edit {
  background: #1a1a1a;
  color: #fff;
  border-color: #000;
}

@media (max-width: 768px) {
  .share-form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .share-form-row select {
    width: 100%;
  }

  #shared-page-list {
    grid-template-columns: 1fr;
  }

  .shared-page-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .shared-page-actions {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
  }
}

#page-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.page-item {
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 8px;
  border: 1px solid #eee;
  cursor: pointer;
  font-size: 0.95rem;
}
.page-item:hover {
  border-color: #ccc;
}

#page-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page-header-left {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.75rem;
}

.page-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#page-title-input {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 500;
}

.page-content-container {
  display: flex;
  flex-direction: column;
  position: relative;
  height: calc(100vh - 130px);
  width: 100%;
}

.comments-btn-container {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 10;
}

.comments-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #f0f0f0;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease-in-out;
}

.comments-btn.is-open {
  background: #1a1a1a;
  border-color: #1a1a1a;
}

.comments-btn.is-open .icon {
  color: white;
}

.comments-btn:hover {
  background: #e0e0e0;
  border: 1px solid #999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.comments-btn.is-open:hover .icon {
  color: #1a1a1a;
}

.comments-btn .icon {
  width: 18px;
  height: 18px;
  transition: all 0.3s ease-in-out;
}

/* Responsive pour mobile - bouton de commentaires */
@media (max-width: 768px) {
  .comments-btn-container {
    position: fixed;
    bottom: 5rem !important;
    right: 1rem;
    z-index: 100;
  }

  .comments-btn {
    width: 55px;
    height: 55px;
    background: #1a1a1a;
    border-color: #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .comments-btn:hover {
    background: #333;
  }

  .comments-btn .icon {
    width: 16px;
    height: 16px;
    color: white;
  }
}

@media (max-width: 480px) {
  .comments-btn-container {
    bottom: 0.75rem;
    right: 0.75rem;
  }

  .comments-btn {
    width: 50px;
    height: 50px;
  }

  .comments-btn .icon {
    width: 14px;
    height: 14px;
  }

  .comment-content {
    right: 1rem;
    bottom: 5rem;
  }
}

.comments-count {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  font-size: 0.85rem;
  color: #333;
  border: none;
  background: #a7c7e7;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.comment-content {
  position: absolute;
  bottom: 2.5rem;
  right: 2.5rem;
  width: min(420px, calc(100vw - 136px));
  max-height: 70vh;
  background: white;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: -1;
}

.comment-content .btn-close {
  position: static;
  right: auto;
  top: auto;
}

.comments-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.comments-panel-header h3 {
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.comments-subtitle {
  font-size: 0.8rem;
  color: #777;
}

.comments-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  flex: 1;
  max-height: 240px;
  padding-right: 0.25rem;
}

.comment-item {
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fafafa;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #777;
}

.comment-author {
  font-weight: 600;
  color: #333;
}

.comment-body {
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.comment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.comment-actions button {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

.comment-toggle {
  align-self: flex-start;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.8rem;
  color: #555;
  cursor: pointer;
}

.comment-toggle:hover {
  color: #111;
  text-decoration: underline;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#comment-input {
  min-height: 70px;
  resize: vertical;
}

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

#page-content-input {
  height: 100%;
  width: 100%;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
}

.btn-danger {
  color: #c0392b;
  border-color: #e8a59a;
}
.btn-danger:hover {
  background: #fdf0ee;
}

/* CTA Button for Dashboard */
.dashboard-cta {
  margin: 2rem 0;
  text-align: center;
}

.cta-button {
  background: linear-gradient(135deg, #1a1a1a, #333);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cta-button:hover {
  background: linear-gradient(135deg, #333, #4a4a4a);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cta-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.cta-button .icon {
  width: 20px;
  height: 20px;
}

/* ── Sidebar link ─────────────────────────────────────── */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: calc(100% - 1rem);
  margin: 0;
  padding: 0.5rem 1rem;
  text-align: left;
  border: none;
  border-radius: 6px;
  background: none;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text, #1a1a1a);
}
.sidebar-link:hover {
  background: #f5f5f5;
}
.sidebar-link.active {
  background: #1a1a1a;
  color: white;
}
.sidebar-link.active:hover {
  background: #1a1a1a;
}

body.sidebar-collapsed .sidebar-link {
  width: 100%;
  padding: 0.5rem;
  justify-content: center;
}
body.sidebar-collapsed .sidebar-link .label-full {
  display: none;
}

body.sidebar-collapsed #sidebar-header .workspace-sidebar-header {
  justify-content: center;
}
body.sidebar-collapsed #sidebar-header .workspace-sidebar-header h2 {
  width: 100%;
  text-align: center;
}
body.sidebar-collapsed .workspace-item {
  padding: 0.5rem;
}
.sidebar-link.active {
  background: #1a1a1a;
  color: white;
}

/* ── Dashboard ────────────────────────────────────────── */
.view-title {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
}
.section-title {
  font-size: 1rem;
  color: #888;
  margin: 1.75rem 0 0.75rem;
}

#stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 0.5rem;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
  #stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem 0.75rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .btn-p-sm {
    padding: 0.6rem 1rem !important;
  }

  .btn-container {
    justify-content: center;
    align-items: center;
  }
}

@media (max-width: 480px) {
  #workspace-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  #workspace-title {
    color: #fff;
    background-color: #333;
    padding: .25rem .5rem;
    border-radius: 0.25rem;
  }

  .group-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #000;
  }

  #stats-grid {
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.875rem 0.75rem;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.8rem;
  }
}

.stat-card {
  background: white;
  border-radius: 10px;
  border: 1px solid #eee;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.3s ease-in-out;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-value {
  font-size: 2rem;
  font-weight: 600;
}
.stat-label {
  font-size: 0.85rem;
  color: #888;
}

/* Workspace stats */
.ws-stat-row {
  margin-bottom: 1rem;
}

.ws-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
}
.ws-stat-name {
  font-size: 0.95rem;
  font-weight: 500;
}
.ws-stat-counts {
  font-size: 0.8rem;
  color: #888;
}

.ws-stat-bar-track {
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
}
.ws-stat-bar-fill {
  height: 100%;
  background: #1a1a1a;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Activity feed */
#activity-feed {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 8px;
  border: 1px solid #eee;
}
.activity-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.activity-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.activity-desc {
  font-size: 0.9rem;
}
.activity-meta {
  font-size: 0.8rem;
  color: #888;
}

@media (max-width: 768px) {
  /* Masquer les labels seulement quand la sidebar est collapsed sur mobile */
  body.sidebar-collapsed .label-full {
    display: none;
  }

  /* Assurer que les labels sont visibles quand la sidebar n'est pas collapsed */
  body:not(.sidebar-collapsed) .label-full {
    display: inline;
  }

  #page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header-left {
    width: 100%;
  }

  .page-header-right {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ── Profile ──────────────────────────────────────────── */
#profile-view {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
}

.profile-logout-btn {
  position: absolute;
  top: 0;
  right: 0;
  display: none;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  background: #1a1a1a;
  color: #ffffff;
  border-color: #1a1a1a;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.profile-logout-btn:hover {
  background: #333;
}

@media (max-width: 900px) {
  .profile-logout-btn {
    display: inline-flex;
  }
}

.profile-card {
  background: white;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 2rem;
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-top: -1.8rem;
}

.profile-avatar {
  position: relative;
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  cursor: pointer;
}

.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: 0.35rem;
  max-width: 140px;
}

.profile-avatar-wrap .form-error {
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.3;
}

.profile-avatar-popover {
  position: absolute;
  top: calc(100% + 1.25rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  padding: 0.35rem;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  animation: popIn 0.3s ease-in-out;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
@keyframes popOut {
  from {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
  }
}
.profile-avatar-popover.hidden {
  animation: popOut 0.3s ease-in-out forwards;
}
@keyframes popIn {
  from {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
}

.profile-avatar-popover-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #1a1a1a;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.profile-avatar-popover-item:hover,
.profile-avatar-popover-item:focus-visible {
  background: #f5f5f5;
  outline: none;
}

.profile-avatar-popover-item .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.profile-avatar img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #eee;
}

.avatar-fallback {
  display: none;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: #1a1a1a;
  color: white;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 600;
  position: absolute;
  top: 0;
  left: 0;
}

.avatar-fallback.active {
  display: flex;
}

/* Styles spécifiques pour l'avatar de la sidebar */
.sidebar-avatar-fallback {
  width: 48px !important;
  height: 48px !important;
  font-size: 1.2rem !important;
  background: #1a1a1a !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  border-radius: 50% !important;
}

.sidebar-avatar-fallback.active {
  display: flex !important;
}

/* Styles pour l'état actif du user-info */
#user-info.active .sidebar-avatar-fallback {
  background: white !important;
  color: #1a1a1a !important;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-info h3 {
  font-size: 1.3rem;
  margin: 0;
}

.profile-info p {
  margin: 0;
  color: #666;
  font-size: 0.95rem;
}

.profile-metadata {
  font-size: 0.8rem;
  color: #999;
}

.profile-section {
  background: white;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 1.5rem;
}

.profile-section-title {
  font-size: 1rem;
  margin: 0 0 1rem 0;
  color: #1a1a1a;
  font-weight: 600;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-form .form-input {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-form input {
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background: #ffffff;
}

.profile-form input[type="file"] {
  padding: 0.5rem;
  cursor: pointer;
  color: #555;
}

.profile-form input[type="file"]::file-selector-button {
  padding: 0.5rem 1rem;
  background: #1a1a1a;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-right: 0.5rem;
  transition: all 0.2s ease;
}

.profile-form input[type="file"]::file-selector-button:hover {
  background: #333;
}

.profile-form input:focus {
  outline: none;
  border-color: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.profile-form input::placeholder {
  color: #999;
}

.profile-form .form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a1a;
}

.profile-form .form-error {
  margin: 0;
  color: #c0392b;
  font-size: 0.85rem;
  min-height: 1.2em;
}

.profile-form > button {
  align-self: flex-start;
  padding: 0.75rem 1.5rem;
  background: #1a1a1a;
  color: white;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.profile-form > button:hover {
  background: #333;
  border-color: #333;
}

.profile-form > button:active {
  transform: translateY(1px);
}

@media (max-width: 768px) {
  .profile-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
  }

  .profile-avatar img {
    width: 120px;
    height: 120px;
  }

  .avatar-fallback {
    width: 120px;
    height: 120px;
    font-size: 1.5rem;
  }

  .profile-section {
    padding: 1rem;
  }
}

/* ── Notification Popup ───────────────────────────────────── */
.notification-popup {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 12px 16px;
  min-width: 280px;
  max-width: 400px;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.notification-popup.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification-icon {
  color: #10b981;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

#notification-message {
  font-size: 0.95rem;
  font-weight: 500;
  color: #1a1a1a;
}

/* ── Global loader overlay — API wait indicator ─────────────────── */
.global-loader {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.45);
  backdrop-filter: blur(2px);
  transition: opacity 0.2s ease;
  opacity: 1;
  pointer-events: auto;
}

.global-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.global-loader__box {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dcdcdc;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
  color: #1a1a1a;
  font-size: 0.95rem;
  font-weight: 600;
}

.global-loader__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-top-color: #1a1a1a;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

@media (max-width: 768px) {
  .notification-popup {
    top: 10px;
    min-width: 240px;
    max-width: calc(100vw - 20px);
  }
}
