/* ============================================================
   cultural-library — frontend/boardgame
   Adopte design system v0 (assistant-conventions/design-system/).
   - Tokens DS structurels chargés via _ds/v0/{tokens,base,layout,card}.css
   - --surface-* = surcharges palette cultural-library (compatibles DS)
   - --r-*, --c-*, --h-* = color bands métier (rating BGG, complexité,
     hype) — non-négociables, encodent du sens domaine. Ne pas migrer
     vers le DS chromatic-less.
   ============================================================ */

:root {
  /* Surcharges DS — palette cultural-library (consommées par base.css + card.css) */
  --surface-color-text:        #1a1a1a;
  --surface-color-bg:          #fafafa;
  --surface-color-card-bg:     #ffffff;
  --surface-color-muted:       #555;
  --surface-color-rule:        #d0d0d0;
  --surface-color-link:        #4c78a8;
  --surface-color-link-hover:  #3a5e85;
  --surface-color-focus:       #4c78a8;
  --surface-color-primary:     #4c78a8;
  --surface-color-header-bg:   transparent;
  --surface-color-footer-bg:   transparent;

  /* Aliases legacy (utilisés dans tout le CSS qui suit — refactor progressif) */
  --fg: var(--surface-color-text);
  --fg-soft: var(--surface-color-muted);
  --fg-muted: #888;
  --bg: var(--surface-color-bg);
  --surface: var(--surface-color-card-bg);
  --accent: var(--surface-color-primary);
  --accent-soft: #e8f0fa;
  --row-alt: #f4f4f4;
  --border: var(--surface-color-rule);
  --border-soft: #e8e8e8;
  --shadow-card: var(--ds-shadow-sm);
  --shadow-card-hover: var(--ds-shadow-lg);

  /* Color bands métier — non-DS, encodent rating/complexité/hype BGG */
  --r-low:    #f7d7d4;
  --r-mid:    #fce6cf;
  --r-good:   #fff2c2;
  --r-high:   #d9efc8;
  --r-top:    #aedea7;

  --c-light:  #e3f2ff;
  --c-medium: #d6e9f9;
  --c-heavy:  #c0d8eb;
  --c-brain:  #9bbedc;

  --h-cold:   #ecf0f3;
  --h-warm:   #ffe5b4;
  --h-hot:    #ffcca0;
  --h-fire:   #ffaf80;
}

/* DS base.css gère déjà box-sizing + body baseline. On override juste
   font-size (notre design utilisait 14px historiquement, pas 16px). */
html, body {
  font-size: 14px;
}

/* ───── Layout sidebar + main ───── */
body.lib-layout {
  margin: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.lib-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  padding: 1em 0.9em;
  display: flex; flex-direction: column;
  gap: 0.9em;
  position: sticky; top: 0;
  max-height: 100vh; overflow-y: auto;
  font-size: 0.92em;
}
.lib-brand {
  font-size: 1.3em; font-weight: 700;
  text-decoration: none; color: var(--fg);
  padding: 0.2em 0.4em;
  border-radius: 5px;
  display: block;
}
.lib-brand:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }

.lib-nav { display: flex; flex-direction: column; gap: 0.15em; }
.lib-nav a {
  padding: 0.45em 0.6em;
  text-decoration: none;
  color: var(--fg-soft);
  border-radius: 5px;
  font-size: 0.95em;
  display: flex; align-items: center; gap: 0.4em;
}
.lib-nav a:hover { background: #f4f4f4; color: var(--fg); text-decoration: none; }
.lib-nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.lib-section { display: flex; flex-direction: column; gap: 0.4em; }
.lib-section-title {
  margin: 0.5em 0 0.1em;
  font-size: 0.72em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}
.lib-actions { gap: 0.3em; }
.lib-link-btn, .lib-action-btn {
  padding: 0.45em 0.7em; font-size: 0.92em;
  border: 1px solid var(--border); background: white;
  border-radius: 5px; cursor: pointer;
  text-decoration: none; color: var(--fg);
  text-align: center;
  display: inline-block;
}
.lib-link-btn:hover, .lib-action-btn:hover { background: #f0f0f0; text-decoration: none; }
.lib-action-btn {
  background: var(--accent); color: white; border-color: var(--accent);
  font-weight: 500;
}
.lib-action-btn:hover { background: #3a5e85; color: white; }
.signin-status {
  padding: 0.3em 0.5em;
  font-size: 0.88em; color: var(--fg-soft);
  font-variant-numeric: tabular-nums;
}
.signin-status.error { color: #b03030; font-weight: 500; }

/* Sort buttons (replace dropdown) */
.sort-buttons { display: flex; flex-direction: column; gap: 0.18em; }
.sort-btn {
  padding: 0.4em 0.7em;
  font-size: 0.92em;
  border: 1px solid var(--border); background: white;
  border-radius: 5px; cursor: pointer;
  text-align: left;
  color: var(--fg-soft);
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.4em;
}
.sort-btn:hover { background: #f4f4f4; color: var(--fg); }
.sort-btn.active {
  background: var(--accent); color: white;
  border-color: var(--accent);
}
.sort-btn .sort-dir { font-weight: 700; min-width: 1em; text-align: right; }

/* Filtres sidebar */
.lib-filter {
  display: flex; align-items: center; gap: 0.4em;
  font-size: 0.92em; color: var(--fg-soft);
}
.lib-filter span { flex: 1; }
.lib-filter input[type=number] {
  width: 4em;
  padding: 0.3em 0.4em; font-size: 0.92em;
  border: 1px solid var(--border); border-radius: 4px;
}
.lib-filter-label {
  margin: 0.5em 0 0.1em;
  font-size: 0.85em; font-weight: 600;
  color: var(--fg-soft);
}
.lib-toggle {
  display: flex; align-items: center; gap: 0.4em;
  font-size: 0.92em; color: var(--fg-soft);
  margin-top: 0.3em;
}
.chips-wrap {
  display: flex; flex-wrap: wrap; gap: 0.3em;
  align-items: center;
}
#added-since {
  padding: 0.35em 0.5em; font-size: 0.92em;
  border: 1px solid var(--border); border-radius: 4px;
  background: white;
}
.lib-reset-btn {
  margin-top: 0.6em;
  padding: 0.45em 0.7em; font-size: 0.9em;
  border: 1px solid var(--border); background: white;
  border-radius: 5px; cursor: pointer;
  color: var(--fg-soft);
}
.lib-reset-btn:hover { background: #f0f0f0; }

.lib-auth-section {
  margin-top: auto;
  padding-top: 0.8em;
  border-top: 1px solid var(--border-soft);
}

/* Main pane */
.lib-main {
  min-width: 0;  /* prevent grid overflow */
  padding: 1.3em 1.5em 2em;
}
.lib-main-header {
  padding-bottom: 1em;
  margin-bottom: 0.8em;
  border-bottom: 1px solid var(--border-soft);
}
.lib-main-header h1 { margin: 0 0 0.3em; font-size: 1.6em; font-weight: 600; }
.lib-main-header p { margin: 0 0 0.7em; color: var(--fg-soft); font-size: 0.95em; }
.lib-search {
  width: 100%; max-width: 480px;
  padding: 0.55em 0.85em; font-size: 1em;
  border: 1px solid var(--border); border-radius: 5px;
}

/* Mobile : sidebar above main (stacked) */
@media (max-width: 768px) {
  body.lib-layout { grid-template-columns: 1fr; }
  .lib-sidebar {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }
  .lib-main { padding: 1em; }
}

.view-toggle {
  display: flex !important; gap: 0 !important;
  border: 1px solid var(--border); border-radius: 5px; overflow: hidden;
}
.view-btn {
  flex: 1;
  padding: 0.45em 0.6em;
  background: white; border: none; cursor: pointer;
  font-size: 0.92em;
  color: var(--fg-soft);
}
.view-btn + .view-btn { border-left: 1px solid var(--border); }
.view-btn:hover { background: #f0f0f0; }
.view-btn.active { background: var(--accent); color: white; }

.chip {
  padding: 0.35em 0.85em;
  border: 1px solid var(--border); background: white;
  border-radius: 16px; font-size: 0.92em;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35em;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.chip:hover { background: #f0f0f0; }
.chip[data-state="incl"] {
  background: #2a7a3a; color: white; border-color: #2a7a3a;
}
.chip[data-state="incl"]:hover { background: #226130; }
.chip[data-state="excl"] {
  background: #fce4e4; color: #b03030; border-color: #e9a9a9;
  text-decoration: line-through;
}
.chip[data-state="excl"]:hover { background: #f9d6d6; }
.chip-icon, .type-icon {
  display: inline-flex; align-items: center;
  line-height: 1;
}
/* Type tag (multi-cat) — petit pill compact pour cards/table/detail */
.type-tag {
  display: inline-flex; align-items: center; gap: 0.2em;
  padding: 0.05em 0.4em;
  border-radius: 10px;
  background: var(--row-alt);
  font-size: 0.85em;
  white-space: nowrap;
}
.type-tag + .type-tag { margin-left: 0.25em; }
.icon {
  width: 1.05em; height: 1.05em;
  vertical-align: -0.18em;
  flex-shrink: 0;
}
.chip .icon { width: 1em; height: 1em; }
.cell-tag .icon { width: 0.95em; height: 0.95em; }

/* Segmented control (played filter) */
.segmented {
  display: inline-flex !important;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  gap: 0 !important;
}
.seg-btn {
  padding: 0.55em 1em;
  background: white; border: none; cursor: pointer;
  font-size: 0.95em;
  color: var(--fg-soft);
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn:hover { background: #f0f0f0; }
.seg-btn.active { background: var(--accent); color: white; }

main { padding: 0.5em 1em 2em; }

.view-container { display: none; }
.view-container.active { display: revert; }
#cards.active { display: grid; }

/* ───── Cards view ───── */
#cards {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2em;
  padding-top: 0.8em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex; flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}
.card-link {
  display: flex; flex-direction: column; flex: 1;
  text-decoration: none; color: inherit;
}

.card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ececec;
  overflow: hidden;
}
/* Background blurred du même image pour combler les bords sans cropper.
   --bg-img injecté en style inline depuis cardHtml(). Approxime visuellement
   la "couleur du pixel de bordure" via une version blur+scale de l'image. */
.card-img-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--bg-img);
  background-size: cover;
  background-position: center;
  filter: blur(18px) saturate(1.05);
  transform: scale(1.15);
  pointer-events: none;
}
.card-img {
  position: relative;
  z-index: 1;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.card-img.placeholder {
  object-fit: contain;
  padding: 22%;
  background: #f4f4f4;
}

.overlay-badge {
  position: absolute;
  top: 0.5em; right: 0.5em;
  z-index: 2;
  padding: 0.18em 0.55em;
  border-radius: 10px;
  font-size: 0.75em;
  font-weight: 600;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.overlay-badge.warn { color: #8a6500; background: #fff3cd; }
.overlay-badge.miss { color: #555; background: rgba(240,240,240,0.95); }

/* Quick action buttons (cards) — visible au hover, ou tap mobile */
.card-quick-actions {
  position: absolute;
  bottom: 0.4em; right: 0.4em;
  z-index: 2;
  display: flex; gap: 0.3em;
  opacity: 0;
  transition: opacity 0.15s;
}
.card:hover .card-quick-actions,
.card-quick-actions:focus-within { opacity: 1; }
.card-quick-actions button {
  width: 2em; height: 2em;
  padding: 0;
  border: 1px solid var(--accent);
  background: rgba(255, 255, 255, 0.95);
  color: var(--accent);
  border-radius: 50%;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.card-quick-actions button:hover {
  background: var(--accent);
  color: white;
}
.card-quick-actions button[disabled] {
  opacity: 0.6; cursor: wait;
}
.quick-validate-btn {
  background: rgba(42, 122, 58, 0.95) !important;
  color: white !important;
  border-color: #2a7a3a !important;
}
.quick-validate-btn:hover { background: #226130 !important; }

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 2em; left: 50%;
  transform: translateX(-50%);
  padding: 0.7em 1.2em;
  background: #2a7a3a; color: white;
  border-radius: 5px;
  font-size: 0.95em;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
  animation: toast-in 0.2s ease-out;
}
.toast.toast-error { background: #b03030; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.card-body {
  padding: 0.7em 0.8em 0.8em;
  display: flex; flex-direction: column; gap: 0.45em;
  flex: 1;
}
.card-title {
  margin: 0;
  font-size: 1.1em;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}
.card-stats {
  display: flex; gap: 0.3em; flex-wrap: wrap;
}
.card-meta {
  display: flex; flex-wrap: wrap;
  gap: 0.2em 0.7em;
  font-size: 0.95em;
  color: var(--fg-soft);
}
.card-meta .best { color: var(--accent); font-weight: 600; }
.card-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.92em;
  color: var(--fg-muted);
  margin-top: auto;
  padding-top: 0.5em;
  border-top: 1px solid var(--border-soft);
}
.card-played { color: var(--accent); font-weight: 500; }

.card.pending { border-color: #ffd986; }
.card.missing { opacity: 0.78; }
.card.missing .card-title { color: #888; }

/* ───── Table view ───── */
table#grid {
  width: 100%; border-collapse: collapse; background: var(--surface);
  font-size: 0.92em;
}
table#grid th, table#grid td {
  padding: 0.45em 0.6em; text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}
table#grid th {
  background: var(--surface); position: sticky; top: 4.4em;
  font-weight: 600; color: var(--fg-soft);
  border-bottom: 2px solid var(--border);
  font-size: 0.85em;
  z-index: 5;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #f4f4f4; }
th.sortable::after {
  content: "";
  display: inline-block;
  margin-left: 0.3em;
  border: 4px solid transparent;
  vertical-align: middle;
  opacity: 0.3;
}
th.sortable.sort-asc::after  { border-bottom-color: var(--accent); margin-bottom: 4px; opacity: 1; }
th.sortable.sort-desc::after { border-top-color: var(--accent); margin-top: 4px; opacity: 1; }

table#grid tbody tr:nth-child(even) { background: var(--row-alt); }
table#grid tbody tr:hover { background: var(--accent-soft); }
td.t { font-weight: 500; max-width: 30ch; white-space: normal; }
td.t a.title-link { color: inherit; text-decoration: none; }
td.t a.title-link:hover { color: var(--accent); text-decoration: underline; }
td.t a.ext { color: var(--accent); text-decoration: none; opacity: 0.7; }
td.t a.ext:hover { opacity: 1; }

.pill {
  display: inline-block; padding: 0.1em 0.5em;
  border-radius: 10px; font-size: 0.85em; line-height: 1.4;
}
.pill.ok   { background: #dff5e2; color: #2a7a3a; }
.pill.warn { background: #fff3cd; color: #8a6500; }
.pill.miss { background: #f0f0f0; color: #777; }

table#grid tbody tr.pending { background: #fffaf0 !important; }
table#grid tbody tr.pending:nth-child(even) { background: #fff5e6 !important; }
table#grid tbody tr.missing td.t { color: #999; }

.cell-tag {
  display: inline-block;
  min-width: 2.4em; text-align: center;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 0.92em;
}
.cell-tag.r-low    { background: var(--r-low); }
.cell-tag.r-mid    { background: var(--r-mid); }
.cell-tag.r-good   { background: var(--r-good); }
.cell-tag.r-high   { background: var(--r-high); }
.cell-tag.r-top    { background: var(--r-top); color: #15521a; }

.cell-tag.c-light  { background: var(--c-light); }
.cell-tag.c-medium { background: var(--c-medium); }
.cell-tag.c-heavy  { background: var(--c-heavy); }
.cell-tag.c-brain  { background: var(--c-brain); color: #1a3556; }

.cell-tag.h-cold   { background: var(--h-cold); color: #999; }
.cell-tag.h-warm   { background: var(--h-warm); }
.cell-tag.h-hot    { background: var(--h-hot); }
.cell-tag.h-fire   { background: var(--h-fire); color: #6b2200; }

.col-img { width: 80px; padding-left: 0.6em; }
.thumb {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #eee;
}
.thumb.placeholder { object-fit: contain; padding: 8px; background: #f4f4f4; }

.empty-state {
  text-align: center; color: var(--fg-muted);
  padding: 3em 1em; font-size: 1em;
}

/* ───── Detail view ───── */
.detail-view {
  max-width: 900px;
  margin: 1em auto;
  padding: 0 1em;
}
.detail-back {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95em;
  margin-bottom: 1em;
}
.detail-back:hover { text-decoration: underline; }

.detail-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.6em;
  margin-bottom: 2em;
}
.detail-cover-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ececec;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.detail-cover {
  width: 100%; height: 100%;
  object-fit: cover;
}
.detail-info { display: flex; flex-direction: column; }
.detail-title-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.6em;
}
.detail-title {
  margin: 0;
  font-size: 1.7em;
  font-weight: 700;
  line-height: 1.2;
  flex: 1;
}
.edit-btn {
  padding: 0.45em 0.9em; font-size: 0.9em;
  border: 1px solid var(--accent); background: white; color: var(--accent);
  border-radius: 5px; cursor: pointer;
  white-space: nowrap;
}
.edit-btn:hover { background: var(--accent); color: white; }
.detail-notes-display {
  margin: 0.8em 0;
  padding: 0.7em 0.9em;
  background: #f8f4eb;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  white-space: pre-wrap;
  font-size: 0.92em;
  color: var(--fg);
}
.detail-subtitle {
  margin: 0.3em 0 1em;
  color: var(--fg-soft);
  font-size: 0.95em;
}
.detail-stats {
  display: flex; flex-wrap: wrap; gap: 0.8em 1.2em;
  margin-bottom: 1.2em;
}
.stat-block {
  display: flex; flex-direction: column; gap: 0.2em;
}
.stat-label {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  font-weight: 600;
}
.cell-tag.big {
  font-size: 1.1em;
  padding: 0.2em 0.6em;
  min-width: 3em;
}

.detail-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4em 1em;
  margin: 0 0 1em;
  font-size: 0.92em;
}
.detail-facts dt {
  color: var(--fg-soft);
  font-weight: 600;
}
.detail-facts dd {
  margin: 0;
}
.detail-facts .best { color: var(--accent); font-weight: 600; }

.detail-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.detail-links a:hover { text-decoration: underline; }

.detail-section {
  margin-top: 2em;
  padding-top: 1.2em;
  border-top: 1px solid var(--border-soft);
}
.detail-section h3 {
  margin: 0 0 0.8em;
  font-size: 1.1em;
  font-weight: 600;
  color: var(--fg-soft);
}

/* Sparklines */
.sparklines {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1em;
}
.sparkline-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.8em 0.9em;
  box-shadow: var(--shadow-card);
}
.sparkline-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.4em;
}
.sparkline-title {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--fg-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sparkline-svg {
  width: 100%; height: 50px;
  display: block;
}
.sparkline-foot {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.78em;
  margin-top: 0.3em;
}
.sparkline-foot .muted { color: var(--fg-muted); }
.sparkline-foot .delta { font-weight: 600; }
.sparkline-foot .delta.up   { color: #2a7a3a; }
.sparkline-foot .delta.down { color: #b03030; }
.sparkline-foot .delta.flat { color: var(--fg-muted); font-weight: 400; }
.sparkline-empty {
  color: var(--fg-muted);
  font-size: 0.85em;
  font-style: italic;
  padding: 1em 0;
  text-align: center;
}

/* Plays list */
.plays-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.4em;
}
.plays-list li {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.3em 0.7em;
  border-radius: 14px;
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
}
.plays-list li.empty {
  background: transparent;
  color: var(--fg-muted);
  font-style: italic;
  padding-left: 0;
}

@media (max-width: 600px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-cover-wrap { max-width: 280px; margin: 0 auto; }
  .detail-title { font-size: 1.4em; }
}

/* ───── Edit modal ───── */
/* `.modal[hidden]` doit explicitement override display:flex — sinon
   l'attribut HTML `hidden` est sans effet et le modal reste visible. */
.modal[hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
}
.modal-content {
  position: relative;
  background: var(--surface);
  padding: 1.5em 1.6em 1.2em;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  max-width: 480px;
  width: calc(100% - 2em);
  max-height: 90vh; overflow: auto;
}
.modal-content h3 {
  margin: 0 0 1em;
  font-size: 1.15em;
  font-weight: 600;
}
.modal-field {
  display: flex; flex-direction: column;
  gap: 0.3em;
  margin-bottom: 1em;
  font-size: 0.92em;
  color: var(--fg-soft);
}
.modal-field span { font-weight: 500; }
.modal-field-link {
  margin-left: 0.5em;
  font-size: 0.85em;
  font-weight: 400;
  color: var(--accent);
  text-decoration: none;
}
.modal-field-link:hover { text-decoration: underline; }
.modal-field select {
  padding: 0.5em 0.7em;
  font-size: 1em;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: inherit;
  background: white;
}
.modal-field input[type="text"],
.modal-field input[list],
.modal-field textarea {
  padding: 0.5em 0.7em;
  font-size: 1em;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: inherit;
}
.modal-field input[type="checkbox"] {
  width: 1.1em; height: 1.1em;
  align-self: flex-start;
}
.modal-field input[type="range"] {
  width: 100%;
}
.modal-field textarea { resize: vertical; min-height: 4em; }
.modal-error {
  margin: 0.5em 0 1em;
  padding: 0.5em 0.7em;
  background: #fce4e4; color: #b03030;
  border-radius: 4px;
  font-size: 0.88em;
}
.modal-error-link {
  color: #7a1f1f;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.modal-error-link:hover { color: #4a0c0c; }
.modal-info {
  margin: 0.5em 0 0.5em;
  padding: 0.5em 0.7em;
  background: #f0f3f8; color: var(--fg-soft);
  border-radius: 4px;
  font-size: 0.85em;
}
.modal-field-required { color: #b03030; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 0.6em;
  margin-top: 0.5em;
}
.modal-actions button {
  padding: 0.55em 1em; font-size: 0.95em;
  border: 1px solid var(--border); background: white;
  border-radius: 5px; cursor: pointer;
}
.modal-actions button:hover { background: #f0f0f0; }
.modal-actions button[type="submit"] {
  background: var(--accent); color: white; border-color: var(--accent);
}
.modal-actions button[type="submit"]:hover { background: #3a5e85; }
.modal-actions button[disabled] { opacity: 0.6; cursor: wait; }

footer {
  padding: 1em; text-align: center; color: var(--fg-soft); font-size: 0.8em;
}

@media (max-width: 600px) {
  #cards { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.8em; }
  .card-title { font-size: 1em; min-height: 2.4em; }
  .card-meta { font-size: 0.85em; }
  .card-footer { font-size: 0.85em; }
  #filters { gap: 0.4em 0.7em; padding: 0.5em 0.7em; }
}

/* ───── Inline edit panel (refactor 2026-05-13, remplace edit-modal) ───── */
.detail-edit-panel {
  margin: 1.5em 0;
  padding: 1.2em 1.4em 1em;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  max-width: 560px;
}
.detail-edit-panel[hidden] { display: none; }
.detail-edit-panel h3 {
  margin: 0 0 0.9em;
  font-size: 1em;
  font-weight: 600;
  color: var(--accent);
}
.detail-edit-panel .modal-field-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.7em;
  margin-bottom: 0.8em;
}
.detail-edit-panel .modal-field-inline span {
  flex: 0 0 auto;
}
.edit-save-status {
  display: inline-block;
  padding: 0.45em 0.8em;
  font-size: 0.9em;
  color: var(--accent);
  font-weight: 500;
}
.edit-save-status.error {
  color: #b03030;
}
