/* =========================================================
   Équivalences & Tarifs — feuille de style
   ========================================================= */

:root {
  --ink: #14130F;
  --paper: #F4F2EC;
  --card: #FFFFFF;
  --line: #E6E3DB;
  --line-strong: #CFCCC2;
  --muted: #6F6B62;
  --yellow: #FFD400;
  --yellow-deep: #E3B500;
  --ok: #1F7A4D;
  --danger: #B23A2E;
  --radius: 6px;
  --shadow: 0 1px 0 rgba(20,19,15,.04), 0 8px 24px -16px rgba(20,19,15,.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .85em;
  background: rgba(20,19,15,.06);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------- En-tête ---------- */
.topbar { background: var(--ink); color: #fff; border-bottom: 3px solid var(--yellow); }
.topbar__inner {
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 6px 16px; padding: 18px 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__tick {
  width: 16px; height: 22px;
  background: var(--yellow);
  display: inline-block;
  transform: skewX(-12deg);
}
.brand__name { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 22px; }
.brand__sub { margin: 0; color: #B8B4AB; font-size: 13px; }

/* ---------- Cartes ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-top: 24px;
}
.card:first-of-type { margin-top: 28px; }
.card__head { margin-bottom: 16px; }
.card__title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px; font-weight: 600;
  margin: 0 0 4px;
  display: flex; align-items: center; gap: 10px;
}
.card__num {
  font-size: 12px; font-weight: 700;
  background: var(--yellow);
  padding: 2px 7px; border-radius: 4px; letter-spacing: .03em;
}
.card__hint { margin: 0; color: var(--muted); font-size: 13.5px; }

/* ---------- Zone de collage ---------- */
.paste__area {
  width: 100%; min-height: 110px; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 12px 14px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px; line-height: 1.6;
  color: var(--ink); background: #FCFBF8;
}
.paste__area:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--yellow); }
.paste__actions {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-top: 12px;
}
.paste__btns { display: flex; gap: 8px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--ink); width: 16px; height: 16px; }

/* ---------- Boutons ---------- */
.btn {
  font: inherit; font-weight: 500; font-size: 14px;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 9px 14px; cursor: pointer;
  transition: background .12s, border-color .12s, transform .04s;
}
.btn:hover { background: #F3F1EB; border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--yellow); }
.btn--sm { padding: 6px 11px; font-size: 13px; }
.btn--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--primary:hover { background: #2A2820; border-color: #2A2820; }
.btn--ghost-danger { color: var(--danger); border-color: #E4C4BF; }
.btn--ghost-danger:hover { background: #FBEEEC; border-color: var(--danger); }

/* ---------- Barre d'outils ---------- */
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin: 18px 0 10px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.table-toolbar__btns { display: flex; gap: 8px; flex-wrap: wrap; }
.counter { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--muted); }

/* ---------- Grilles ---------- */
.table-scroll { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th {
  text-align: left; font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 8px 10px;
  border-bottom: 2px solid var(--line-strong); white-space: nowrap;
}
.grid td { padding: 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr:hover { background: #FAF9F5; }

.grid td.cell-ref { position: relative; }
.grid td.cell-ref::before {
  content: ""; position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--yellow);
}

.cell-input {
  width: 100%; border: none; background: transparent;
  font: inherit; color: var(--ink); padding: 9px 10px;
}
.cell-input:focus { outline: none; background: #FFFBE6; box-shadow: inset 0 0 0 2px var(--yellow); }
.cell-ref .cell-input { font-family: "JetBrains Mono", monospace; font-weight: 600; padding-left: 13px; }

.col-prix { width: 120px; text-align: right; }
.col-act  { width: 44px; }
.cell-input--num { text-align: right; font-family: "JetBrains Mono", monospace; }

.row-del {
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 18px; line-height: 1;
  width: 100%; padding: 8px; border-radius: 4px;
}
.row-del:hover { color: var(--danger); background: #FBEEEC; }

/* ---------- Résultats de recherche ---------- */
.search-results__toolbar {
  margin-top: 20px;
  border-top: 2px solid var(--yellow);
  padding-top: 14px;
}

.cell-ref-text {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600; font-size: 13px;
  padding: 9px 10px 9px 13px;
}

.grid td.cell-found { position: relative; }
.grid td.cell-found::before {
  content: ""; position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--ok);
}

.cell-not-found { padding: 9px 10px; color: var(--muted); font-style: italic; }
.cell-loading   { padding: 9px 10px; color: var(--muted); font-family: "JetBrains Mono", monospace; letter-spacing: .1em; }
.cell-prix      { padding: 9px 12px; font-family: "JetBrains Mono", monospace; font-weight: 600; text-align: right; }

/* ---------- Onglets tarifs ---------- */
.tarifs-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.tarifs-tabs { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }

.tarif-tab {
  font: inherit;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .02em;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 6px 14px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.tarif-tab:hover { border-color: var(--muted); background: #F3F1EB; }
.tarif-tab.is-active {
  background: var(--yellow);
  border-color: var(--yellow-deep);
  color: var(--ink);
}
.tarif-tab:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(20,19,15,.25); }

/* ---------- Détail tarif actif ---------- */
.tarif-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.tarif-manage__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#tarif-file { display: none; }
.tarif-nom-input {
  font: inherit;
  font-weight: 500;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 7px 12px;
  min-width: 160px;
  flex: 1;
}
.tarif-nom-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--yellow); }
.tarif-manage__status { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- Vides ---------- */
.empty {
  color: var(--muted); font-size: 14px; padding: 18px;
  text-align: center; border: 1px dashed var(--line-strong);
  border-radius: var(--radius); background: #FCFBF8; margin-top: 6px;
}

/* ---------- Modale de confirmation ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(20,19,15,.5);
  align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--yellow);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px -8px rgba(20,19,15,.35);
  padding: 28px 28px 22px;
  width: 90%; max-width: 380px;
}
.modal__msg  { margin: 0 0 16px; font-size: 15px; line-height: 1.6; }
.modal__input {
  display: block; width: 100%;
  font: inherit; font-size: 15px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 9px 12px; margin-bottom: 20px;
  color: var(--ink); background: #FCFBF8;
}
.modal__input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--yellow); }
.modal__btns { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  body { font-size: 14px; }
  .card { padding: 16px; }
  .paste__actions { flex-direction: column; align-items: flex-start; }
  .paste__btns { width: 100%; }
  .paste__btns .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
