/* =========================================================================
   Cartes Pokémon — thème clair (défaut) + sombre.
   Style sobre/tech : surfaces nettes, bordures grises, accent rouge Pokémon.
   ========================================================================= */

:root,
[data-theme="light"] {
  --page: #eceef1;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --surface-3: #eceef1;
  --text: #1b1f27;
  --muted: #6c7480;
  --line: #e2e5ea;
  --line-strong: #d2d6dd;

  --primary: #e3350d;        /* rouge Pokémon */
  --primary-hover: #c52d0b;
  --primary-soft: #fdecea;
  --on-primary: #ffffff;
  --accent: var(--primary);

  --header-bg: #e3350d;
  --header-text: #ffffff;

  --good: #2fa84f;
  --shadow: 0 1px 3px rgba(16, 24, 40, .09), 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --gold-bg: #fff6e0;
  --gold-text: #8a6500;
  --gold-line: #e8d27a;

  --radius: 10px;
  --radius-sm: 8px;
}

[data-theme="dark"] {
  --page: #0e1016;
  --surface: #171a22;
  --surface-2: #1d212b;
  --surface-3: #252a36;
  --text: #e7eaf0;
  --muted: #98a1b1;
  --line: #2a2f3b;
  --line-strong: #38404f;

  --primary: #ff4a32;
  --primary-hover: #ff6555;
  --primary-soft: #2a1411;
  --on-primary: #ffffff;
  --accent: var(--primary);

  --header-bg: #c42d0b;
  --header-text: #ffffff;

  --good: #3ac46b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  --gold-bg: #2c2410;
  --gold-text: #f0c94a;
  --gold-line: #5a4a1a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--page);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Barre du haut (header rouge) ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  height: 58px;
  background: var(--header-bg);
  color: var(--header-text);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .12), var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 18px; flex: 1 1 0; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: 1 1 0; justify-content: flex-end; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
/* Logo : une pile (éventail) de cartes */
.brand .logo {
  position: relative; width: 24px; height: 27px; border-radius: 3px;
  background: #fff; color: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), 0 1px 2px rgba(0, 0, 0, .35);
}
.brand .logo::before, .brand .logo::after {
  content: ""; position: absolute; inset: 0; border-radius: 3px; background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), 0 1px 2px rgba(0, 0, 0, .3);
  transform-origin: bottom center;
}
.brand .logo::before { transform: rotate(-14deg) translateX(-2px); }
.brand .logo::after { transform: rotate(14deg) translateX(2px); }
.brand h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: .2px; }
.brand h1 small {
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  background: rgba(255, 255, 255, .22);
  padding: 2px 6px; border-radius: 5px; vertical-align: middle; margin-left: 5px;
}

.tabs { display: flex; gap: 3px; background: rgba(0, 0, 0, .14); padding: 3px; border-radius: 9px; }
.tab {
  border: none; background: transparent; color: rgba(255, 255, 255, .82);
  padding: 7px 14px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600;
  font-family: inherit;
}
.tab:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

.search-wrap { flex: 0 1 480px; }
#search {
  width: 100%; padding: 8px 13px; border-radius: 8px;
  border: 1px solid transparent; background: rgba(255, 255, 255, .96);
  color: #1b1f27; font-size: 13.5px; outline: none; font-family: inherit;
}
#search::placeholder { color: #8b93a0; }
#search:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.toggle {
  font-size: 12.5px; color: rgba(255, 255, 255, .92);
  display: flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap;
}
.toggle input { accent-color: #fff; }

/* Boutons dans le header : contour blanc translucide */
.topbar .btn {
  cursor: pointer; font-family: inherit;
  border: 1px solid rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .1);
  color: #fff; padding: 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
}
.topbar .btn:hover { background: #fff; color: var(--primary); border-color: #fff; }
.topbar .icon-btn { padding: 7px 9px; font-size: 14px; line-height: 1; }

/* Boutons génériques (hors header) */
.btn {
  cursor: pointer; font-family: inherit;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  padding: 8px 13px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.ghost { background: transparent; }
.btn.add-copy { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.add-copy:hover { background: var(--primary-hover); color: #fff; }

/* ---------- Layout ---------- */
.layout { display: flex; height: calc(100vh - 58px); }
.sidebar {
  width: 282px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto; padding: 14px;
}
.content { flex: 1; overflow-y: auto; padding: 22px 26px 64px; }

/* ---------- Stats globales ---------- */
.stats-global {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.stats-global .big { font-size: 23px; font-weight: 800; color: var(--primary); letter-spacing: -.5px; }
.stats-global .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.bar { height: 7px; border-radius: 4px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--good); border-radius: 4px; }

/* ---------- Filtres catalogue (rareté / type) ---------- */
#catalog-filters { display: flex; gap: 8px; margin-bottom: 6px; }
.cat-filter { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.cat-filter label { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; padding-left: 2px; }
.cat-filter select {
  width: 100%; padding: 7px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 12.5px; font-family: inherit;
}
.cat-filter select:focus { outline: none; border-color: var(--primary); }

/* ---------- Navigation séries / sets ---------- */
.serie-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); padding: 12px 6px 5px; font-weight: 700;
}
.set-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
  color: var(--text); border: 1px solid transparent;
}
.set-link:hover { background: var(--surface-2); }
.set-link.active { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.set-link .set-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-link .set-count { font-size: 11px; color: var(--muted); flex-shrink: 0; display: flex; align-items: center; gap: 5px; }
.set-link.active .set-count { color: rgba(255, 255, 255, .85); }
.set-link .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }

/* ---------- En-tête du contenu ---------- */
.content-head { margin-bottom: 18px; }
.content-head h2 { margin: 0 0 5px; font-size: 22px; letter-spacing: -.4px; }
.content-head .meta { color: var(--muted); font-size: 13px; display: flex; gap: 16px; flex-wrap: wrap; }
.content-head .setlogo { height: 44px; margin-bottom: 8px; }

/* ---------- Grille de cartes ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 15px; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform .1s, box-shadow .1s, border-color .1s; box-shadow: var(--shadow);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.card.owned { border-color: var(--good); box-shadow: 0 0 0 1px var(--good), var(--shadow); }
.card .imgwrap { aspect-ratio: 245 / 342; background: var(--surface-3); display: flex; align-items: center; justify-content: center; }
.card img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card .caption { padding: 7px 9px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.card .caption { padding-bottom: 4px; }
.card .cname { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .cnum { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.card .card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 9px 9px;
}
.card .foot-price { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.rarity-chip {
  font-size: 10px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 7px; border-radius: 10px; max-width: 86px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cm-tag {
  font-size: 8.5px; font-weight: 800; letter-spacing: .5px;
  background: var(--primary); color: #fff; padding: 1px 4px; border-radius: 4px; flex-shrink: 0;
}
.cm-price { font-size: 12.5px; font-weight: 700; color: var(--text); }
.cm-price.none { color: var(--muted); font-weight: 400; }
.cm-line {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted);
  margin-bottom: 12px;
}
.cm-line b { color: var(--text); font-size: 15px; }
.cm-hint { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.card .qty-badge {
  position: absolute; top: 7px; right: 7px; background: var(--good); color: #fff;
  font-weight: 800; font-size: 12px; min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px; box-shadow: var(--shadow);
}
.card .quick { position: absolute; bottom: 44px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; opacity: 0; transition: opacity .1s; }
.card:hover .quick { opacity: 1; }
.quick button {
  width: 30px; height: 30px; border-radius: 50%; border: none; font-size: 17px; font-weight: 800;
  cursor: pointer; background: rgba(20, 22, 28, .82); color: #fff; box-shadow: var(--shadow);
}
.quick button.plus { background: var(--good); }
.quick button:hover { filter: brightness(1.12); }

.empty { color: var(--muted); padding: 40px; text-align: center; }

/* ---------- Bascule des pages / sous-onglets ---------- */
.page-home, .page-catalog, .page-mine, .page-rangement, .page-vitrine, .subtabs { display: none; }
body[data-page="home"] .page-home { display: block; }
body[data-page="catalog"] .page-catalog { display: block; }
body[data-page="catalog"] .grid { display: grid; }
body[data-page="collection"] .subtabs { display: flex; }
body[data-page="collection"][data-sub="cartes"] .page-mine { display: block; }
body[data-page="collection"][data-sub="rangements"] .page-rangement { display: block; }
body[data-page="collection"][data-sub="vitrine"] .page-vitrine { display: block; }
/* Accueil = pleine largeur (pas de barre latérale, pas d'en-tête de contenu) */
body[data-page="home"] .sidebar { display: none; }
body[data-page="home"] .content-head { display: none; }

/* Filtres Possédées/Manquantes dans la barre latérale (catalogue) */
.side-toggles { display: flex; gap: 14px; padding: 4px 6px 8px; }
.side-toggles .toggle { font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- Sous-onglets + actions (Ma Collection) ---------- */
.subtabs { gap: 3px; background: var(--surface-3); padding: 3px; border-radius: 9px; margin-bottom: 18px; align-items: center; }
.subtabs-spacer { flex: 1; }
.collection-actions { display: flex; gap: 6px; padding-right: 3px; }
.collection-actions .btn { padding: 6px 11px; font-size: 12.5px; }
.subtab {
  border: none; background: transparent; color: var(--muted);
  padding: 7px 16px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
}
.subtab:hover { color: var(--text); }
.subtab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* ---------- Filtres (page Mes Cartes) ---------- */
.mine-filter-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); padding: 12px 6px 7px; font-weight: 700; }
.cond-filter {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
  margin-bottom: 2px; border: 1px solid transparent;
}
.cond-filter:hover { background: var(--surface-2); }
.cond-filter.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.cond-filter .cf-count { font-size: 11.5px; color: var(--muted); background: var(--surface-3); padding: 1px 8px; border-radius: 10px; }
.cond-filter.active .cf-count { background: var(--surface); color: var(--primary); }
.cond-filter .cf-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 8px; }

/* ---------- Tableau Mes Cartes ---------- */
.table-wrap { width: 100%; }
table.mine { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.mine th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px; padding: 9px 10px;
  border-bottom: 1px solid var(--line-strong); position: sticky; top: 0; background: var(--page);
}
table.mine td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.mine tr:hover td { background: var(--surface-2); }
table.mine .tcard { display: flex; align-items: center; gap: 10px; }
table.mine .tcard > div { line-height: 1.3; }
table.mine .tcard img { width: 36px; border-radius: 4px; cursor: pointer; box-shadow: var(--shadow); }
table.mine .tname { font-weight: 600; cursor: pointer; }
table.mine .tname:hover { color: var(--primary); }
table.mine .tset { color: var(--muted); font-size: 12px; }
table.mine .muted { color: var(--muted); }
table.mine tr.editing td { background: var(--surface-2); vertical-align: middle; }

table.mine select, table.mine input[type="text"] {
  width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
  padding: 7px 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: 13px; font-family: inherit;
}
/* Le champ "note de gradation" n'apparaît que si une entreprise est choisie. */
.grade-cell .row-grade:disabled { display: none; }
table.mine select:focus, table.mine input:focus { outline: none; border-color: var(--primary); }
table.mine td:nth-child(2) { width: 112px; }  /* État */
table.mine td:nth-child(3) { width: 120px; }  /* Variante */
table.mine td:nth-child(4) { width: 140px; }  /* Gradation */
table.mine td:nth-child(5) { width: 150px; }  /* Rangement */
table.mine td:nth-child(6) { width: 95px; }   /* Position */
table.mine th:last-child, table.mine td.row-actions { text-align: right; }

.state-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line);
}
.state-badge .sb-dot { width: 8px; height: 8px; border-radius: 50%; }

.grade-cell { display: flex; flex-direction: column; gap: 5px; }
.grade-badge {
  display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 700;
  background: var(--gold-bg); color: var(--gold-text); border: 1px solid var(--gold-line);
}
.variant-badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
  background: var(--surface-2); border: 1px solid currentColor;
}

.row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.row-edit, .row-done { height: 32px; padding: 0 14px; font-size: 13px; display: inline-flex; align-items: center; }
.row-del {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  height: 32px; min-width: 32px; padding: 0; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
}
.row-del:hover { border-color: var(--primary); color: var(--primary); }
.row-del.armed, .copy-del.armed, .cont-del.armed {
  background: var(--primary); color: #fff; border-color: var(--primary);
  width: auto; padding: 0 12px; font-size: 12.5px; font-weight: 600;
}

/* ---------- Page Rangement ---------- */
.cont-add { display: flex; gap: 10px; margin-bottom: 22px; max-width: 720px; }
.cont-add input, .cont-add select {
  padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 14px; font-family: inherit;
}
.cont-add input { flex: 1; }
.cont-add select { flex: 0 0 220px; }
.cont-add input:focus, .cont-add select:focus { outline: none; border-color: var(--primary); }
.cont-list { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.cont-card {
  display: flex; align-items: center; gap: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow);
}
.cont-card.unsorted { border-style: dashed; box-shadow: none; }
.cont-icon { font-size: 24px; flex-shrink: 0; }
.cont-main { flex: 1; display: flex; gap: 10px; align-items: center; }
.cont-main .cont-name, .cont-main .cont-type {
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit;
}
.cont-main .cont-name { flex: 1; max-width: 280px; font-weight: 600; }
.cont-main .cont-type { flex: 0 0 200px; }
.cont-main .cont-name:focus, .cont-main .cont-type:focus { outline: none; border-color: var(--primary); }
.cont-count { color: var(--muted); font-size: 13px; min-width: 80px; text-align: right; }
.cont-del {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  height: 34px; min-width: 34px; padding: 0 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
}
.cont-del:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Modale ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal.modal-top { z-index: 60; }
.modal[hidden], [hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 18, .55); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-lg); width: min(740px, 92vw);
  max-height: 90vh; overflow-y: auto; padding: 24px;
}
.modal-card.fiche-card { width: min(1040px, 96vw); }
.modal-card.small { width: min(440px, 92vw); }

/* --- Fiche : 3 panneaux carte | infos | formulaire --- */
.fiche-grid { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.fiche-left { flex: 0 0 230px; }
.fiche-left img { width: 100%; border-radius: 12px; box-shadow: var(--shadow); }
.fiche-center { flex: 1; min-width: 240px; }
.fiche-right {
  flex: 0 0 320px; border-left: 1px solid var(--line); padding-left: 22px;
}
@media (max-width: 820px) {
  .fiche-right { flex-basis: 100%; border-left: none; border-top: 1px solid var(--line); padding-left: 0; padding-top: 16px; }
}
.fiche-center h3 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.4px; }
.owned-note { font-size: 13px; color: var(--muted); margin: 12px 0 12px; }
.ok-flash { font-size: 13px; font-weight: 600; color: var(--good); margin-bottom: 10px; }
.form-title { font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* --- Pied de fiche (boutons) --- */
.fiche-foot { display: flex; align-items: center; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.foot-spacer { flex: 1; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); color: #fff; }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; background: var(--primary); color: #fff; }
.btn.danger { color: #fff; background: #d6443c; border-color: #d6443c; }
.btn.danger:hover { filter: brightness(1.08); color: #fff; }

.field { margin: 12px 0; }
.field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 5px; font-weight: 700; }
.field input { width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 14px; font-family: inherit; }
.field input:focus { outline: none; border-color: var(--primary); }

/* Petit badge prix de vente (table Mes Cartes / centre fiche) */
.sale-mini { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 12px; background: var(--good); color: #fff; }
.sale-mini.open { background: var(--surface-2); color: var(--primary); border: 1px solid var(--primary); font-weight: 600; }

/* Lignes cliquables de Mes Cartes */
table.mine.clickable tbody tr { cursor: pointer; }
.modal-close {
  position: absolute; top: 14px; right: 14px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
}
.modal-close:hover { border-color: var(--primary); color: var(--primary); }
.modal-body { display: block; }
.modal-body h3 { margin: 0 0 4px; font-size: 23px; letter-spacing: -.4px; }
.modal-body .msub { color: var(--muted); margin-bottom: 10px; font-size: 13px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.meta-chip {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
}
.meta-chip.rarity { color: var(--primary); border-color: var(--primary); }
.illus { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.modal-total { font-size: 13px; color: var(--muted); margin: 4px 0 14px; }
.modal-total b { color: var(--primary); font-size: 16px; }

.copy-list { display: flex; flex-direction: column; gap: 12px; }
.copy { border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; background: var(--surface-2); }
.copy-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.copy-n { font-weight: 700; font-size: 13px; }
.copy-del {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  height: 30px; min-width: 30px; border-radius: 8px; cursor: pointer;
}
.copy-del:hover { border-color: var(--primary); color: var(--primary); }
.copy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.copy-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.copy-grid label.wide { grid-column: 1 / -1; }
.copy-grid select, .copy-grid input[type="text"] {
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit;
  text-transform: none; letter-spacing: 0; font-weight: 400;
}
.copy-grid select:focus, .copy-grid input:focus { outline: none; border-color: var(--primary); }

/* Section « mise en vente » dans la fiche */
.sale-box {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; background: var(--surface);
}
.sale-check { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; white-space: nowrap; cursor: pointer; }
.sale-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.sale-box .c-price { flex: 1; min-width: 200px; }

/* ---------- Page Ma Vitrine ---------- */
.vitrine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 16px; }
.vcard {
  position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .1s, box-shadow .1s, border-color .1s;
}
.vcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.vremove {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(20, 22, 28, .72); color: #fff; font-size: 13px; font-weight: 700;
  opacity: 0; transition: opacity .1s; box-shadow: var(--shadow);
}
.vcard:hover .vremove { opacity: 1; }
.vremove:hover { background: var(--primary); }
.vcard .imgwrap { aspect-ratio: 245 / 342; background: var(--surface-3); display: flex; align-items: center; justify-content: center; }
.vcard .imgwrap img { width: 100%; height: 100%; object-fit: contain; }
.vcard-body { padding: 9px 11px 11px; }
.vcard .vname { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcard .vmeta { color: var(--muted); font-size: 11.5px; margin: 2px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price-tag {
  display: inline-block; font-weight: 800; font-size: 14px; padding: 5px 11px; border-radius: 8px;
  background: var(--good); color: #fff; box-shadow: var(--shadow);
}
.price-tag.open { background: var(--surface-2); color: var(--primary); border: 1px solid var(--primary); font-size: 12.5px; font-weight: 700; }

/* Scrollbars discrètes */
.sidebar::-webkit-scrollbar, .content::-webkit-scrollbar, .modal-card::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb, .modal-card::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 6px; border: 2px solid var(--surface);
}

/* ===================== Authentification ===================== */
.auth-area { display: flex; align-items: center; margin-left: 4px; }
/* Bouton Connexion : blanc plein, lisible sur le header rouge */
.auth-area .btn.primary { background: #fff; color: var(--primary); border-color: #fff; }
.auth-area .btn.primary:hover { background: #fff; filter: brightness(0.95); }

.user-menu { position: relative; }
.user-btn { white-space: nowrap; }
.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 70;
}
.user-dropdown[hidden] { display: none; }
.user-dropdown button {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  color: var(--text); padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-family: inherit;
}
.user-dropdown button:hover { background: var(--surface-2); color: var(--primary); }

/* Onglets connexion / inscription */
.auth-tabs { display: flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 10px; margin-bottom: 16px; }
.auth-tab {
  flex: 1; border: none; background: transparent; color: var(--muted);
  padding: 9px 0; border-radius: 7px; cursor: pointer; font-weight: 700; font-size: 13.5px; font-family: inherit;
}
.auth-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.auth-msg {
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary);
  border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.auth-msg.ok { background: rgba(47,168,79,.12); color: var(--good); border-color: var(--good); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

/* Pastille de version dans l'en-tête */
.app-version {
  align-self: center; font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  color: rgba(255, 255, 255, .82); background: rgba(0, 0, 0, .16);
  padding: 2px 7px; border-radius: 10px; margin-left: 2px;
}

/* ===================== Page Accueil ===================== */
.home-view { max-width: 880px; margin: 0 auto; padding: 48px 24px 64px; text-align: center; }
.home-logo {
  width: 64px; height: 72px; margin: 0 auto 18px; position: relative; border-radius: 8px;
  background: var(--primary); box-shadow: var(--shadow-lg);
}
.home-logo::before, .home-logo::after {
  content: ""; position: absolute; inset: 0; border-radius: 8px; background: var(--primary);
  box-shadow: 0 0 0 1px rgba(0,0,0,.15); transform-origin: bottom center;
}
.home-logo::before { transform: rotate(-13deg) translateX(-6px); opacity: .55; }
.home-logo::after { transform: rotate(13deg) translateX(6px); opacity: .55; }
.home-view h1 { font-size: 40px; margin: 0 0 10px; letter-spacing: -1px; }
.home-tagline { font-size: 16px; color: var(--muted); max-width: 560px; margin: 0 auto 28px; line-height: 1.5; }
.home-stats { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 30px; }
.home-stats > div {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 22px; min-width: 130px; box-shadow: var(--shadow);
}
.home-stats b { display: block; font-size: 26px; color: var(--primary); font-weight: 800; }
.home-stats span { font-size: 12.5px; color: var(--muted); }
.home-cta { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.home-cta .btn { padding: 11px 22px; font-size: 14.5px; }
.home-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-top: 40px; text-align: left; }
.home-feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.home-feature h3 { margin: 0 0 6px; font-size: 15px; }
.home-feature p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ===================== Ajout de masse ===================== */
.modal-card.medium { width: min(680px, 94vw); }
#bulk-modal-body select, #bulk-modal-body textarea {
  width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: 14px; font-family: inherit;
}
#bulk-modal-body textarea { resize: vertical; line-height: 1.5; }
#bulk-modal-body select:focus, #bulk-modal-body textarea:focus { outline: none; border-color: var(--primary); }
.bulk-legend { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.bulk-preview { max-height: 230px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.bulk-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13px;
}
.bulk-row .bulk-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-row .bulk-num { color: var(--muted); font-size: 12px; }
.bulk-row.err { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* Ajout de masse : 2 colonnes (dernière carte | saisie + liste) */
.bulk-grid { display: flex; gap: 18px; align-items: flex-start; }
.bulk-left { flex: 0 0 200px; }
.bulk-right { flex: 1; min-width: 0; }
.bulk-card { text-align: center; }
.bulk-card img { width: 100%; border-radius: 10px; box-shadow: var(--shadow); }
.bulk-card-name { font-weight: 600; font-size: 13px; margin: 8px 0 6px; }
.bulk-left-empty {
  border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 30px 12px;
  color: var(--muted); font-size: 12.5px; text-align: center; aspect-ratio: 245/342;
  display: flex; align-items: center; justify-content: center;
}
@media (max-width: 560px) { .bulk-grid { flex-direction: column; } .bulk-left { flex-basis: auto; width: 150px; margin: 0 auto; } }

/* ===================== Tendance + courbe de prix ===================== */
.trend { font-size: 11px; font-weight: 800; margin-left: 3px; vertical-align: middle; }
.trend.up { color: var(--good); }
.trend.down { color: #d6443c; }

.price-chart { margin: 8px 0 14px; }
.chart-title { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.spark { width: 100%; height: 64px; display: block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.chart-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.chart-empty { font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 12px; }

/* Cote dans la cellule carte (Mes Cartes) */
.row-cote { font-weight: 700; color: var(--text); margin-left: 4px; }

/* Rangement de masse */
.field select { width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 14px; font-family: inherit; }
.field select:focus { outline: none; border-color: var(--primary); }
.move-count { font-size: 13.5px; margin: 4px 0 4px; }
.move-count b { color: var(--primary); font-size: 16px; }

/* ===================== Mes Cartes : filtres déroulants ===================== */
.mine-filter { margin-bottom: 10px; }
.mine-filter > label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; margin-bottom: 4px; padding-left: 2px; }
.mine-filter select { width: 100%; padding: 8px 9px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 13px; font-family: inherit; }
.mine-filter select:focus { outline: none; border-color: var(--primary); }
.price-range { display: flex; align-items: center; gap: 6px; }
.price-range input { width: 100%; padding: 8px 9px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 13px; font-family: inherit; }
.price-range input:focus { outline: none; border-color: var(--primary); }
.mine-reset { width: 100%; margin-top: 4px; }

/* ===================== Mes Cartes : bascule d'affichage ===================== */
.view-toggle { display: inline-flex; gap: 2px; background: var(--surface-3); padding: 2px; border-radius: 8px; margin-left: auto; }
.content-head .meta { align-items: center; }
.vt { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 5px 9px; border-radius: 6px; }
.vt:hover { color: var(--text); }
.vt.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* Grille */
.mine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.mine-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); transition: transform .1s, box-shadow .1s, border-color .1s; }
.mine-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.mine-card .imgwrap { aspect-ratio: 245/342; background: var(--surface-3); display: flex; align-items: center; justify-content: center; }
.mine-card .imgwrap img { width: 100%; height: 100%; object-fit: contain; }
.mc-sale { position: absolute; top: 6px; right: 6px; z-index: 2; background: var(--good); border-radius: 6px; padding: 1px 5px; font-size: 12px; box-shadow: var(--shadow); }
.mc-body { padding: 7px 9px 9px; }
.mc-name { font-weight: 700; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-sub { font-size: 11.5px; color: var(--muted); margin: 2px 0 5px; display: flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mc-num { font-size: 11px; color: var(--muted); }

/* Liste compacte */
.mine-compact { display: flex; flex-direction: column; }
.cmp-row { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.cmp-row:hover { background: var(--surface-2); }
.cmp-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cmp-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.cmp-num { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.cmp-spacer { flex: 1; }
