/* public/assets/style.css — v3.2 (nettoyé + tokens unifiés, sans doublons) */

/* ===============================
   Thèmes & tokens (défaut = dark)
   =============================== */
:root {
  --radius: 12px;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 8px 30px rgba(0, 0, 0, 0.25);
  --ctrl-h: 36px;

  color-scheme: dark;

  /* Base */
  --bg: #0b0c0f;
  --surface: #14161a;
  --surface-2: #181b20;
  --border: #23262d;
  --text: #eef0f3;
  --muted: #9aa3ad;

  --accent: #5b8dff;
  --accent-2: #7aa5ff;

  /* Aliases */
  --bg-1: var(--surface);
  --bg-2: var(--surface-2);

  /* Feedback */
  --success-bg: #11341f;
  --success-br: #1d5a37;
  --danger-bg: #3a171a;
  --danger-br: #6c2a30;
  --warning-bg: #3a2b14;
  --warning-br: #6b4b1d;

  /* Boutons .btn */
  --btn-bg: #171a20;
  --btn-bg-hover: #1d212a;
  --btn-fg: #e5e7eb;
  --btn-border: #2a2f3a;
  --btn-border-hover: #3a4150;
  --btn-shadow: 0 1px 0 rgba(0, 0, 0, 0.5) inset, 0 1px 2px rgba(0, 0, 0, 0.25);

  /* Chips (tokens) */
  --chip-public-fg: #69c16f;
  --chip-public-bg: #132217;
  --chip-public-br: #275a30;
  --chip-private-fg: #9aa3ad;
  --chip-private-bg: #171a1f;
  --chip-private-br: #30343c;

  /* Statuts (tokens) */
  --st-ok-fg: #2ecc71;
  --st-ok-bg: #102415;
  --st-ok-br: #1b5e20;
  --st-upd-fg: #66d9ff;
  --st-upd-bg: #0f1a24;
  --st-upd-br: #1d3b5a;
  --st-warn-fg: #f1c40f;
  --st-warn-bg: #3a2b14;
  --st-warn-br: #6b4b1d;
  --st-err-fg: #ff6b6b;
  --st-err-bg: #3a171a;
  --st-err-br: #6c2a30;
  --st-parser-fg: #ffa94d;
  --st-parser-bg: #2f1e0f;
  --st-parser-br: #6a3c16;
  --st-wall-fg: #c7cdd8;
  --st-wall-bg: #171a1f;
  --st-wall-br: #30343c;
}

/* Light auto (préférence OS) */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f4f6fa;
    --border: #e7eaf0;
    --text: #1a1d23;
    --muted: #6a7380;
    --accent: #3b71ff;
    --accent-2: #5c86ff;

    --bg-1: var(--surface);
    --bg-2: var(--surface-2);

    --success-bg: #e9f7ee;
    --success-br: #cfe9d8;
    --danger-bg: #fdecef;
    --danger-br: #f6cfd5;
    --warning-bg: #fff6e6;
    --warning-br: #fde3b3;

    --btn-bg: #f4f6fa;
    --btn-bg-hover: #eef2f7;
    --btn-fg: #1a1d23;
    --btn-border: #e7eaf0;
    --btn-border-hover: #d9dee8;
    --btn-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset,
      0 1px 2px rgba(0, 0, 0, 0.05);

    /* Chips */
    --chip-public-fg: #1c6f2a;
    --chip-public-bg: #e9f7ee;
    --chip-public-br: #bfe5c7;
    --chip-private-fg: #6a7380;
    --chip-private-bg: #f2f4f9;
    --chip-private-br: #e2e6ee;

    /* Statuts */
    --st-ok-fg: #1b5e20;
    --st-ok-bg: #e9f7ee;
    --st-ok-br: #bfe5c7;
    --st-upd-fg: #0c5db3;
    --st-upd-bg: #ecf3ff;
    --st-upd-br: #c9dcff;
    --st-warn-fg: #7a5500;
    --st-warn-bg: #fff6e6;
    --st-warn-br: #fde3b3;
    --st-err-fg: #b3122f;
    --st-err-bg: #fdecef;
    --st-err-br: #f6cfd5;
    --st-parser-fg: #7a3b00;
    --st-parser-bg: #fff3e6;
    --st-parser-br: #ffe1bf;
    --st-wall-fg: #6a7380;
    --st-wall-bg: #f2f4f9;
    --st-wall-br: #e2e6ee;
  }
}

/* ===============================
   Reset & base
   =============================== */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  /*background:var(--bg);*/
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Dashboard = pas de boutons d’action */
.page-dashboard .card-actions,
.page-dashboard .info-btn,
.page-dashboard .edit-btn {
  display: none !important;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.container {
  max-width: 1080px;
  margin: 32px auto;
  padding: 0 16px;
  padding-bottom: 2rem;
}

/* BLOBS */
/* BLOBS — body doit scroller */
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Les blobs restent fixes au viewport */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* Masque blanc en haut (transition douce) */
.bg-blobs::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    var(--bg) 0%,
    var(--bg) 40%,
    transparent 100%
  );
  z-index: 2;
}

/* Blobs inchangés */
.bg-blobs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.7;
  width: 55vw;
  height: 55vw;
}

.bg-blobs span:nth-child(1) {
  left: -15vw;
  bottom: -15vh;
  background: radial-gradient(circle, #833ab4 0%, transparent 70%);
}

.bg-blobs span:nth-child(2) {
  right: -10vw;
  bottom: -20vh;
  background: radial-gradient(circle, #e1306c 0%, transparent 70%);
}

.bg-blobs span:nth-child(3) {
  right: 10vw;
  bottom: -10vh;
  background: radial-gradient(circle, #f56040 0%, transparent 70%);
}

.bg-blobs span:nth-child(4) {
  left: 20vw;
  bottom: -25vh;
  background: radial-gradient(circle, #fcaf45 0%, transparent 70%);
}

/* ===============================
   Topbar
   =============================== */

@media (min-width: 768px) {
  .topbar nav a {
    margin-left: 12px;
    padding: 6px 10px;
    border-radius: 8px;
  }

  .topbar nav a:hover {
    background: var(--surface-2);
    text-decoration: none;
  }

  .topbar nav a.active {
    background: var(--surface-2);
    border: 1px solid var(--border);
  }
}

/* === TOPBAR GLOBALE === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  padding: 0.5em 1em;
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* === LOGO (gauche) === */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.topbar-logo img {
  height: 32px;
}

/* === MENU (centre) — version desktop === */
.topbar-menu {
  display: flex;
  gap: 1em;
  align-items: center;
}

.topbar-menu a {
  text-decoration: none;
  color: var(--text);
  padding: 0.25em 0.5em;
  border-radius: 6px;
  transition: background 0.3s;
}

.topbar-menu a.active,
.topbar-menu a:hover {
  background: var(--hover);
}

/* === AVATAR (droite) === */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75em;
}

.avatar-link img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

/* === MENU BURGER (mobile) === */
.topbar-toggle {
  display: none;
  font-size: 1.5em;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
}

/* === TEXTE CENTRAL POUR minimal_mode (ex: profiles-app.php) === */
.topbar-center {
  flex: 1;
  text-align: center;
  font-weight: bold;
  font-size: 1.2em;
  color: var(--text);
}

.topbar-left,
.topbar-right {
  flex: 0 0 auto;
}

/* === RESPONSIVE < 768px === */
@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
  }

  .topbar-toggle {
    display: inline-block;
  }

  .topbar-menu {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border);
    z-index: 10;
  }

  .topbar-menu a {
    padding: 1em;
    border-bottom: 1px solid var(--border);
  }

  body.menu-open .topbar-menu {
    display: flex;
  }

  .topbar-center {
    position: relative;
    left: auto;
    transform: none;
    flex: 1;
    text-align: center;
    font-size: 1em;
    font-weight: bold;
  }

  .topbar-left {
    flex: 1;
  }

  .topbar-right {
    order: 3;
    flex: 0 0 auto;
  }
}

/* ===============================
   Headings
   =============================== */
h1 {
  margin: 12px 0 10px;
  font-size: 28px;
  letter-spacing: 0.2px;
}

h2 {
  margin: 14px 0 10px;
  font-size: 20px;
  color: var(--muted);
}

/* ===============================
   Cards & layout
   =============================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /*box-shadow:var(--shadow);*/
  padding: 16px;
  margin: 16px 0;
}

.card-profile {
  display: flex;
  gap: 12px;
  align-items: center;
  transition: transform 0.04s ease;
  position: relative;
}

.card-profile:hover {
  transform: translateY(-1px);
}

.card-profile .fav-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 30;

  background: transparent;
  border: none;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* ===============================
   Coeurs
   =============================== */
.fav-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform-origin: center;
  transition: transform 0.15s ease;
}

.fav-btn:hover {
  transform: scale(1.08);
}

.fav-btn svg {
  display: block;
}

.fav-btn .icon-on,
.fav-btn .icon-off {
  display: none;
  background: none;
}

.fav-btn .icon-on svg,
.fav-btn .icon-off svg {
  width: 28px;
  height: 28px;
  vertical-align: -2px;
  opacity: 0.85;
  display: block;
}

.fav-btn.is-on .icon-on {
  display: inline-block;
}

.fav-btn.is-on .icon-on svg {
  color: red;
}

.fav-btn.is-off .icon-off {
  display: inline-block;
}

/* ===============================
   Formulaires
   =============================== */
label {
  display: block;
  margin: 10px 0 6px;
  font-weight: 600;
}

input,
textarea,
select,
button {
  font: inherit;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in hsl, var(--accent) 25%, transparent);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

/* Bouton formulaire (plein, accent) */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.06s ease, opacity 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

/* Inline forms */
.inline {
  display: inline-block;
  margin-right: 8px;
}

/* ===============================
   Badges / helpers
   =============================== */
.small {
  font-size: 12px;
}

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

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

/* ===============================
   Avatars (cartes + bandeau)
   =============================== */
.card-profile img,
.avatar-lg {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  object-fit: cover;
}

.card-profile img {
  width: 64px;
  height: 64px;
}

.avatar-lg {
  width: 96px;
  height: 96px;
}

/* Bandeau profil (avatar cadré) */
.profile-hero,
.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.profile-hero .left,
.profile-header .left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-wrap {
  width: 96px;
  height: 96px;
  border-radius: 9999px;
  overflow: hidden;
  flex: 0 0 96px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (min-width: 1024px) {
  .avatar-wrap {
    width: 120px;
    height: 120px;
    flex-basis: 120px;
  }
}

.profile-hero .avatar-wrap img,
.profile-header .avatar-wrap img {
  max-width: none;
}

/* ===============================
   Tables
   =============================== */
.table {
  width: 100%;
  border-collapse: collapse;
}

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

.table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

/* Key/Value */
.kv {
  width: 100%;
  border-collapse: collapse;
}

.kv th,
.kv td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.kv th {
  width: 200px;
  color: var(--muted);
}

/* Liste / tableau “Profils” */
.table-list,
.table-bm-list {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 18px;
}

.table-list td,
.table-bm-list td {
  vertical-align: middle;
}

.table-list th,
.table-list td,
.table-bm-list th,
.table-bm-list td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.table-list tr:hover {
  background: var(--bg-1);
  cursor: pointer;
}

.td-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.td-ava {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
}

.table-bm-list td a {
  text-decoration: none;
  color: #000000;
}

.td-bm-ava {
  width: auto;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
}

.td-tags {
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-list .td-visibility {
  min-width: 180px;
}

/* Colonne visibilité */
.table-list .td-visibility .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Chaque chip reste sur une seule ligne */
.table-list .chip {
  white-space: nowrap;
}

/* Colonne actions */
/*.table-list .th-actions {
    width: 1%;
}*/

.table-list .td-actions {
  text-align: right;
  white-space: nowrap;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* Boutons d’action */
.row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #555;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
}

.row-action-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #000;
}

.row-action-btn svg {
  width: 16px;
  height: 16px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

/* lien discret */
.form-actions .back-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.form-actions .back-link:hover {
  text-decoration: underline;
}

/* ===============================
   Alerts
   =============================== */
.alert,
.success,
.warning {
  padding: 10px 12px;
  border-radius: 10px;
  margin: 10px 0;
}

.alert {
  background: var(--danger-bg);
  border: 1px solid var(--danger-br);
}

.success {
  background: var(--success-bg);
  border: 1px solid var(--success-br);
}

.warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-br);
}

/* ===============================
   Toolbar / Search / Icon buttons
   =============================== */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 16px;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  width: 220px;
  max-width: 60vw;
  transition: width 0.2s ease;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  border-radius: 8px;
}

@media (max-width: 640px) {
  .search-input {
    width: 150px;
  }
}

.icon-btn {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  padding: 0.5rem;
  margin: 0 0.25rem;
  transition: background 0.2s ease;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.icon-btn .icon {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}

/* Toolbar globale (collée) */
.actionbar {
  position: sticky;
  top: 56px;
  z-index: 5;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin: 8px 0 12px;
}

/* ===============================
   Dialog
   =============================== */
dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  width: min(520px, 96vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

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

.dialog-header h2 {
  font-size: 16px;
  margin: 0;
}

.dialog-body {
  padding: 16px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.dialog-form label {
  display: block;
  margin: 8px 0;
}

.dialog-form input[type="text"],
.dialog-form input[type="url"],
.dialog-form textarea,
.dialog-form select {
  width: 100%;
}

/* ===============================
   Accessibilité
   =============================== */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===============================
   Snackbar (flash)
   =============================== */
.snackbar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.snackbar.show {
  opacity: 1;
  pointer-events: auto;
}

/* ===============================
   État vide
   =============================== */
.empty {
  text-align: center;
  padding: 28px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty h2 {
  color: var(--text);
  margin: 0 0 6px;
  font-size: 18px;
}

.empty p {
  color: var(--muted);
  margin: 0 0 14px;
}

/* ===============================
   Utilitaires
   =============================== */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.truncate-1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 170px;
  max-width: 100%;
}

.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 3.1em;
}

.card.sticky {
  position: sticky;
  top: 64px;
  z-index: 5;
}

.truncate-fade {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  width: 200px;
  /* largeur que tu veux */
  max-width: 100%;

  /* fade par mask (support Chrome, Safari, Firefox récents) */
  -webkit-mask-image: linear-gradient(
    to right,
    #000 0%,
    #000 70%,
    transparent 100%
  );
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;

  mask-image: linear-gradient(to right, #000 0%, #000 70%, transparent 100%);
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
}

/* ===============================
   Chip — composant de base
   =============================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;

  line-height: 1;
  min-height: 22px;
  white-space: nowrap;
  vertical-align: middle;

  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);

  font-size: 12px;
}

.chip a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
}

.chip a:visited {
  color: inherit;
}

.chip svg {
  width: 14px;
  height: 14px;
  display: block;
  opacity: 0.85;
}

.svg-chips {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  opacity: 0.85;
}

.chips--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ===============================
   Chip — variations
   =============================== */

/* Public */
.chip--public {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--border);
}

.chip--public svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  opacity: 0.85;
  color: var(--chip-public-fg);
}

/* Privé */
.chip--private {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--border);
}

.chip--private svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  opacity: 0.85;
  color: #777265;
}

/* Insta Privé */
.chip-private {
  color: #6e552d !important;
  background-color: #f8f1e1 !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.chip-private svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  opacity: 0.85;
}

/* Inactif */
.chip--disabled {
  color: #d63333 !important;
  background: #f7e4e1 !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.chip--disabled svg {
  width: 12px;
  height: 12px;
  vertical-align: -2px;
  opacity: 0.85;
}

/* A trier */
.chip--sortable {
  color: #795200 !important;
  background: #fff8db !important;
  border-color: #f6c251 !important;
}

.chip--sortable svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  opacity: 0.85;
}

/* Galerie */
.chip--photo {
  color: var(--muted);
  background-color: #d6f5dc !important;
  border-color: var(--border);
}

.chip--photo svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  opacity: 0.85;
}

/* Login */
.chip--login {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--border);
}

.chip--login svg {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

/* ===============================
   Statuts (pilotés par tokens)
   =============================== */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
  line-height: 1;
  vertical-align: middle;
}

.status--ok {
  color: var(--st-ok-fg);
  background: var(--st-ok-bg);
  border-color: var(--st-ok-br);
}

.status--updated {
  color: var(--st-upd-fg);
  background: var(--st-upd-bg);
  border-color: var(--st-upd-br);
}

.status--warn {
  color: var(--st-warn-fg);
  background: var(--st-warn-bg);
  border-color: var(--st-warn-br);
}

.status--error {
  color: var(--st-err-fg);
  background: var(--st-err-bg);
  border-color: var(--st-err-br);
}

.status--parser {
  color: var(--st-parser-fg);
  background: var(--st-parser-bg);
  border-color: var(--st-parser-br);
}

.status--wall {
  color: var(--st-wall-fg);
  background: var(--st-wall-bg);
  border-color: var(--st-wall-br);
}

/* ===============================
   Popover “Légende”
   =============================== */
.legend {
  position: relative;
  display: inline-block;
}

.legend > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.legend[open] > summary {
  background: var(--surface);
}

.legend .legend-card {
  position: absolute;
  right: 0;
  top: 36px;
  z-index: 20;
  min-width: 380px;
  max-width: 96vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

.legend .legend-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.legend .row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.legend .row:last-child {
  border-bottom: 0;
}

.legend .label {
  min-width: 130px;
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
}

@media (max-width: 520px) {
  .legend .legend-card {
    min-width: auto;
    width: calc(100vw - 32px);
    right: 16px;
  }

  .legend .row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .legend .label {
    min-width: 0;
    margin-left: 0;
  }
}

/* ===============================
   Cartes cliquables + anti-tremblement
   =============================== */
a.card-profile,
a.card-profile * {
  text-decoration: none !important;
}

.card,
.card:hover,
a.card-profile,
a.card-profile:hover {
  transform: none !important;
  border-width: 1px;
}

.card-profile img {
  display: block;
}

.card-profile .username,
.card-profile .displayname {
  line-height: 1.2;
}

.card-profile .chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card-profile .chip {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  border: 1px solid var(--border);
}

.card-profile {
  position: relative;
}

.card-profile .stretched-link {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 1;
  border-radius: inherit;
}

a.card-profile:hover {
  /*background: var(--surface-2);*/
  background: #ffffff;
}

:root[data-theme="light"] a.card-profile:hover {
  /*background: var(--surface-2);*/
  background: #ffffff;
}

/* ===============================
   Pagination
   =============================== */
.pagination {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
}

.pagebtn {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  text-decoration: none;
  color: inherit;
}

.pagebtn.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.pagenum {
  opacity: 0.7;
}

/* ===============================
   Actions (profil)
   =============================== */
.actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

a.btn,
a.btn:visited,
button.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  line-height: 1.2;
  border-radius: 10px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  text-decoration: none;
  box-shadow: var(--btn-shadow);
  transition: transform 0.12s ease, background 0.12s ease,
    border-color 0.12s ease, box-shadow 0.12s ease;
  font-weight: 700;
  letter-spacing: 0.2px;
}

a.btn:hover,
button.btn:hover {
  transform: translateY(-1px);
  background: var(--btn-bg-hover);
  border-color: var(--btn-border-hover);
  text-decoration: none;
}

a.btn:active,
button.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  opacity: 0.9;
}

.btn .label {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--danger {
  border-color: #a33;
}

.chip input {
  margin: 0 6px 0 0;
  vertical-align: middle;
}

.cooldown {
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .btn {
    padding: 6px 10px;
  }

  .btn .label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }

  button:hover,
  a.btn:hover {
    transform: none !important;
  }
}

/* ===============================
   Barre de filtres (1 ligne)
   =============================== */
.toolbar-x {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

/* Recherche repliable */
.search-collapsible {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 36px;
  overflow: hidden;
  transition: width 0.18s ease;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 4px;
}

.search-collapsible.open {
  width: min(360px, 60vw);
}

.search-collapsible input {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  width: 100%;
  padding: 6px 6px;
}

.search-collapsible .icon-btn {
  border: 0;
  background: transparent;
}

/* Sélecteurs compacts */
.filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filterbar .compact-input {
  width: 0;
  opacity: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-1);
  transition: width 0.18s ease, opacity 0.18s ease;
}

.filterbar.q-open .compact-input {
  width: 190px;
  opacity: 1;
}

@media (max-width: 700px) {
  .filterbar.q-open .compact-input {
    width: 160px;
  }
}

.filterbar .sel-compact {
  width: auto;
  min-width: 130px;
  height: var(--ctrl-h);
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* Case “Mes profils” harmonisée */
.filterbar .chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--ctrl-h);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  line-height: 1;
  position: relative;
  top: 0;
  transform: translateY(-2px);
}

.filterbar .chip:hover {
  background: var(--surface);
}

.filterbar .chip input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  position: relative;
  top: 0;
  vertical-align: middle;
  accent-color: var(--accent);
  transform: translateY(-0.5px);
}

.filterbar .sel-compact,
.filterbar .compact-input,
.filterbar .icon-btn {
  height: var(--ctrl-h);
}

/* Style par défaut */
.top-bar-app-filter-btn {
  background: #f4f4f4;
  border: none;
  border-radius: 50%;
  padding: 0.5em;
  margin: 0 0.3em;
  transition: all 0.2s ease;
  color: #333;
}

/* Bouton actif — couleurs dégradées inspirées d’Instagram */
.top-bar-app-filter-btn.active {
  background: linear-gradient(
    135deg,
    #f09433,
    #e6683c,
    #dc2743,
    #cc2366,
    #bc1888
  );
  background: -webkit-linear-gradient(
    90deg,
    #f09433,
    #e6683c,
    #dc2743,
    #cc2366,
    #bc1888
  ) !important;
  background: linear-gradient(
    90deg,
    #f09433,
    #e6683c,
    #dc2743,
    #cc2366,
    #bc1888
  ) !important;
  color: white !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.top-bar-app-filter-btn.active * {
  color: white !important;
  fill: white !important;
}

/* Si tu as des icônes SVG ou <i> dedans */
.top-bar-app-filter-btn.active svg,
.top-bar-app-filter-btn.active i,
.top-bar-app-filter-btn.active span {
  color: white !important;
}

.top-bar-app-filter-btn.active img {
  filter: brightness(0) invert(1);
}

.top-bar-app-filter-btn {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ===============================
   THEME OVERRIDES (via data-theme)
   =============================== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0c0f;
  --surface: #14161a;
  --surface-2: #181b20;
  --border: #23262d;
  --text: #eef0f3;
  --muted: #9aa3ad;
  --accent: #5b8dff;
  --accent-2: #7aa5ff;
  --success-bg: #11341f;
  --success-br: #1d5a37;
  --danger-bg: #3a171a;
  --danger-br: #6c2a30;
  --warning-bg: #3a2b14;
  --warning-br: #6b4b1d;
  --bg-1: var(--surface);
  --bg-2: var(--surface-2);

  --chip-public-fg: #69c16f;
  --chip-public-bg: #132217;
  --chip-public-br: #275a30;
  --chip-private-fg: #9aa3ad;
  --chip-private-bg: #171a1f;
  --chip-private-br: #30343c;

  --st-ok-fg: #2ecc71;
  --st-ok-bg: #102415;
  --st-ok-br: #1b5e20;
  --st-upd-fg: #66d9ff;
  --st-upd-bg: #0f1a24;
  --st-upd-br: #1d3b5a;
  --st-warn-fg: #f1c40f;
  --st-warn-bg: #3a2b14;
  --st-warn-br: #6b4b1d;
  --st-err-fg: #ff6b6b;
  --st-err-bg: #3a171a;
  --st-err-br: #6c2a30;
  --st-parser-fg: #ffa94d;
  --st-parser-bg: #2f1e0f;
  --st-parser-br: #6a3c16;
  --st-wall-fg: #c7cdd8;
  --st-wall-bg: #171a1f;
  --st-wall-br: #30343c;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f4f6fa;
  --border: #e7eaf0;
  --text: #1a1d23;
  --muted: #6a7380;
  --accent: #3b71ff;
  --accent-2: #5c86ff;
  --success-bg: #e9f7ee;
  --success-br: #cfe9d8;
  --danger-bg: #fdecef;
  --danger-br: #f6cfd5;
  --warning-bg: #fff6e6;
  --warning-br: #fde3b3;
  --bg-1: var(--surface);
  --bg-2: var(--surface-2);

  --btn-bg: #f4f6fa;
  --btn-bg-hover: #eef2f7;
  --btn-fg: #1a1d23;
  --btn-border: #e7eaf0;
  --btn-border-hover: #d9dee8;
  --btn-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 1px 2px rgba(0, 0, 0, 0.05);

  --chip-public-fg: #1c6f2a;
  --chip-public-bg: #e9f7ee;
  --chip-public-br: #bfe5c7;
  --chip-private-fg: #6a7380;
  --chip-private-bg: #f2f4f9;
  --chip-private-br: #e2e6ee;

  --st-ok-fg: #1b5e20;
  --st-ok-bg: #e9f7ee;
  --st-ok-br: #bfe5c7;
  --st-upd-fg: #0c5db3;
  --st-upd-bg: #ecf3ff;
  --st-upd-br: #c9dcff;
  --st-warn-fg: #7a5500;
  --st-warn-bg: #fff6e6;
  --st-warn-br: #fde3b3;
  --st-err-fg: #b3122f;
  --st-err-bg: #fdecef;
  --st-err-br: #f6cfd5;
  --st-parser-fg: #7a3b00;
  --st-parser-bg: #fff3e6;
  --st-parser-br: #ffe1bf;
  --st-wall-fg: #6a7380;
  --st-wall-bg: #f2f4f9;
  --st-wall-br: #e2e6ee;
}

/* Évite que les badges très longs débordent des cellules de la préview */
.table td .status-badge {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* ===============================
   Page bookmarklet.php
   =============================== */

.bm-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.bm-btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-decoration: none;
}

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

.bm-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.bm-input {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-family: monospace;
}

.tiny {
  font-size: 0.9rem;
  color: var(--muted);
}

/* ===============================
   Page profile.php
   =============================== */

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

.profile-header .left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.avatar-wrap {
  width: 96px;
  height: 96px;
  border-radius: 9999px;
  overflow: hidden;
  flex: 0 0 96px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.title {
  font-size: 22px;
  font-weight: 800;
}

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

.statusline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.actions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.btn,
.secondary {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
}

.btn .label,
.secondary .label {
  margin-left: 6px;
}

.kv {
  width: 100%;
}

@media (max-width: 640px) {
  .avatar-wrap {
    width: 72px;
    height: 72px;
    flex-basis: 72px;
  }

  .title {
    font-size: 18px;
  }

  .btn .label,
  .secondary .label {
    display: none;
  }

  .btn,
  .secondary {
    padding: 6px 8px;
  }

  .actions-wrap {
    gap: 6px;
  }
}

/* ===============================
   Page user.php
   =============================== */

.avatar-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5em;
  margin-bottom: 2em;
  text-align: left;
}

.avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.avatar-forms {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.avatar-form,
.avatar-delete-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em;
  align-items: center;
}

.avatar-form button,
.avatar-delete-form button {
  width: 100%;
  max-width: 280px;
}

/* Responsive mobile */
@media (max-width: 600px) {
  .avatar-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .avatar-forms {
    width: 100%;
    align-items: center;
  }

  .avatar-form,
  .avatar-delete-form {
    flex-direction: column;
    align-items: center;
  }

  .custom-file span {
    width: 100%;
    text-align: center;
  }

  .avatar-img {
    margin-bottom: 1em;
  }

  .file-label {
    width: 100%;
    max-width: 280px;
  }
}

.file-label {
  position: relative;
  overflow: hidden;
  display: inline-block;
  cursor: pointer;
  border-radius: 6px;
  background-color: #e0e7ff;
  color: #1e40af;
  font-size: 0.9em;
  padding: 8px 14px;
  text-align: center;
  transition: background 0.2s ease;
}

.file-label:hover {
  background-color: #c7d2fe;
}

.file-label input[type="file"] {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  height: 100%;
  width: 100%;
  cursor: pointer;
}

/* ===============================
   minimal_mode
   =============================== */

/* === MINIMAL MODE FIX (mobile + centré) === */
@media (max-width: 768px) {
  .topbar.minimal {
    justify-content: center;
    position: relative;
    min-height: 60px;
    /* ← force un cadre suffisant */
    padding-top: 0.5em;
    padding-bottom: 0.5em;
    box-sizing: border-box;
  }

  .topbar.minimal .topbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-weight: bold;
    font-size: 1.2em;
    color: var(--text);
    pointer-events: none;
  }

  .topbar.minimal .topbar-left {
    position: absolute;
    left: 1em;
    top: 50%;
    transform: translateY(-50%);
  }

  .topbar.minimal .topbar-left img {
    height: 32px;
  }

  .topbar.minimal .topbar-right {
    display: none;
  }
}

.topbar-app {
  /*display: inline-flex;*/
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: nowrap;
  padding: 0.5rem 1rem;
  max-width: 100%;
  overflow-x: auto;
}

.topbar-app .search-shell {
  /*margin-right: 1rem;*/
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid #ccc;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  flex-grow: 1;
  min-width: 0;
}

.topbar-app .search-shell input {
  border: none;
  outline: none;
  flex: 1;
  padding-left: 0.5rem;
  font-size: 1rem;
  background: transparent;
}

.topbar-app .search-shell button {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.topbar-app .search-shell svg {
  width: 20px;
  height: 20px;
  stroke: #555;
  stroke-width: 2;
  fill: none;
}

/* Normal : labels visibles */
.btn-filter .label {
  display: inline;
}

.btn-filter {
  /*display: flex;*/
  align-items: center;
  gap: 0.4em;
  padding: 0.4em 0.6em;
  border-radius: 0.5em;
  background: var(--btn-bg, #f0f0f0);
  border: 1px solid var(--btn-border, #ddd);
  font-size: 0.95em;
  color: #333;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-filter.active {
  background: var(--btn-active-bg, #ddd);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.btn-filter img {
  width: 1.2em;
  height: 1.2em;
  display: block;
}

/* Affiche les labels uniquement sur grands écrans */
@media (min-width: 768px) {
  .btn-filter {
    flex-direction: row;
    width: auto;
    height: auto;
    padding: 0.4rem 0.6rem;
    gap: 0.4rem;
  }

  .btn-filter .label {
    display: inline;
    font-size: 0.9rem;
    color: #333;
  }
}

.topbar-app .search-shell .icon-btn {
  height: 42.5px;
  width: 42.5px;
}

.top-bar-app .filters {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.topbar-app button.btn-filter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  background: white;
  border-radius: 999px;
  padding: 0.4rem;
  width: 40px;
  height: 40px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease;
}

.topbar-app button.btn-filter img {
  width: 20px;
  height: 20px;
  display: block;
}

.topbar-app button.btn-filter .label {
  display: none;
  /* on masque sur mobile par défaut */
}

.topbar-app button.btn-filter:hover {
  color: var(--text);
  background: var(--surface);
  transform: translateY(-1px);
}

div#results .card {
  margin: 5px 0;
}

div#results div.username,
div#results div.displayname {
  color: var(--text);
}

/* ===============================
   Bulle d'installation
   =============================== */

.install-bubble {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #ffffffcc;
  backdrop-filter: blur(10px);
  color: #111;
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  line-height: 1.4;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.install-bubble button {
  background: #f0f0f0;
  color: #333;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.install-bubble button:hover {
  background: #e0e0e0;
}

.install-bubble.hidden {
  display: none;
}

/* ===============================
   pull-to-refresh
   =============================== */

#refresh-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  z-index: 999;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: translateY(-60px);
  transition: transform 0.3s ease;
}

#refresh-indicator.visible {
  transform: translateY(0);
}

.spinner {
  border: 4px solid #ccc;
  border-top: 4px solid #333;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
}

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

  100% {
    transform: rotate(360deg);
  }
}

/* ===============================
   Filtres avec icônes SVG dans .topbar-app
   =============================== */

.topbar-app {
  display: flex;
  flex-wrap: nowrap;
  /* NE PAS autoriser le retour à la ligne */
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem;
}

.search-shell {
  flex: 1;
  /* Prend toute la largeur dispo */
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filters {
  display: flex;
  flex-shrink: 0;
  gap: 0.5rem;
}

.filters .btn-filter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--btn-bg, #eee);
  border: none;
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
  transition: background 0.3s;
  width: 44px;
  height: 44px;
  text-align: center;
}

.filters .btn-filter img {
  width: 20px;
  height: 20px;
}

.filters .btn-filter .label {
  display: none;
  /* Cacher le label sur mobile */
}

.filters .btn-filter.active {
  background: var(--accent, #333);
  color: #fff;
}

/* Ordi : montrer le label, changer la disposition */
@media (min-width: 600px) {
  .filters .btn-filter {
    flex-direction: row;
    width: auto;
    height: auto;
    padding: 0.4rem 0.6rem;
  }

  .filters .btn-filter .label {
    display: inline;
    margin-left: 0.5rem;
    font-size: 0.85rem;
  }
}

.filters .btn-filter img {
  cursor: pointer;
}

/* Désactive complètement l'effet de fond bleu au clic */
.filters .btn-filter:active,
.filters .btn-filter:focus:active,
.filters .btn-filter:focus-visible:active {
  background: var(--btn-bg, #eee) !important;
  color: inherit !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Supprime les bordures/effets de focus visuels */
.btn-filter:focus,
.btn-filter:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* ===============================
   TOP-BAR-APP — Barre recherche + filtres
   =============================== */

.top-bar-app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Champ de recherche + bouton loupe */
.top-bar-app-search-shell {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.top-bar-app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.5rem;
  transition: background 0.2s ease;
}

.top-bar-app-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.top-bar-app-btn img {
  width: 20px;
  height: 20px;
}

/* Champ input */
.top-bar-app-search-input {
  border: none;
  background: transparent;
  outline: none;
  padding: 0.5rem 0.75rem 0.5rem 0;
  font-size: 1rem;
  color: var(--text);
  width: 180px;
}

.top-bar-app-search-input::placeholder {
  color: var(--muted);
}

/* Filtres */
.top-bar-app-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
}

.top-bar-app-filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5em;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  border-radius: 50%;
  transition: background 0.3s ease;
  width: 42px;
  height: 42px;
}

#top-bar-app-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5em;
  background: var(--bg-alt);
  transition: background 0.3s ease;
  width: 42px;
  height: 42px;
}

.top-bar-app-filter-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.top-bar-app-filter-btn img {
  width: 20px;
  height: 20px;
  display: block;
  margin: 0 auto;
}

/* Texte visible uniquement sur grand écran */
.top-bar-app-label {
  margin-left: 0.5rem;
  font-size: 0.9rem;
  color: var(--text);
}

@media (min-width: 769px) {
  .top-bar-app-filter-btn {
    flex-direction: row;
    width: auto;
    height: auto;
    border-radius: 999px;
    padding: 0.5em 1em;
  }

  .top-bar-app-filter-btn img {
    margin: 0;
  }
}

@media (max-width: 640px) {
  .top-bar-app-label {
    display: none;
  }

  .top-bar-app-search-input {
    width: 120px;
  }
}

/* Bouton de filtre — style par défaut */
.top-bar-app-filter-btn {
  background: #f4f4f4;
  border: none;
  border-radius: 2em;
  padding: 0.4em 1em;
  margin: 0 0.3em;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.95rem;
  color: #333;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Icones (SVG ou IMG) */
.top-bar-app-filter-btn img,
.top-bar-app-filter-btn svg,
#top-bar-app-search-btn svg {
  width: 1.2em;
  height: 1.2em;
  transition: filter 0.3s ease;
}

/* Texte */
.top-bar-app-label {
  transition: color 0.3s ease;
}

/* Bouton actif — style Instagram */
.top-bar-app-filter-btn.active {
  background: linear-gradient(
    90deg,
    #f09433,
    #e6683c,
    #dc2743,
    #cc2366,
    #bc1888
  );
  color: white !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Icônes SVG ou IMG actives */
.top-bar-app-filter-btn.active img {
  filter: brightness(0) invert(1);
}

/* Texte actif */
.top-bar-app-filter-btn.active .top-bar-app-label {
  color: white !important;
}

.top-bar-app-filter-btn,
.top-bar-app-filter-btn img,
.top-bar-app-filter-btn .top-bar-app-label {
  transition: all 0.2s ease;
}

.top-bar-app-filter-btn,
#top-bar-app-search-btn {
  color: black;
}

.top-bar-app-filter-btn.active {
  color: white;
}

/* Taille normale par défaut (desktop) */
.top-bar-app-filter-btn svg,
#top-bar-app-search-btn svg {
  display: inline-block;
  /* ou block */
  width: 20px !important;
  height: 20px !important;
}

/* Taille augmentée uniquement sur mobile */
@media screen and (max-width: 768px) {
  .top-bar-app-filter-btn svg #top-bar-app-search-btn svg {
    width: 30px !important;
    height: 30px !important;
  }
}

/* ===============================
   Bouton "+" et modale (profiles-app.php)
   =============================== */

/* Bouton flottant */
.floating-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  font-size: 28px;
  color: white;
  background-color: #007bff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  cursor: pointer;
}

/* Modale de base */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 20px;
  max-width: 400px;
  width: 90%;
  border-radius: 10px;
  position: relative;
  text-align: center;
}

.close-btn {
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 24px;
  cursor: pointer;
}

.status-text {
  margin-top: 15px;
  font-size: 14px;
  color: #555;
}

@media (max-width: 768px) {
  #add-profile-btn {
    display: flex !important;
    width: 48px;
    height: 48px;
    bottom: 96px;
    font-size: 26px;
  }
}

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

/* ===============================
   DARK THEME FIXES
   =============================== */

/* 1) Boutons d'actions (profiles.php) */
[data-theme="dark"] .icon-btn {
  background: #202225;
  border: 1px solid #2c2f36;
  color: #e9e9ec;
}

[data-theme="dark"] .icon-btn:hover {
  background: #272a2f;
  border-color: #363a44;
}

[data-theme="dark"] .btn {
  background: #1f2125;
  border: 1px solid #2c2f36;
  color: #e9e9ec;
}

[data-theme="dark"] .btn.secondary {
  background: #181a1e;
  border-color: #2a2d34;
  color: #d7d7db;
}

[data-theme="dark"] .btn.secondary.btn--danger {
  background: #2b1b1b;
  border-color: #4a2a2a;
  color: #ffd7d7;
}

/* 2) WebApp – filtres en haut (profiles-app.php) */
[data-theme="dark"] .top-bar-app-filter-btn {
  background: #1d1f24;
  border: 1px solid #2a2d34;
  color: #e9e9ec;
}

[data-theme="dark"] .top-bar-app-filter-btn.active {
  /* ton pill “actif” lisible sur fond sombre */
  background: linear-gradient(90deg, #ff7a18, #af002d 70%);
  border-color: transparent;
  color: #fff;
}

/* Icône loupe (image noire) => visible sur fond sombre */
[data-theme="dark"] .top-bar-app-btn img,
[data-theme="dark"] .icon-btn .icon,
[data-theme="dark"] .icon-btn svg {
  filter: invert(1);
}

/* Champ de recherche de la WebApp */
[data-theme="dark"] .top-bar-app-search-input {
  background: #101215;
  border: 1px solid #2a2d34;
  color: #f1f1f1;
}

[data-theme="dark"] .top-bar-app-search-input::placeholder {
  color: #9aa0a6;
}

/* Petites pastilles/chips dans les cartes (cohérence) */
[data-theme="dark"] .chip {
  background: #23262b;
  border-color: #2f333a;
  color: #e0e0e3;
}

[data-theme="dark"] .chip--public {
  color: #a8ffcc;
}

[data-theme="dark"] .chip--private {
  color: #ffd48a;
}

/* WebApp : champ de recherche sans cadre interne */
.top-bar-app-search-input {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none;
  color: inherit;
}

.top-bar-app-search-input::placeholder {
  color: inherit;
  opacity: 0.6;
}

/* Focus accessible : halo sur le conteneur plutôt que l'input */
.top-bar-app-search-shell:focus-within {
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.35) inset;
  border-radius: 999px;
}

/* Profiles (desktop) — rendre la loupe visible en dark mode */
#q-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* important: tracer la loupe avec la couleur du bouton */
#q-btn svg path,
#q-btn svg circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* contraste en sombre */
[data-theme="dark"] .filterbar #q-btn {
  color: rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] .filterbar #q-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

[data-theme="dark"] #q-btn {
  color: #fff;
}

/* Loupe de la barre de filtres */
#q-btn {
  color: inherit;
}

/* suit le thème */
#q-btn svg * {
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2;
}

/* En sombre : s'assure d'un blanc lisible */
[data-theme="dark"] #q-btn {
  color: #fff;
}

/* --- Dark: n'inverser que les icônes <img class="icon">, pas les SVG inline --- */
[data-theme="dark"] .top-bar-app-btn img,
[data-theme="dark"] .icon-btn .icon {
  filter: invert(1);
}

[data-theme="dark"] .icon-btn svg {
  filter: none !important;
  /* stoppe l'inversion sur la loupe inline */
}

/* Loupe : traits = currentColor, pas de remplissage */
#q-btn svg * {
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2;
}

/* Couleur de la loupe selon le thème */
[data-theme="dark"] #q-btn {
  color: #fff;
}

html:not([data-theme="dark"]) #q-btn {
  color: #111;
}

/* Tagify – cohérence dark */
[data-theme="dark"] .tagify {
  --tags-border-color: #2c2f36;
  --tags-hover-border-color: #363a44;
  --tags-focus-border-color: #0a84ff;
  --tag-bg: #23262b;
  --tag-hover: #2b2f36;
  --tag-text-color: #e9e9ec;
  --tag-remove-bg: #3a3f48;
  --input-color: #e9e9ec;
  --placeholder-color: #9aa0a6;
  background: #1a1c20;
  border-color: var(--tags-border-color);
}

/* ===============================
   Album privé
   =============================== */

.private-album {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.photo-item {
  position: relative;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-item .mini-delete {
  position: absolute;
  top: 4px;
  right: 4px;
}

.photo-item .mini-delete button {
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #fff;
  padding: 4px 6px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
}

.upload-private-photo {
  margin-top: 10px;
  margin-bottom: 25px;
}

.upload-private-photo input[type="file"] {
  margin: 5px 0;
}

/* ===============================
   Lightbox - Globale
   =============================== */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);

  font-size: 48px;
  line-height: 1;

  color: #fff;
  background: none;
  border: none;
  outline: none;
  padding: 20px;

  cursor: pointer;
  opacity: 0.7;

  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

.lightbox-nav:hover,
.lightbox-nav:focus {
  opacity: 1;
  transform: translateY(-50%);
  outline: none;
}

.lightbox-nav:hover {
  transform: translateY(-50%) scale(1.05);
}

.lightbox-nav.prev {
  left: 10px;
}

.lightbox-nav.next {
  right: 10px;
}

/* ===============================
   MODALE PREVIEW
   =============================== */

.profile-modal.hidden {
  display: none;
}

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.profile-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.profile-modal__panel {
  position: relative;
  background: #111;
  color: #fff;
  max-width: 720px;
  width: 92%;
  max-height: 90vh;
  margin: 5vh auto;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.profile-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  opacity: 0.7;
}

.profile-modal__close:hover {
  opacity: 1;
}

.profile-modal__content {
  padding: 20px;
  overflow-y: auto;
}

.profile-modal h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.profile-modal h2 span {
  font-weight: normal;
  opacity: 0.6;
  font-size: 16px;
}

/* galerie (pour plus tard) */
.pm-gallery {
  margin-top: 16px;
}

.notes-box{
  background: var(--surface-2);
  color: var(--muted);
  border:1px solid rgba(0,0,0,.12);
  border-radius:8px;
  padding:10px 12px;
  white-space:pre-wrap;
  font-size:12px;
  line-height:1.35;
  max-height: 160px;
  overflow: auto;
}

/* ===============================
   Conteneur des actions
   =============================== */

.page-profiles .card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 20;

  /* caché par défaut */
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Affichage AU SURVOL de la carte */
.page-profiles .card-profile:hover .card-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Boutons ronds */
.page-profiles .card-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.12);

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  cursor: pointer;
  box-shadow: none;
  color: #555;
}

.page-profiles .card-action-btn:hover {
  background: #f2f2f2;
  color: #000;
}

.page-profiles .card-action-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
}

img.pm-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.pm-title-wrap h2 {
  color: #fff;
}

#pm-notes-wrap h3 {
    color: #fff;
}

.profile-modal .pm-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 12px;

  max-height: 40vh;
  overflow-y: auto;
  padding-right: 4px;
}

.profile-modal .pm-gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

/* ===============================
   HEADER PAGE
   =============================== */

.container > .card {
  width: 100%;
}

/* ===============================
   PROFILE PAGE
   =============================== */

/* iOS-like switch (paramétrable) */
.ios-switch {
  --w: 94px;
  --h: 32px;
  --pad: 2px;
  --knob: calc(var(--h) - 2 * var(--pad));
  position: relative;
  display: inline-flex;
  align-items: center;
  width: var(--w);
  height: var(--h);
  border-radius: var(--h);
  background: #ddd;
  border: 1px solid #ccc;
  cursor: pointer;
  padding: var(--pad);
  transition: background 0.2s ease, border-color 0.2s ease;
  user-select: none;
  overflow: hidden;
}

.ios-switch .knob {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  width: var(--knob);
  height: var(--knob);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.ios-switch.on {
  background: #0a84ff;
  border-color: #0a84ff;
}

.ios-switch.on .knob {
  transform: translateX(calc(var(--w) - (2 * var(--pad)) - var(--knob)));
}

.ios-switch .labels {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  color: #333;
}

.ios-switch .labels span {
  width: 50%;
  text-align: center;
  opacity: 0.45;
  transition: opacity 0.2s;
}

.ios-switch.on .labels span:last-child {
  opacity: 1;
  color: #fff;
}

.ios-switch:not(.on) .labels span:first-child {
  opacity: 1;
}

.ios-switch.on .labels span:first-child {
  color: #e8f2ff;
}

.ios-switch[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
}

.vis-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropzone {
  position: relative;
  border: 2px dashed #888;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  color: #666;
}

.dropzone:hover {
  border-color: #0a84ff;
  background: rgba(10, 132, 255, 0.05);
}

.dropzone.dragover {
  border-color: #0a84ff;
  background: rgba(10, 132, 255, 0.12);
}

.dropzone p {
  margin: 0;
  font-size: 14px;
}

.dropzone span {
  font-size: 12px;
  color: #999;
}

.drop-preview {
  display: none;
  margin-top: 10px;
  text-align: center;
}

.dropzone.has-preview {
  padding: 12px;
}

.drop-preview img {
  max-width: 100%;
  max-height: 220px;
  display: block;
  margin: 0 auto;
  border-radius: 10px;
  object-fit: contain;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.drop-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.drop-preview img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.photo-item.dragging {
  opacity: 0.4;
}

.photo-item {
  cursor: grab;
}

.photo-item:active {
  cursor: grabbing;
}

/* ===============================
   PROFILES PAGE
   =============================== */

/* mini styles */
.fav-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  pointer-events: auto;
}

.card-profile {
  position: relative;
}

.stretched-link {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.td-user {
  position: relative;
}

.td-user .fav-btn {
  position: static;
  margin-right: 8px;
  font-size: 18px;
}

/* inactif : look grisé */
.card-profile.inactive {
  filter: grayscale(100%);
  opacity: 0.65;
}

.table-list tr.inactive {
  opacity: 0.65;
}

/* Bouton "remonter" */
.scroll-top-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-color, #ff4f70);
  color: white;
  border: none;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  font-size: 22px;
  display: none;
  z-index: 99;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-top-btn.show {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  opacity: 1;
  transform: translateY(-3px);
}

.snackbar {
  position: fixed !important;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999 !important;
  background: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translate(-50%, 20px);
  transition: all 0.4s ease;
}

.snackbar.show {
  opacity: 0.95;
  transform: translate(-50%, 0);
}

#snackbar.success {
  background: #28a745;
  /* vert */
}

#snackbar2.error {
  background: #d33;
  /* rouge */
}

.hidden {
  display: none;
}

/* ===== Dropdown filtres par tags ===== */
.dropdown-filter {
  position: relative;
}

/* bouton déjà géré par .icon-btn */

#tag-filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;

  min-width: 220px;
  max-height: 320px;
  overflow: hidden;

  background: var(--card-bg, #fff);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);

  padding: 10px;
  z-index: 1000;
}

.tag-list {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Liste des tags */
.tag-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 14px;
  cursor: pointer;
}

.tag-checkbox:hover {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
}

/* Zone boutons */
.filter-buttons {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  background: var(--card-bg, #fff);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Boutons sobres */
.filter-buttons button {
  flex: 1;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: transparent;
  cursor: pointer;
  color: #000;
}

.filter-buttons button svg {
  width: 18px;
  height: 18px;
}

.filter-buttons button:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* ===============================
   PROFILES-APP PAGE
   =============================== */

.card-profile {
  position: relative;
}

.card-profile.inactive {
  opacity: 0.6;
  filter: grayscale(100%) contrast(0.9);
  transition: all 0.3s ease;
}

/* === Icône favori (WebApp) === */
.app-fav {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-fav svg {
  width: 25px;
  height: 25px;
  display: block;
}

.chip-inactive {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 5;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #2b2b2b;
  border: 1px solid #3a3a3a;
  color: #ffadad;
}

/* ====== Top bar: search + filters sur UNE SEULE ligne ====== */
.top-bar-app {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.top-bar-app-search-shell {
  flex: 1 1 auto;
  min-width: 0;
}

.top-bar-app-filters {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.top-bar-app-filters::-webkit-scrollbar {
  display: none;
}

.top-bar-app-filter-btn #top-bar-app-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 40px;
  border-radius: 999px;
  background: #f6f6f6;
  border: 1px solid #eee;
  color: inherit;
  flex: 0 0 auto;
}

.top-bar-app-filter-btn.active {
  background: #eaeaea;
  border-color: #ddd;
}

.top-bar-app-filter-btn svg,
.top-bar-app-filter-btn img,
#top-bar-app-search-btn svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 600px) {
  .top-bar-app {
    gap: 8px;
  }

  .top-bar-app-filter-btn,
  #top-bar-app-search-btn {
    width: 30px;
    height: 30px;
    padding: 5px;
    justify-content: center;
  }

  .top-bar-app-label {
    display: none;
  }

  .top-bar-app-search-input {
    font-size: 14px;
    padding: 10px 12px 10px 36px;
  }
}

@media (max-width: 380px) {
  .top-bar-app-filter-btn,
  #top-bar-app-search-btn {
    width: 36px;
    height: 36px;
  }
}

.loading {
  text-align: center;
  margin-top: 1rem;
  color: #999;
  font-size: 14px;
}

.loading::after {
  content: "⏳";
  display: inline-block;
  margin-left: 6px;
  animation: spin 1s linear infinite;
}

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

  to {
    transform: rotate(360deg);
  }
}

/* ===============================
   Bouton "remonter"
   =============================== */

.scroll-top-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  /* 🔽 en bas de page */
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-color, #ff4f70);
  color: white;
  border: none;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  font-size: 22px;
  display: none;
  opacity: 0;
  pointer-events: none;
  z-index: 98;
  /* sous le bouton + */
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-top-btn.show {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  pointer-events: auto;
}

.scroll-top-btn:hover {
  opacity: 1;
  transform: translateY(-3px);
}

/* ===============================
   Bouton d’ajout
   =============================== */

.floating-btn {
  position: fixed;
  right: 16px;
  bottom: 88px;
  /* 🔼 relevé pour ne pas chevaucher ↑ */
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-color, #3b82f6);
  color: white;
  border: none;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  font-size: 32px;
  z-index: 99;
  /* au-dessus du bouton ↑ */
  transition: transform 0.2s ease, opacity 0.3s ease;
}

.floating-btn:hover {
  transform: translateY(-3px);
  opacity: 0.95;
}

#preview {
  display: none;
  gap: 12px;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
}

#preview img.td-ava {
  width: 64px;
  /* 🟢 plus grand qu’avant (souvent 32px) */
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

/* ---- Ajustements mobiles pour la modale ---- */
@media (max-width: 600px) {
  #add-profile-modal .modal-content {
    width: 90%;
    max-width: 400px;
    padding: 16px;
  }
}

#preview {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

#preview img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}

#preview .username {
  font-size: 16px;
  font-weight: 600;
  margin-top: 4px;
}

#preview .displayname {
  font-size: 14px;
  color: #666;
}

#pv-url {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0095f6;
  text-decoration: none;
  font-size: 13px;
}

#pv-url img {
  width: 16px;
  height: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12px;
  margin-top: 6px;
}

/* ===============================
   Preview ajout profil (WebApp)
   =============================== */

#preview.card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  max-width: 100%;
}

#preview .td-ava {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

#preview .username {
  font-weight: 600;
  font-size: 14px;
}

#preview .displayname {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.2;
}

#preview a.tiny {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
}
