:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --ink: #1d2126;
  --muted: #6a6f76;
  --line: #e2ded6;
  --accent: #1c5d4f;
  --accent-ink: #ffffff;
  --accent-soft: #e3efeb;
  --warn: #9a4a06;
  --warn-soft: #fbeeda;
  --ok: #1c6b3c;
  --ok-soft: #e2f2e7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30, 25, 15, .06), 0 4px 14px rgba(30, 25, 15, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .6rem; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .85rem; }
.lead { max-width: 70ch; margin: 0 0 1.2rem; }

/* En-tête */
.top {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .7rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--muted); font-weight: 400; }
.top nav { display: flex; gap: 1.1rem; flex: 1; }
.top nav a { text-decoration: none; color: var(--ink); padding: .2rem 0; border-bottom: 2px solid transparent; }
.top nav a:hover { border-color: var(--accent); }
.who { display: flex; gap: .7rem; align-items: center; color: var(--muted); margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }

main { max-width: 1320px; margin: 0 auto; padding: 1.25rem; }
main.center { min-height: 100vh; display: grid; place-items: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--ok-soft); color: var(--ok); border: 1px solid #c4e2cd; }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: #f0d6ad; }

/* Boutons et champs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; padding: .55rem 1rem; border-radius: 8px; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid #cfcabf; text-decoration: none;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.small { padding: .3rem .7rem; font-size: .88rem; font-weight: 500; }
input, select, textarea {
  font: inherit; color: inherit; width: 100%; padding: .5rem .65rem;
  border: 1px solid #cfcabf; border-radius: 8px; background: #fff;
}
textarea { resize: vertical; }
input[type=checkbox] { width: auto; margin: 0 .35rem 0 0; accent-color: var(--accent); }
:focus-visible { outline: 3px solid #7fb8a8; outline-offset: 1px; }

/* Connexion */
.login { width: min(380px, 100%); display: grid; gap: .9rem; }
.login label { display: grid; gap: .3rem; font-weight: 600; }
.login p { margin: 0; }

/* Avancement */
.progress { margin-bottom: 1.1rem; }
.progress p { margin: .4rem 0 0; }
.bar { height: 10px; background: #e4dfd5; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }

/* Barre d'outils */
.toolbar { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; }
.tabs a { text-decoration: none; color: var(--ink); padding: .4rem .8rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.tabs a b { color: var(--muted); font-weight: 600; margin-left: .15rem; }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs a.on b { color: #cfd3d8; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0; }
.filters select { width: auto; }
.filters input { width: 16rem; max-width: 100%; }
.notice { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid #c5ddd6; border-radius: var(--radius); padding: .7rem 1rem; margin: 0 0 .8rem; }

/* Grille de bijoux */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.tile { display: flex; flex-direction: column; gap: .2rem; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; padding-bottom: .7rem; transition: box-shadow .15s, transform .15s; }
.tile:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.tile .ph { background: #ece8e0; display: block; overflow: hidden; }
.tile img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.tile .meta { display: flex; justify-content: space-between; align-items: center; gap: .4rem; padding: .55rem .7rem 0; }
.tile .sku { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile .name { padding: 0 .7rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .sub { padding: 0 .7rem; font-size: .85rem; color: var(--muted); }
.badge { display: inline-block; font-size: .76rem; font-weight: 600; padding: .12rem .55rem; border-radius: 99px; background: #ebe8e1; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* Fiche bijou */
.crumbs { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .9rem; flex-wrap: wrap; }
.pager { display: flex; gap: .5rem; align-items: center; }
.sheet { display: grid; grid-template-columns: minmax(280px, 5fr) 7fr; gap: 1.5rem; align-items: start; }
.photo { position: sticky; top: 4.2rem; display: grid; gap: 1rem; max-height: calc(100vh - 5rem); overflow: auto; }
.photo img { width: 100%; max-height: 62vh; object-fit: contain; background: #ece8e0; border-radius: var(--radius); display: block; border: 1px solid var(--line); }
.origin { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.origin dl { display: grid; grid-template-columns: auto 1fr; gap: .15rem .9rem; margin: 0 0 .8rem; }
.origin dt { color: var(--muted); }
.origin dd { margin: 0; overflow-wrap: anywhere; }
.tagrow { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; padding: .3rem 0; border-top: 1px dashed var(--line); }
.tagfam { font-size: .78rem; color: var(--muted); min-width: 8.5rem; }
.chip { font-size: .82rem; background: #efece6; border-radius: 99px; padding: .08rem .6rem; }
.chip.miss { background: var(--warn-soft); color: var(--warn); }

.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); display: grid; gap: 1rem; }
.form .head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.form .head h1 { margin: 0; font-variant-numeric: tabular-nums; }
.alerts { margin: 0; padding: .7rem 1rem .7rem 2rem; background: var(--warn-soft); color: var(--warn); border-radius: 8px; border: 1px solid #f0d6ad; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: grid; gap: .3rem; font-weight: 600; align-content: start; min-width: 0; }
.field > label { font-weight: 600; }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { padding: 0; margin-bottom: .3rem; font-weight: 600; }
.hint { font-size: .83rem; font-weight: 400; color: var(--muted); }
.hint.miss, .hint.absent { color: var(--warn); }
.picks { display: flex; flex-wrap: wrap; gap: .3rem; }
.pick { font: inherit; font-size: .84rem; font-weight: 500; cursor: pointer; padding: .15rem .65rem; border-radius: 99px; border: 1px solid #cfcabf; background: #fff; color: var(--ink); }
.pick:hover { border-color: var(--accent); }
.pick.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .25rem .8rem; font-weight: 400; }
.checkgrid label { display: flex; align-items: center; }
.actions { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; padding-top: .9rem; border-top: 1px solid var(--line); }
.actions.sticky { position: sticky; bottom: 0; background: var(--bg); padding: .8rem 0; border-top: 1px solid var(--line); }

h2.section { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .6rem 0 -.3rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.axis-tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: .05rem .35rem; margin-left: .3rem; }
.axis-empty select { border-color: var(--warn); box-shadow: 0 0 0 2px var(--warn-soft); }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); font-weight: 500; text-decoration: underline; }
.btn.quiet:hover { color: var(--ink); border-color: transparent; }
p.notice { display: block; }

.badge.stop { background: #fbe4e2; color: #9b1c13; }
div.alerts.stop { background: #fdeeec; color: #8a1a12; border: 1px solid #f2c5c0; border-radius: 8px; padding: .7rem 1rem; display: grid; gap: .3rem; }
div.alerts.stop ul { margin: 0; padding-left: 1.2rem; }
div.alerts.stop span { font-size: .85rem; }
.notice.block { display: block; }
.notice.block p { margin: 0 0 .4rem; }
.notice.block ul { margin: 0; padding-left: 1.2rem; }

/* À faire dans le PIM */
table.todo-pim { width: 100%; border-collapse: collapse; }
table.todo-pim th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .3rem .6rem; border-bottom: 1px solid var(--line); }
table.todo-pim td { padding: .4rem .6rem; border-bottom: 1px solid #f0ede7; vertical-align: top; }
table.todo-pim .num { text-align: right; width: 6rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.todo-pim code, .card code { font-size: .85em; background: #f1eee8; border-radius: 4px; padding: .05rem .3rem; }
.done { color: var(--ok); }
textarea.copy { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; line-height: 1.5; background: #faf9f6; }

/* Correspondances */
.tablewrap { overflow-x: auto; }
table.map { width: 100%; border-collapse: collapse; }
table.map th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .3rem .6rem; border-bottom: 1px solid var(--line); }
table.map td { padding: .3rem .6rem; border-bottom: 1px solid #f0ede7; vertical-align: middle; }
table.map td:first-child { width: 30%; min-width: 11rem; }
table.map .num { text-align: right; width: 5rem; font-variant-numeric: tabular-nums; }
table.map select { min-width: 14rem; }
table.map tr.todo td { background: var(--warn-soft); }

@media (max-width: 900px) {
  .sheet { grid-template-columns: 1fr; }
  .photo { position: static; max-height: none; }
  .photo img { max-height: 50vh; }
}
@media (max-width: 560px) {
  main { padding: 1rem; }
  .row.two { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
  .filters input { width: 100%; }
  .top { gap: .6rem 1rem; }
}
