/* VovStock : thème sombre, sobre, accent doré. */
:root {
  --bg: #0a0c10;
  --sidebar: #0d0f14;
  --surface: #12151c;
  --surface-2: #171b23;
  --surface-3: #1d222c;
  --border: #1f242e;
  --border-strong: #2b313d;
  --text: #e7e9ee;
  --text-2: #b4bac6;
  --muted: #858d9c;
  --faint: #5c6372;
  --accent: #c9a45c;
  --accent-hover: #d6b36c;
  --accent-ink: #17120a;
  --accent-soft: rgba(201, 164, 92, .1);
  --accent-line: rgba(201, 164, 92, .32);
  --chart-1: #b48a36;
  --chart-2: #6a8fe0;
  --chart-grid: #1f242e;
  --ok: #4fb37f;
  --ok-soft: rgba(79, 179, 127, .1);
  --warn: #d99a4e;
  --warn-soft: rgba(217, 154, 78, .1);
  --danger: #e0645b;
  --danger-soft: rgba(224, 100, 91, .1);
  --info: #7b9be0;
  --info-soft: rgba(123, 155, 224, .1);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 236px;
  --nav-h: 64px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
[data-icon] { display: inline-flex; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.45rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; margin: 0; }
h2 { font-size: .95rem; font-weight: 600; letter-spacing: -.005em; margin: 0 0 14px; }
h3 { font-size: .85rem; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .82rem; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: .8em; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }
.loading { padding: 64px; text-align: center; color: var(--muted); }
.i { width: 16px; height: 16px; flex: none; }
::selection { background: rgba(201, 164, 92, .3); }
kbd { font: 500 .7rem var(--font); color: var(--muted); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: var(--surface-2); }

/* ---------- Structure : barre latérale + contenu ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 14px; background: var(--sidebar); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em; }
.brand img { border-radius: 7px; }
.brand b { color: var(--accent); font-weight: 600; }
.side-add { margin: 0 0 14px; }
.side-search {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; margin-bottom: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--faint);
  font: inherit; font-size: .85rem; cursor: pointer; text-align: left;
}
.side-search:hover { border-color: var(--border-strong); color: var(--muted); }
.side-search > span:nth-child(2) { flex: 1; }
.nav-group { font-size: .68rem; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; padding: 12px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--surface-3); color: var(--text); }
.nav-link.active .i { color: var(--accent); }
.nav-link .count { margin-left: auto; font-size: .72rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.content { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.app { max-width: 1240px; margin: 0 auto; padding: 28px 36px 56px; }

.mobilebar { display: none; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { margin-left: 0; }
  .app { padding: 18px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
  .mobilebar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 12px 10px 16px; background: rgba(10, 12, 16, .92);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .mobilebar .brand { padding: 0; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; justify-content: space-around;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding: 6px 6px env(safe-area-inset-bottom);
    background: rgba(13, 15, 20, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--faint); font-size: .66rem; font-weight: 500; }
  .tabbar a .i { width: 21px; height: 21px; }
  .tabbar a.active { color: var(--text); }
  .tabbar a.active .i { color: var(--accent); }
  .tabbar .tab-add .pill { display: flex; align-items: center; justify-content: center; width: 44px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
  .tabbar .tab-add .pill .i { color: var(--accent-ink); }
}

/* ---------- En-tête de page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--faint); margin-bottom: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .i { width: 12px; height: 12px; }

/* ---------- Blocs ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; }
.panel-head a, .link { color: var(--accent); text-decoration: none; font-size: .82rem; font-weight: 500; }
.panel-head a:hover, .link:hover { color: var(--accent-hover); }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.grid-2 > *, .grid-3 > * { min-width: 0; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 500; font-size: .86rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); border-color: #363d4b; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #06140c; font-weight: 600; }
.btn.ok:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: rgba(224, 100, 91, .4); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: .8rem; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn.block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn.on { background: var(--surface-3); color: var(--accent); }

/* ---------- Champs ---------- */
label.field { display: block; }
label.field > span { display: block; font-size: .78rem; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
label.field > small { display: block; color: var(--faint); font-size: .76rem; margin-top: 5px; }
input, select, textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; font-size: .88rem;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--faint); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23858d9c' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center / 15px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201, 164, 92, .14); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"] { width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--accent); cursor: pointer; }
input[type="month"], input[type="number"] { color-scheme: dark; }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon input { padding-left: 34px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.grid-form .wide { grid-column: 1 / -1; }
.toggle { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }

/* ---------- Pastilles ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px;
  padding: 0 8px; border-radius: 6px;
  font-size: .72rem; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.draft { background: var(--warn-soft); color: var(--warn); }
.badge.sold { background: var(--info-soft); color: var(--info); }
.badge.graded { background: var(--accent-soft); color: var(--accent); }
.badge.under { background: var(--warn-soft); color: var(--warn); }
.badge.over { background: var(--info-soft); color: var(--info); }
.lang { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 18px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border-strong); font-size: .65rem; font-weight: 600; color: var(--text-2); letter-spacing: .03em; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  height: 30px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: transparent; cursor: pointer; font: inherit; font-weight: 500; font-size: .82rem; color: var(--text-2);
}
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chips select { width: auto; height: 30px; font-size: .82rem; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: .84rem; }
.notice .i { margin-top: 2px; color: var(--muted); }
.notice.warn { background: var(--warn-soft); border-color: rgba(217, 154, 78, .2); }
.notice.warn .i { color: var(--warn); }
.empty { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty .ico { display: inline-flex; width: 48px; height: 48px; border-radius: 12px; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--accent); margin-bottom: 14px; }
.empty .ico .i { width: 22px; height: 22px; }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 18px; }

/* ---------- Indicateurs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kpi { background: var(--surface); padding: 16px 18px; min-width: 0; }
.kpi .label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .meta { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--faint); margin-top: 2px; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
@media (max-width: 1000px) { .kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .kpi { padding: 13px 14px; } .kpi .value { font-size: 1.25rem; } }

.hero-figure { font-size: 3rem; font-weight: 600; letter-spacing: -.03em; line-height: 1.05; }
@media (max-width: 480px) { .hero-figure { font-size: 2.3rem; } }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list a { text-decoration: none; }
.list a.rowlink:hover { color: var(--accent); }
.list .lead { display: inline-flex; width: 30px; height: 30px; border-radius: 8px; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); flex: none; }
.list .lead.ok { color: var(--ok); } .list .lead.warn { color: var(--warn); } .list .lead.info { color: var(--info); } .list .lead.gold { color: var(--accent); }
.list .txt { flex: 1; min-width: 0; }
.list .txt b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .txt span { font-size: .78rem; color: var(--faint); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .end { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list .thumb-sm { width: 30px; height: 42px; border-radius: 4px; object-fit: cover; background: var(--surface-2); flex: none; }

/* ---------- Graphiques ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .hover-band, .chart .band-on { fill: rgba(255, 255, 255, .03); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .78rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; border-radius: 1px; width: 14px; }
.tooltip {
  position: absolute; z-index: 10; pointer-events: none; min-width: 140px;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: .78rem; box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap;
}
.tooltip b { display: block; margin-bottom: 4px; font-weight: 600; }
.tooltip div { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--text-2); }
.tooltip div span { display: inline-flex; align-items: center; gap: 6px; }
.tooltip div em { font-style: normal; color: var(--text); font-variant-numeric: tabular-nums; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 90px; gap: 12px; align-items: center; font-size: .84rem; }
.hbar .track { height: 10px; background: var(--surface-3); border-radius: 0 4px 4px 0; position: relative; }
.hbar .fill { position: absolute; inset: 0 auto 0 0; background: var(--chart-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.hbar .n { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Collection ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 260px; }
.toolbar select { width: auto; min-width: 140px; }
@media (max-width: 860px) { .toolbar select { flex: 1 1 calc(50% - 4px); min-width: 0; } }
.bulkbar {
  position: sticky; top: 12px; z-index: 15;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px 8px 14px; margin-bottom: 12px;
  background: var(--surface-3); border: 1px solid var(--accent-line); border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
}
.bulkbar .count { font-weight: 600; margin-right: 6px; }
@media (max-width: 860px) { .bulkbar { top: 62px; } }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
@media (max-width: 480px) { .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.pcard {
  --hx: 50%; --hy: 50%;
  display: flex; flex-direction: column; text-decoration: none; position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: border-color .15s, transform .15s;
}
.pcard:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.pcard .thumb { aspect-ratio: 63 / 88; background: var(--surface-2); position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Léger reflet holographique au survol */
.pcard .thumb::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 225, 160, .16) 42%, rgba(160, 210, 255, .14) 52%, transparent 64%);
  background-size: 250% 250%; background-position: var(--hx) var(--hy); mix-blend-mode: screen;
}
.pcard:hover .thumb::after { opacity: 1; }
.pcard .corner { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; z-index: 2; }
.pcard .corner span { background: rgba(10, 12, 16, .82); color: var(--text); border-radius: 5px; padding: 1px 6px; font-size: .68rem; font-weight: 600; }
.pcard .ref { position: absolute; bottom: 8px; left: 8px; z-index: 2; background: rgba(10, 12, 16, .8); color: var(--muted); border-radius: 5px; padding: 1px 6px; font-size: .62rem; }
.pcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard .top { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: .7rem; color: var(--faint); }
.pcard .name { font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pcard .meta { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; gap: 6px; }
.pcard .price { font-weight: 600; font-size: .98rem; font-variant-numeric: tabular-nums; }
.pcard .cote { font-size: .72rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.pcard.graded .thumb { flex-direction: column; justify-content: flex-start; padding: 7px 9px 9px; background: linear-gradient(180deg, #252b37, #191d26); }
.pcard.graded .thumb img, .pcard.graded .thumb .placeholder { flex: 1; min-height: 0; border-radius: 3px; }
.slab-label { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 3px 7px; margin-bottom: 7px; border-radius: 3px; background: var(--accent); color: var(--accent-ink); font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.slab-label b { font-size: .82rem; letter-spacing: 0; }
.placeholder { color: var(--faint); font-size: .74rem; text-align: center; padding: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 100%; }
.placeholder .i { width: 28px; height: 28px; color: var(--border-strong); }

table.data { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; vertical-align: middle; }
table.data th { font-size: .72rem; font-weight: 500; color: var(--faint); background: var(--surface); position: sticky; top: 0; z-index: 1; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text-2); }
table.data th.sorted { color: var(--accent); }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.selected { background: var(--accent-soft); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td a { text-decoration: none; }
table.data td a:hover { color: var(--accent); }
table.data .cell-card { display: flex; align-items: center; gap: 10px; min-width: 220px; }
table.data .cell-card img, table.data .cell-card .ph { width: 28px; height: 39px; border-radius: 3px; object-fit: cover; background: var(--surface-3); flex: none; }
table.data .cell-card b { font-weight: 500; display: block; color: var(--text); }
table.data .cell-card small { display: block; font-size: .75rem; color: var(--faint); }
table.data td.check, table.data th.check { width: 36px; padding-right: 0; }
.table-wrap { overflow-x: auto; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

/* ---------- Formulaire carte ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.form-layout > * { min-width: 0; }
.form-layout aside { position: sticky; top: 20px; }
@media (max-width: 1000px) { .form-layout { grid-template-columns: 1fr; } .form-layout aside { position: static; } }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 14px; max-height: 470px; overflow-y: auto; padding: 2px; }
.result { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); padding: 5px; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.result:hover { border-color: var(--accent); }
.result .img { aspect-ratio: 63 / 88; border-radius: 5px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.result .img img { width: 100%; height: 100%; object-fit: cover; }
.result .img .i { width: 22px; height: 22px; color: var(--border-strong); }
.result .t { font-size: .72rem; font-weight: 500; margin-top: 5px; line-height: 1.25; }
.result .s { font-size: .66rem; color: var(--faint); line-height: 1.25; }
.picked { display: flex; gap: 14px; align-items: flex-start; padding: 12px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); }
.picked img { width: 76px; border-radius: 5px; }
.picked .ok-line { display: flex; align-items: center; gap: 6px; color: var(--ok); font-size: .8rem; margin-top: 8px; }
.cm-prices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.cm-price { background: var(--bg); border-radius: var(--radius-sm); padding: 8px 6px; text-align: center; border: 1px solid var(--border); cursor: pointer; font: inherit; color: var(--text); }
.cm-price:hover { border-color: var(--accent); }
.cm-price b { display: block; font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cm-price span { font-size: .68rem; color: var(--faint); }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); border: 1px solid var(--border); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; padding: 5px; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.photo .tools button { display: inline-flex; align-items: center; justify-content: center; background: rgba(18, 21, 28, .9); border: 1px solid var(--border-strong); border-radius: 6px; width: 26px; height: 26px; cursor: pointer; color: var(--text); padding: 0; }
.photo .tools button .i { width: 13px; height: 13px; }
.photo .tools button:disabled { opacity: .3; }
.photo .cover-tag { position: absolute; top: 6px; left: 6px; background: var(--accent); color: var(--accent-ink); font-size: .6rem; font-weight: 700; border-radius: 4px; padding: 1px 6px; text-transform: uppercase; letter-spacing: .04em; }
.photo-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 3 / 4; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); color: var(--faint); font-size: .74rem; cursor: pointer; text-align: center; padding: 8px; }
.photo-drop:hover, .photo-drop.over { border-color: var(--accent); color: var(--accent); }
.photo-drop .i { width: 20px; height: 20px; }
.photo-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.photo-add input { display: none; }

.price-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.price-table th, .price-table td { padding: 9px 0; text-align: right; border-bottom: 1px solid var(--border); font-size: .85rem; }
.price-table th:first-child, .price-table td:first-child { text-align: left; }
.price-table th { font-size: .72rem; color: var(--faint); font-weight: 500; }
.price-table tr:last-child td { border-bottom: 0; }
.price-table tr.off td { opacity: .4; }
.price-table .big { font-weight: 600; }
.price-table td + td, .price-table th + th { padding-left: 12px; }

.form-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  padding: 14px 0; margin-top: 12px;
  background: linear-gradient(transparent, var(--bg) 30%);
}
@media (max-width: 860px) {
  .form-actions { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .form-actions .btn { flex: 1 1 auto; }
}

/* ---------- Fiche carte ---------- */
.detail { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.detail > * { min-width: 0; }
.gallery { position: sticky; top: 20px; }
.gallery .main { aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); padding: 12px; }
.gallery .main img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.gallery .thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.gallery .thumbs button { flex: 0 0 56px; height: 76px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); padding: 0; cursor: pointer; background: var(--surface-2); opacity: .55; }
.gallery .thumbs button.on { border-color: var(--accent); opacity: 1; }
.gallery .thumbs img { width: 100%; height: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.facts > div { padding: 12px 18px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); min-width: 0; }
.facts > div:nth-child(3n) { border-right: 0; }
.facts span { display: block; font-size: .72rem; color: var(--faint); margin-bottom: 2px; }
.facts b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr 1fr; }
  .facts > div:nth-child(3n) { border-right: 1px solid var(--border); }
  .facts > div:nth-child(2n) { border-right: 0; }
}
.listing-preview { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .84rem; white-space: pre-wrap; color: var(--text-2); }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); margin-right: 6px; vertical-align: middle; }
.status-dot.listed { background: var(--ok); }
.status-dot.error { background: var(--danger); }
.timeline { list-style: none; margin: 0; padding: 4px 18px 14px; }
.timeline li { position: relative; padding: 10px 0 10px 22px; font-size: .84rem; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); box-shadow: 0 0 0 3px var(--surface); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 26px; bottom: -8px; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.sold::before { background: var(--ok); }
.timeline li.created::before { background: var(--accent); }
.timeline li.market::before { background: var(--info); }
.timeline li.deleted::before, .timeline li.sale_cancelled::before { background: var(--danger); }
.timeline b { font-weight: 500; }
.timeline .when { color: var(--faint); font-size: .74rem; }
.timeline .what { color: var(--text-2); }
.market-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .84rem; color: var(--text-2); }
@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
  .gallery { position: static; }
  .gallery .main { max-height: 60vh; }
}

/* ---------- Réglages ---------- */
.platform-row { display: grid; grid-template-columns: 150px repeat(4, minmax(0, 1fr)) 150px; gap: 12px; align-items: end; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.platform-row:last-child { border-bottom: 0; }
.platform-row .name { display: flex; align-items: center; gap: 10px; font-weight: 500; padding-bottom: 9px; }
.platform-row .example { font-size: .78rem; color: var(--faint); padding-bottom: 10px; }
.platform-row .example b { color: var(--text); font-weight: 600; }
@media (max-width: 1000px) {
  .platform-row { grid-template-columns: 1fr 1fr; }
  .platform-row .name, .platform-row .example { grid-column: 1 / -1; padding-bottom: 0; }
}

/* ---------- Connexion ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth { width: 100%; max-width: 380px; }
.auth .logo { width: 44px; height: 44px; border-radius: 10px; margin-bottom: 20px; }
.auth h1 { margin-bottom: 6px; }
.auth .panel { padding: 22px; margin-top: 22px; }
.auth .foot { margin-top: 16px; font-size: .78rem; color: var(--faint); text-align: center; }

/* ---------- Fenêtres et notifications ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(4, 5, 8, .7); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); width: 100%; max-width: 460px; max-height: 80vh; overflow-y: auto; padding: 22px; box-shadow: 0 24px 64px rgba(0, 0, 0, .6); }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
@media (max-width: 860px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; max-height: 88vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}
.summary { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .85rem; display: grid; grid-template-columns: 1fr auto; gap: 4px; font-variant-numeric: tabular-nums; }

.palette { max-width: 560px; padding: 0; overflow: hidden; }
.palette input { height: 52px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 0 18px 0 46px; font-size: .95rem; background: transparent; box-shadow: none !important; }
.palette .input-icon .i { left: 18px; width: 18px; height: 18px; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2); }
.palette li.on { background: var(--surface-3); color: var(--text); }
.palette li .i { color: var(--muted); }
.palette li img, .palette li .ph { width: 22px; height: 30px; border-radius: 3px; object-fit: cover; background: var(--surface-3); flex: none; }
.palette li .grow { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette li small { color: var(--faint); }
.palette .group { font-size: .68rem; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; padding: 10px 10px 4px; }
.palette .hint { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: .72rem; color: var(--faint); }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong);
  padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  font-weight: 500; font-size: .85rem; opacity: 0; transform: translateY(8px); pointer-events: none; transition: all .18s; max-width: calc(100% - 32px);
}
.toast .i { color: var(--ok); }
.toast.show { opacity: 1; transform: none; }
.toast.error .i { color: var(--danger); }
@media (max-width: 860px) { .toast { left: 16px; right: 16px; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); } }
@media (max-width: 560px) { .hide-sm { display: none !important; } }
@media (max-width: 860px) { .hide-md { display: none !important; } }
@media (min-width: 861px) { .show-md { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
@media (max-width: 860px) { .palette .hint { display: none; } }
