/* MuseWeb - rétro « vieille BDD » + composants soignés */

:root {
  --bg: #ececec;
  --bg-grid: #e4e4e4;
  --surface: #ffffff;
  --version-surface: #e8ebf2;
  --panel: #b7c7e8;
  --panel-strong: #8fa8d6;
  --panel-deep: #6f8bc0;
  --border: #3a3a3a;
  --border-soft: #808080;
  --border-light: #c0c0c0;
  --text: #000000;
  --muted: #333333;
  --go: #1f9a1f;
  --go-hover: #28b028;
  --publish: #d96512;
  --publish-hover: #ef7a28;
  --file: #c02020;
  --mp3: #2fa02f;
  --pdf: #c8a020;
  --error-bg: #fff0f0;
  --error-border: #c02020;
  --focus: #003399;
  --hover-row: #d4dff2;
  --open-row: #c5d4ef;
  --inset: inset 1px 1px 0 #808080, inset -1px -1px 0 #ffffff;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --font: Tahoma, Verdana, "MS Sans Serif", Arial, Helvetica, sans-serif;
  --mono: "Courier New", Courier, monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.35;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: var(--space-3);
}

/* ----- Chrome / topbar ----- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  background: var(--panel-strong);
  border: 1px solid var(--border);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.45);
  padding: 7px 10px;
  margin-bottom: var(--space-2);
}

.brand {
  font-weight: bold;
  font-size: 16px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.brand:hover {
  text-decoration: underline;
}

.brand-logo {
  width: 22px;
  height: 22px;
  display: block;
}

.topbar-meta {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}

.topbar-pseudo {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: bold;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.topbar-pseudo:hover {
  color: #000;
}

/* ----- Panels ----- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.35);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
}

.panel h1,
.panel h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.hint {
  margin: 0 0 var(--space-2);
}

.hint.muted,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.rule {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: var(--space-3) 0;
}

.error,
.flash {
  border: 1px solid var(--border);
  padding: 8px 10px;
  margin-bottom: var(--space-2);
}

.error {
  background: var(--error-bg);
  border-color: var(--error-border);
}

.flash {
  background: #ffffc0;
}

code {
  font-family: var(--mono);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  padding: 0 4px;
}

/* ----- Forms ----- */

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 360px;
}

.stack.wide {
  max-width: 520px;
}

label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-weight: bold;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field-label {
  font-weight: bold;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea,
select {
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 7px 9px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--inset);
  transition: background-color 80ms linear, box-shadow 80ms linear;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="search"]:hover,
textarea:hover,
select:hover {
  background: #fcfcfc;
}

input[type="text"]:focus-visible,
input[type="password"]:focus-visible,
input[type="search"]:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  box-shadow: none;
}

.search-field {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.search-field input {
  width: 100%;
  height: var(--filter-control-h, 34px);
  padding: 0 9px 0 28px;
  box-sizing: border-box;
}

.search-field::before {
  content: "⌕";
  position: absolute;
  left: 8px;
  bottom: 0;
  height: var(--filter-control-h, 34px);
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
}

select {
  min-height: 32px;
  cursor: pointer;
}

.inline-row {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.inline {
  display: inline;
  margin: 0;
}

.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: bold;
  white-space: nowrap;
}

.inline-label select,
.inline-label input {
  font-weight: normal;
}

/* ----- Buttons ----- */

.btn {
  appearance: none;
  border: 2px solid var(--border);
  border-radius: 0;
  background: #d4d0c8;
  color: var(--text);
  font: inherit;
  font-weight: bold;
  padding: 5px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
  user-select: none;
  touch-action: manipulation;
  transition: filter 80ms linear, background-color 80ms linear;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn:active:not(:disabled) {
  filter: brightness(0.97);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.25);
}

.btn-go {
  background: var(--go);
  color: #fff;
}
.btn-go:hover:not(:disabled) {
  background: var(--go-hover);
  filter: none;
}

.btn-publish {
  background: var(--publish);
  color: #fff;
}
.btn-publish:hover:not(:disabled) {
  background: var(--publish-hover);
  filter: none;
}

.btn-file { background: var(--file); color: #fff; }
.btn-mp3 { background: var(--mp3); color: #fff; }
.btn-pdf { background: var(--pdf); color: #000; }

.btn-fav {
  background: #ececec;
  color: #999;
  padding: 4px 7px;
  font-size: 18px;
  line-height: 0;
  min-width: 28px;
  min-height: 28px;
  box-sizing: border-box;
}

.btn-share {
  background: #d8d8d8;
  color: var(--text);
  padding: 4px 7px;
  line-height: 0;
  cursor: pointer;
  transition: none;
  min-width: 28px;
  min-height: 28px;
  box-sizing: border-box;
}

.btn-share .share-ico {
  width: 14px;
  height: 14px;
  display: block;
  cursor: pointer;
  pointer-events: none;
}

.btn-share:hover:not(:disabled) {
  background: #c8c8c8;
  filter: none;
}

.btn-share:active:not(:disabled) {
  filter: none;
}

.btn-share.is-copied,
.btn-share.is-copied:hover:not(:disabled),
.btn-share.is-copied:active:not(:disabled) {
  background: var(--go);
  color: #fff;
  filter: none;
}

.btn-fav.is-on,
.btn-fav.is-on:hover:not(:disabled) {
  background: #f0d0d0;
  color: #c00000;
  filter: none;
}

.btn-fav:hover:not(:disabled) {
  color: #a01010;
  filter: none;
}

.member-admin-list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  border: 1px solid var(--border);
}

.member-admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
}

.member-admin-row:last-child {
  border-bottom: none;
}

.member-admin-row.is-archived {
  opacity: 0.55;
}

.member-admin-row .meta-chip {
  margin-left: 6px;
}

.btn-member {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  background: var(--surface);
  min-height: 52px;
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
}

a.btn-member:hover {
  filter: brightness(0.97);
}

.btn-member strong {
  display: block;
}

.btn-member span {
  display: block;
  font-weight: normal;
  font-size: 12px;
  color: var(--muted);
}

.btn-member-add {
  border-style: dashed;
  background: var(--bg);
  color: var(--muted);
}

.btn-member-add strong {
  color: var(--text);
}

.btn-member-account {
  background: var(--surface);
}

.pseudo-section-title {
  font-size: 14px;
  margin: var(--space-4) 0 var(--space-2);
}

.pseudo-section-title:first-of-type {
  margin-top: var(--space-2);
}

.member-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.member-list form {
  margin: 0;
}

.member-pick-item {
  position: relative;
}

.member-pick-item .btn-member.has-aside {
  padding-right: 36px;
}

.member-pick-archive {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
}

.member-pick-restore {
  margin-top: 4px;
}

.member-pick-item.is-archived .btn-member {
  opacity: 0.55;
}

.member-archived-title {
  font-size: 14px;
  margin: var(--space-3) 0 var(--space-2);
}

/* ----- Toolbars / filters ----- */

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.toolbar.secondary,
.filter-form {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.3);
  padding: 10px;
  gap: 10px;
  align-items: center;
}

.filter-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  --filter-control-h: 34px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.filter-facets {
  display: none;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
  align-items: stretch;
}

.filter-facets.is-open {
  display: flex;
}

.filter-facets-toggle {
  flex-shrink: 0;
  height: var(--filter-control-h, 34px);
  font-size: 12px;
  padding: 0 10px;
}

.filter-facets-dot {
  color: var(--go);
  margin-left: 2px;
  font-size: 10px;
}

.filter-row > .inline-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  font-weight: bold;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-row > .inline-label select {
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
  height: var(--filter-control-h);
  min-height: var(--filter-control-h);
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}

.filter-facet {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.filter-facet-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-facet-label {
  font-weight: bold;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-facet-clear {
  font-size: 11px;
  padding: 1px 6px;
  height: auto;
  min-height: 0;
}

.filter-facet-clear:disabled {
  opacity: 0.4;
  cursor: default;
}

.filter-facet-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 3px 8px 3px 6px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  box-shadow: var(--inset);
  font-weight: normal;
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  user-select: none;
}

.filter-chip:hover {
  background: var(--hover-row);
}

.filter-chip:has(input:checked) {
  background: #e8eef8;
  border-color: var(--panel-deep);
}

.filter-chip input {
  margin: 0;
  cursor: pointer;
  accent-color: var(--panel-deep);
}

.tag-picker {
  border: 1px solid var(--border);
  margin: 0;
  padding: 8px 10px;
  background: var(--surface);
  width: 100%;
  box-sizing: border-box;
  box-shadow: var(--inset);
}

.tag-picker-title,
.tag-new-label {
  display: block;
  font-weight: bold;
  font-size: inherit;
  margin: 0 0 8px;
  line-height: 1.3;
}

.tag-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-new-label {
  margin-top: 10px;
  margin-bottom: 0;
}

.tag-new-label input {
  display: block;
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
}

.tag-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-weight: normal;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.tag-check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.tag-check span {
  display: inline-block;
  border: 1px solid var(--border-soft);
  background: #e8e8e8;
  color: var(--text);
  padding: 4px 9px;
  font-size: 12px;
  line-height: 1.2;
  transition: background-color 80ms linear, border-color 80ms linear, color 80ms linear;
}

.tag-check:hover span {
  background: #dfe7f5;
  border-color: var(--border);
}

.tag-check input:checked + span {
  background: var(--panel-deep);
  border-color: var(--border);
  color: #fff;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.2);
}

.tag-check input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* ----- Fil list / cards ----- */

#fil-results {
  position: relative;
  min-height: 2rem;
}

#fil-results.htmx-request::after {
  content: "…";
  position: absolute;
  top: 8px;
  right: 10px;
  font-family: var(--mono);
  font-weight: bold;
  color: var(--muted);
}

.fil-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--inset);
}

.fil-row-wrap {
  border-bottom: 1px solid var(--border-soft);
}

.fil-row-wrap:last-child {
  border-bottom: none;
}

.fil-row-wrap,
.fil-details,
.fil-details > summary,
.fil-details > summary * {
  cursor: pointer !important;
}

.fil-details > summary {
  list-style: none;
  user-select: none;
}

.fil-details > summary::-webkit-details-marker {
  display: none;
}

.fil-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  transition: background-color 80ms linear;
}

.fil-row-main {
  flex: 1 1 auto;
  min-width: 0;
}

/* Dans le panneau déplié, curseur normal sauf contrôles */
.fil-detail,
.fil-detail * {
  cursor: auto;
}

.fil-detail .btn,
.fil-detail button,
.fil-detail a {
  cursor: pointer;
}

.fil-detail input[type="text"],
.fil-detail textarea {
  cursor: text;
}

@media (max-width: 700px) {
  .fil-row {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .fil-row-main {
    flex: 1 1 calc(100% - 3em);
  }

  .fil-actions {
    order: 3;
    flex: 1 1 100%;
    justify-content: flex-start;
    min-width: 0;
  }

  .fil-meta {
    order: 2;
    flex: 1 1 auto;
    text-align: left;
    margin-left: 0;
  }

  .chevron {
    order: 1;
    margin-left: auto;
  }
}

.fil-row-wrap:hover > .fil-details > summary {
  background: var(--hover-row);
}

.fil-details[open] > summary {
  background: var(--open-row);
  border-bottom: 1px solid var(--border-soft);
}

.fil-title {
  font-weight: bold;
  font-size: 15px;
  min-width: 0;
}

.fil-author {
  font-weight: normal;
  font-size: 13px;
  color: var(--muted);
}

.fil-card-main {
  min-width: 0;
}

.fil-score-desc {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fil-card-edit {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
  cursor: default;
}

.fil-card-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  cursor: default;
}

.fil-card-field input,
.fil-card-field textarea {
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  cursor: text;
}

.btn-card-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  padding: 0;
  border: 1px solid var(--border-soft);
  background: #f0f0f0;
  color: var(--muted);
  opacity: 0.75;
  cursor: pointer;
  box-shadow: var(--inset);
  line-height: 0;
  position: relative;
  top: 0;
}

.btn-card-edit .desc-edit-ico {
  width: 9px;
  height: 9px;
  display: block;
  pointer-events: none;
}

.btn-card-edit:hover {
  opacity: 1;
  color: var(--text);
  background: #e4e4e4;
  filter: none;
}

.fil-meta {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  margin-left: auto;
  text-align: right;
  line-height: 1.35;
  flex: 0 0 auto;
}

.fil-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
}

.fil-actions.is-empty {
  display: none;
}

.chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2em;
  height: 1.5em;
  flex: 0 0 auto;
  color: var(--muted);
}

.chevron::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.15em) rotate(45deg);
  transition: transform 120ms ease;
}

.fil-details[open] > summary .chevron,
.forum[open] > summary .chevron {
  color: var(--text);
}

.fil-details[open] > summary .chevron::before,
.forum[open] > summary .chevron::before {
  transform: translateY(0.15em) rotate(-135deg);
}

.audio-stub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  height: 28px;
  font-size: 11px;
  font-style: italic;
  border: 1px solid var(--border-soft);
  padding: 2px 6px;
  background: #ececec;
  font-family: var(--mono);
  box-sizing: border-box;
}

.audio-stub.muted {
  opacity: 0.55;
}

.fil-audio {
  height: 32px;
  max-width: 220px;
  vertical-align: middle;
}

.version-audio {
  margin: 6px 0 8px;
}

.version-audio .fil-audio {
  max-width: 100%;
  width: 100%;
  height: 32px;
}

/* Masque 0:00 / durée tant que pas lancé (Chromium / Edge / Safari) */
.fil-audio.is-idle::-webkit-media-controls-current-time-display,
.fil-audio.is-idle::-webkit-media-controls-time-remaining-display {
  display: none !important;
}

.forum {
  border: 1px solid var(--border-light);
  background: #fafafa;
  padding: 8px 10px;
}

.forum-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.forum-title::-webkit-details-marker {
  display: none;
}

.forum-title .chevron {
  margin-left: auto;
}

.forum[open] > .forum-title {
  margin-bottom: 8px;
}

.forum-hit-count {
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
  background: #ffffc0;
  border: 1px solid #a0a000;
  padding: 0 5px;
}

.forum-item.is-hit {
  background: #ffffe0;
  border-left-color: #a0a000;
}

.forum-item {
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--panel-deep);
  padding: 6px 8px;
  margin-bottom: 6px;
  background: #fff;
}

.forum-meta {
  display: block;
  font-size: 11px;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 2px;
}

.forum-body {
  white-space: pre-wrap;
}

.forum-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
}

.forum-compose textarea {
  width: 100%;
  min-height: 56px;
  resize: vertical;
}

.description-box {
  margin-bottom: 8px;
}

.description-view {
  min-width: 0;
}

.description-body {
  position: relative;
  min-width: 0;
  word-break: break-word;
}

.description-text {
  white-space: pre-wrap;
}

.description-empty {
  margin: 0;
  font-size: 12px;
  font-style: italic;
}

.description-version .description-body {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  background: #fafafa;
  border: 1px dashed var(--border-light);
  padding: 5px 28px 5px 8px;
}

.description-version .description-body .btn-desc-edit {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
}

.description-version .description-body .desc-edit-ico {
  width: 11px;
  height: 11px;
}

.description-version .description-body.is-empty {
  color: var(--muted);
}

.btn-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  line-height: 0;
  background: #e8e8e8;
  color: var(--muted);
  border: 1px solid var(--border-soft);
  box-shadow: var(--inset);
  cursor: pointer;
}

.btn-icon:hover:not(:disabled) {
  background: #dcdcdc;
  color: var(--text);
  filter: none;
}

.btn-icon:active:not(:disabled) {
  filter: none;
  box-shadow: inset 1px 1px 0 var(--border-soft);
}

.btn-desc-edit .desc-edit-ico {
  width: 13px;
  height: 13px;
  display: block;
  pointer-events: none;
}

.description-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-danger {
  background: #a33;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #c44;
  filter: none;
}

.library-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 12px;
  align-items: start;
}

.library-sidebar {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 8px;
}

.folder-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.folder-item {
  display: flex;
  align-items: stretch;
  gap: 2px;
}

.folder-link {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid transparent;
  color: inherit;
  text-decoration: none;
}

.folder-link:hover {
  background: var(--hover-row);
}

.folder-link.is-active {
  background: var(--open-row);
  border-color: var(--border);
  font-weight: bold;
}

.folder-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.folder-shared-badge {
  margin-left: 4px;
  font-weight: normal;
  color: var(--muted);
  font-family: var(--mono);
}

.folder-shared-opt {
  font-weight: normal;
  margin-top: 2px;
}

.folder-x {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
  align-self: center;
}

.folder-x:hover {
  color: var(--file);
  border-color: var(--border-soft);
  background: var(--surface);
}

.folder-create {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.btn-compact {
  padding: 2px 8px;
  font-size: 12px;
}

.library-main {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px;
  min-height: 240px;
}

.library-main-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.library-main-head h2 {
  margin: 0;
}

.library-main-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.library-main-meta {
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.library-fil-row {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

a.library-fil-row:hover {
  background: #e8e8f0;
}

.library-open-hint {
  margin-left: 8px;
  opacity: 0.55;
  font-family: var(--mono);
}

.playlist-title-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  margin: 0;
  font-weight: normal;
}

.playlist-title-edit input {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: bold;
  font-family: var(--font);
  padding: 4px 8px;
}

.library-edit-head {
  align-items: center;
}

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

.fil-sub {
  font-size: 0.85em;
  margin-top: 2px;
}

.library-empty {
  font-family: var(--mono);
  text-align: center;
  padding: 24px 8px;
  margin: 0;
}

.library-select-list {
  margin-top: 8px;
}

.library-fil-summary {
  cursor: pointer;
}

.library-version-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border-light);
  background: #f3f3f3;
}

.library-version-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
}

.library-version-row:last-child {
  border-bottom: none;
}

.library-version-row.is-selected {
  background: var(--open-row);
}

.library-select-form {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.library-check-label {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px 8px;
  cursor: pointer;
  margin: 0;
  min-width: 0;
  width: 100%;
  text-align: left;
  font-weight: normal;
}

.library-check-label input[type="checkbox"] {
  margin: 0;
  flex-shrink: 0;
}

.library-check-label .library-version-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: normal;
  color: var(--text);
}

.library-version-name {
  color: var(--text);
}

.library-fil-list .library-version-name {
  font-weight: normal;
}

.library-version-meta {
  font-family: var(--mono);
  font-size: 12px;
  flex-shrink: 0;
  white-space: nowrap;
  text-align: left;
}

.grow {
  flex: 1;
}

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

  .forum-compose {
    grid-template-columns: 1fr;
  }

  .fil-audio {
    max-width: 140px;
  }
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 5px;
}

.tag {
  display: inline-block;
  border: 1px solid var(--border-soft);
  background: #d8d8d8;
  color: #000;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 0;
}

/* Obligatoire : certains Chromium/Electron ne replient pas le contenu de <details>. */
.fil-details:not([open]) > .fil-detail {
  display: none;
}

.fil-detail {
  background: var(--panel-strong);
  border-top: 1px solid var(--border);
  padding: 10px;
  animation: detail-in 120ms ease-out;
}

.forum:not([open]) > *:not(summary) {
  display: none;
}

@keyframes detail-in {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

.detail-panel .toolbar {
  margin-bottom: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn-tag {
  background: #5a6a8a;
  color: #fff;
}

.btn-tag:hover:not(:disabled) {
  background: #6b7c9e;
  filter: none;
}

.playlist-pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.version-block {
  border: 1px solid var(--border);
  box-shadow: var(--inset);
  background: var(--version-surface);
  padding: 10px;
  margin-bottom: var(--space-2);
  transition: background 0.35s ease;
}

.version-block.is-shared-target {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  background: #dce4f4;
}

.shared-banner {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--panel-deep);
  color: #fff;
  padding: 3px 8px;
  margin: -10px -10px 8px;
  transition: opacity 0.3s ease;
}

.shared-banner.is-leaving {
  opacity: 0;
}

.version-block:last-child {
  margin-bottom: 0;
}

.version-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.version-head-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.version-when {
  color: var(--muted);
  font-style: italic;
  white-space: nowrap;
}

.version-who {
  white-space: nowrap;
}

.version-arrow {
  color: var(--muted);
  flex-shrink: 0;
  margin: 0 2px;
}

.version-head-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: flex-end;
  flex-shrink: 0;
  align-items: center;
  touch-action: manipulation;
}

.version-actions-files {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  touch-action: manipulation;
}

.version-head-actions .btn {
  padding: 3px 8px;
  font-size: 12px;
}

.version-head-actions .btn-share,
.version-head-actions .btn-fav {
  padding: 4px 7px;
  min-width: 28px;
  min-height: 28px;
}

.version-head-actions .btn-fav {
  font-size: 18px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-light);
  background: #f0f0f0;
  color: var(--muted);
  padding: 1px 5px;
  font-size: 12px;
  font-family: var(--font);
  line-height: 1.3;
  white-space: nowrap;
  max-width: 100%;
}

.meta-chip-job {
  background: #ffffc0;
  border-color: #a0a000;
}

.meta-chip-job-fail {
  background: #f0c0c0;
  border-color: #a04040;
  color: #601010;
}

.job-poll {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
  padding: 4px 6px;
  background: #ffffe8;
  border: 1px solid #c0c080;
}

.job-fail-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: #fce8e8;
  border: 1px solid #c08080;
}

.job-fail-msg {
  display: block;
  margin-top: 2px;
  font-weight: normal;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 4.5em;
  overflow: hidden;
}

.job {
  border: 1px solid var(--border-soft);
  padding: 1px 6px;
  background: #eee;
  font-family: var(--mono);
  font-size: 11px;
}

.job-success { background: #c0e8c0; }
.job-pending { background: #ffffc0; }
.job-failed { background: #f0c0c0; }
.job-running { background: #c0d8f0; }

.meta-chip-key .meta-ico {
  opacity: 0.95;
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Music", var(--font);
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  transform: translateY(-1px) scale(1.15);
  transform-origin: center;
}

.version-title {
  font-weight: bold;
  font-size: 13px;
  margin: 0;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 28ch;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.modal-window {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}

.modal-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
}

.modal-body {
  padding: 10px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-label {
  font-weight: bold;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  color: var(--muted);
}

.tag-pick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.tag-pick-form {
  display: inline;
  margin: 0;
}

.tag-pick {
  cursor: pointer;
  background: #e8eef8;
  border-color: var(--panel-deep);
}

.tag-pick:hover {
  background: var(--panel-strong);
  color: #fff;
}

.tag-on {
  background: var(--panel-deep);
  border-color: var(--border);
  color: #fff;
  opacity: 0.85;
  cursor: pointer;
}

.tag-on:hover,
.tag-remove:hover {
  background: #a03030;
  border-color: #601010;
  color: #fff;
}

.tag-remove {
  cursor: pointer;
  background: #e4e8f0;
}

@media (max-width: 700px) {
  .version-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .version-head-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .version-title {
    max-width: 100%;
    white-space: normal;
  }
}

.htmx-settling {
  opacity: 0.92;
}

.toolbar .hint {
  margin: 0;
}

.stack + .stack {
  margin-top: var(--space-2);
}

/* ----- Login portes / workspaces / admin site ----- */

.login-doors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin: var(--space-3) 0;
}

@media (max-width: 640px) {
  .login-doors-grid {
    grid-template-columns: 1fr;
  }
}

.login-door {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.3);
  padding: var(--space-3);
}

.login-door h2 {
  margin-top: 0;
}

.login-door .btn-go {
  display: inline-block;
  margin-top: var(--space-2);
}

.login-hints {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-soft);
}

.login-hints ul {
  margin: var(--space-1) 0 0;
  padding-left: 1.2em;
}

.passphrase-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.passphrase-row input {
  flex: 1;
  min-width: 0;
}

.passphrase-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.workspace-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.workspace-card {
  margin: 0;
}

.workspace-card .btn-member {
  width: 100%;
  text-align: left;
}

.admin-site-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin: var(--space-3) 0;
}

@media (max-width: 640px) {
  .admin-site-grid {
    grid-template-columns: 1fr;
  }
}

.topbar-badge {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 11px;
  font-weight: bold;
}

.version-tags-ro {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  max-width: 220px;
}
