:root{
  --bg:        #0f1115;  /* fond global */
  --panel:     #151821;  /* panneaux/cartes */
  --text:      #e5e7eb;  /* texte principal */
  --muted:     #9aa0aa;  /* texte secondaire */
  --border:    #293042;  /* bordures discrètes */
  --accent:    #2563eb;  /* bleu primaire */
  --accent-2:  #3b82f6;  /* bleu hover */
  --danger:    #f87171;  /* alerte */
  --success:   #22c55e;  /* succès */
  --chip-bg:   #0b1220;  /* fond chips/tags */
  --chip-br:   #1e2a44;  /* bord chips/tags */
  --chip-tx:   #cfe1ff;  /* texte chips/tags */

  /* Ombres et rayons */
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 12px;

  /* Typo & sizing */
  --font: 16px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial;
  --container-w: 960px;

  /* Liste de resultats */
  --surface: #151823;
  --surface-2: #1c2030;
  --outline: #2a2f3f;
  --focus: #7cc0ff;
  --primary: #5b8cff;
  --primary-600: #3a6ef5;
  --overlay: rgba(10, 12, 18, 0.6);
}

/* ---------- Reset minimal ---------- */
*{ box-sizing:border-box }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font: var(--font);
}

/* ---------- Layout & structure ---------- */
.container{
  max-width:var(--container-w);
  margin:2rem auto;
  padding:0 1rem;
}
.centered{
  display:grid;
  place-items:center;
  min-height:100vh;
}

/* ---------- Header / nav ---------- */
.app-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:1rem 1.25rem;
  background:var(--panel);
  border-bottom:1px solid var(--border);
}
.app-header .title{ font-weight:700 }
.app-header nav{
  display:flex; gap:.75rem; align-items:center;
}
.app-header a{
  color:var(--muted);
  text-decoration:none;
  padding:.35rem .6rem;
  border-radius:8px;
  transition:color .15s ease, background .15s ease;
}
.app-header a:hover{
  color:var(--text);
  background:#12151c;
}

/* ---------- Cards & panels ---------- */
.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:1.25rem;
  margin:1rem 0;
  box-shadow:var(--shadow);
}
.card-title{ font-weight:700; margin-bottom:.25rem }
.card-desc{ color:var(--muted) }

/* Listes de cartes responsives */
.cards{
  list-style:none;
  padding:0; margin:0;
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:1rem;
}

/* ---------- Formulaires ---------- */
label{ display:block; margin:.6rem 0 .35rem; color:var(--muted) }

.input, textarea, select{
  width:100%;
  padding:.65rem .75rem;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0f1218;
  color:var(--text);
  outline:none;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.input:focus, textarea:focus, select:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(37,99,235,.25);
}

/* Checkboxes inline */
label > .input[type="checkbox"]{
  width:auto; margin-right:.5rem; transform:translateY(1px);
}

/* ---------- Boutons ---------- */
.btn{
  appearance:none;
  border:1px solid var(--border);
  background:#0f1218;
  color:var(--text);
  padding:.6rem .9rem;
  border-radius:10px;
  cursor:pointer;
  transition:background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:hover{ background:#12151c }
.btn:active{ transform:scale(.99) }

.btn.primary{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
  font-weight:700;
}
.btn.primary:hover{ background:var(--accent-2); border-color:var(--accent-2) }

.btn.danger{
  border-color:#5c2227; color:var(--danger);
}
.btn.success{
  border-color:#144b2a; color:var(--success);
}

/* ---------- Alertes ---------- */
.alert{
  background:#2a1214;
  border:1px solid #5c2227;
  color:var(--danger);
  padding:.6rem;
  border-radius:10px;
  margin-bottom:.75rem;
}

/* ---------- Tags / chips ---------- */
.tags{ display:flex; gap:.4rem; flex-wrap:wrap; margin-top:.5rem }
.tag{
  background:var(--chip-bg);
  border:1px solid var(--chip-br);
  color:var(--chip-tx);
  padding:.2rem .55rem;
  border-radius:999px;
  font-size:.85rem;
}

/* ---------- QR code block ---------- */
.qrcode{
  display:grid; place-items:center;
  padding:1rem;
  background:#0b1220;
  border:1px dashed #1e2a44;
  border-radius:12px;
}

/* ------- Utilitaires ------- */
.mt-0{ margin-top:0 } .mt-1{ margin-top:.25rem } .mt-2{ margin-top:.5rem } .mt-3{ margin-top:1rem }
.mb-0{ margin-bottom:0 } .mb-1{ margin-bottom:.25rem } .mb-2{ margin-bottom:.5rem } .mb-3{ margin-bottom:1rem }
.flex{ display:flex } .items-center{ align-items:center } .gap-1{ gap:.25rem } .gap-2{ gap:.5rem } .gap-3{ gap:.75rem }

/* ---------- Liens ---------- */
a{ color:#93c5fd }
a:hover{ color:#bfdbfe }

/* ---------- Search --------- */
#tagsContainer .tag {
    background: #e6f0ff;
    color: #007bff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}
#tagsContainer .tag button {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    font-size: 12px;
}

/* ---------- Media queries ---------- */
@media (max-width:640px){
  .app-header{ flex-wrap:wrap; gap:.5rem }
  .app-header nav{ flex-wrap:wrap }
  .container{ padding:0 .75rem }
}

/* ---------- Menu ---------- */
    .menu {
      background: #D7FDF0;
      color: rgb(10, 50, 0);
      border: none;
      border-radius: 4px;
      padding: 10px 15px;
      font-size: 16px;
      cursor: pointer;
      transition: background-color .2s ease;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      user-select: none;
    }
    .menu:hover { background: #B8F0CE; }
    .menu:focus-visible {
      outline: none;
      box-shadow: 0 0 0 3px color-mix(in srgb, #D7FDF0 35%, transparent), 0 0 0 2px #1e1e1e inset;
    }
    #dropdownMenu[popover] {
      position: fixed;
      inset: 60px 20px auto auto;
      margin: 0;
      border: 1px solid #444;
      background: #2c2c2c;
      color: var(--text);
      border-radius: 8px;
      min-width: 240px;
      box-shadow: 0 10px 24px rgba(0,0,0,.35);
      padding: 8px 0;
    }
    .menu-list,
    .menu-list ul {
      list-style: none;
      margin: 0;
      padding: 0;
    }
    .menu-a {
      display: block;
      padding: 10px 14px;
      color: var(--text);
      text-decoration: none;
      font-size: 15px;
      transition: background-color .15s ease, color .15s ease;
    }
    .menu-a:hover,
    .menu-a:focus {
      background: #073B3A;
      color: #fff;
      outline: none;
    }
    .deco {
      background: none;
      border: none;
      width: 100%;
      height: 100%;
      text-align: left;
    }
    .divide {
      margin: 8px 0;
      border: 0;
      border-top: 1px solid #444;
    }
    @supports not selector(:popover-open) {
      #dropdownMenu[popover] { position: relative; }
    }

/* --- Liste de resultats --- */
/* -------- Barre d’action -------- */
.actions {
  position: sticky;
  top: 0;
  z-index: 30;
  display: none; /* affichée quand >=1 checkbox cochée */
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-bottom: 4px solid var(--outline);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);
}
.actions .row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.actions .left, .actions .right {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Select all checkbox stylée comme les autres */
.checkbox-wrap {
  position: relative;
  width: 24px; height: 24px;
  display: inline-flex;
  justify-content: center; align-items: center;
  border: 1.5px solid var(--outline);
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
}
.checkbox {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 16px; height: 16px;
  border-radius: 4px;
  background: transparent;
  outline: none;
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease, transform 80ms ease;
}
.checkbox:hover { box-shadow: 0 0 0 2px rgba(255,255,255,0.08) inset; }
.checkbox:active { transform: translateY(1px); }
.checkbox:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}
.checkbox:checked {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(34,197,94,0.15) inset;
}
.select-all-label {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* -------- Liste -------- */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.item details {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--outline);
  border-radius: 12px;
  overflow: hidden;
  margin: 8px 0;
}
.item details[open] {
  box-shadow: 0 0 0 1px rgba(124,192,255,0.15) inset;
}
summary {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
summary::-webkit-details-marker { display: none; }
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Checkbox par item (réutilise .checkbox-wrap + .checkbox) */
.title-text {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.config-icon {
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center; justify-content: center;
  border: 1px solid var(--outline);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  transition: background 160ms ease, border-color 160ms ease, transform 80ms ease;
}
summary:hover .config-icon {
  background: rgba(255,255,255,0.08);
  border-color: #3a3f52;
}
summary:active .config-icon { transform: translateY(1px); }

/* Panneau */
.panel {
  border-top: 1px solid var(--outline);
  background: rgba(255,255,255,0.03);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  animation: fadeIn 200ms ease;
}
.btn {
  appearance: none;
  border: 1px solid var(--outline);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 80ms ease;
}
.btn:hover { background: rgba(255,255,255,0.08); border-color: #3a3f52; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn.primary {
  border-color: var(--primary-600);
  background: linear-gradient(180deg, rgba(91,140,255,0.20), rgba(91,140,255,0.12));
}
.btn.primary:hover {
  background: linear-gradient(180deg, rgba(91,140,255,0.32), rgba(91,140,255,0.18));
}
.btn.danger {
  border-color: rgba(255,107,107,0.6);
  background: linear-gradient(180deg, rgba(255,107,107,0.20), rgba(255,107,107,0.12));
}
.btn.danger:hover {
  background: linear-gradient(180deg, rgba(255,107,107,0.32), rgba(255,107,107,0.18));
}

/* Tags dans le panneau */
.tags {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: rgba(255,255,255,0.05);
}

/* Overlay + modals */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: var(--overlay);
  z-index: 90;
}
.modal, .confirm {
  display: none;
  position: fixed;
  z-index: 100;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  min-width: 280px;
  max-width: 92vw;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.45);
  padding: 16px;
}
.modal h2, .confirm h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}
.modal .content, .confirm .content {
  color: var(--muted);
  margin-bottom: 12px;
}
.modal .bar, .confirm .bar {
  display: flex; gap: 8px; justify-content: flex-end;
}
.modal input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.modal input[type="text"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Toast */
#toast {
  display: none;
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--outline);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  z-index: 120;
}

/* Anim */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Responsif */
@media (max-width: 640px) {
  summary { gap: 8px; padding: 10px 12px; }
  .title-text { font-size: 0.92rem; }
  .btn { padding: 7px 10px; font-size: 0.88rem; }
}

