:root {
  --bg: #14110c;
  --bg-2: #1d1810;
  --panel: #241d13;
  --panel-2: #2c2417;
  --line: #3a2f1d;
  --gold: #d4a437;
  --gold-soft: #e8c66a;
  --text: #ece3d0;
  --text-dim: #a79877;
  --green: #6fbf4f;
  --green-bg: rgba(111,191,79,.12);
  --red: #e06b5a;
  --red-bg: rgba(224,107,90,.12);
  --radius: 12px;
  --shadow: 0 8px 28px rgba(0,0,0,.45);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #2a2113 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
small { color: var(--text-dim); font-weight: 500; }

/* ---------------------------------------------------------------- header */
header {
  display: flex; align-items: center; gap: 28px;
  padding: 16px 28px;
  background: linear-gradient(180deg, var(--bg-2), rgba(29,24,16,.6));
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.brand h1 { font-size: 18px; color: var(--gold-soft); }
.brand .sub { margin: 0; font-size: 12px; color: var(--text-dim); }

.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tab {
  border: 0; background: transparent; color: var(--text-dim);
  padding: 8px 16px; border-radius: 9px; cursor: pointer;
  font-size: 14px; font-weight: 550; transition: all .15s ease;
}
.tab:hover { color: var(--text); background: var(--panel); }
.tab.active { color: var(--bg); background: linear-gradient(180deg, var(--gold-soft), var(--gold)); box-shadow: 0 2px 8px rgba(212,164,55,.3); }

.header-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  border: 1px solid transparent;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #1a1408; font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: 9px; cursor: pointer;
  transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
  box-shadow: 0 2px 8px rgba(212,164,55,.25);
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 4px 14px rgba(212,164,55,.35); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--panel); color: var(--text); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--panel-2); border-color: var(--gold); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { background: var(--panel); color: var(--red); border-color: var(--line); box-shadow: none; }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); }
.icon-btn { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; padding: 5px 8px; border-radius: 7px; font-size: 14px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ---------------------------------------------------------------- layout */
main { padding: 28px; max-width: 1180px; margin: 0 auto; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
h2 { font-size: 19px; margin-bottom: 4px; }
.hint { color: var(--text-dim); font-size: 13px; margin: 4px 0 18px; }

/* ---------------------------------------------------------------- cards */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 28px; }
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card.anchor { border-color: rgba(212,164,55,.4); }
.card-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.card-value { font-size: 34px; font-weight: 700; color: var(--gold-soft); margin: 6px 0; font-variant-numeric: tabular-nums; }
.card-value small { font-size: 15px; }
.card.best .card-value { font-size: 24px; color: var(--green); }
.card-foot { font-size: 13px; color: var(--text-dim); }
.inline-edit { display: flex; gap: 8px; margin-top: 14px; }
.inline-edit input { flex: 1; }

/* ---------------------------------------------------------------- inputs */
input, select, textarea {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 11px; border-radius: 8px; font-size: 14px; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,164,55,.15);
}
input::placeholder { color: #6f6048; }
label { font-size: 13px; color: var(--text-dim); display: block; margin-bottom: 5px; }

/* ---------------------------------------------------------------- search */
.search-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
#resource-search {
  flex: 1; max-width: 520px; padding: 11px 14px; font-size: 15px;
  background: var(--panel); border-color: var(--line);
}
.search-meta { font-size: 13px; color: var(--text-dim); white-space: nowrap; }

/* ---------------------------------------------------------------- tables */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); font-weight: 600; padding: 12px 14px;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
th.num { text-align: right; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--panel-2); }
.res-name { font-weight: 550; color: var(--text); }
.res-cat { font-size: 12px; color: var(--text-dim); }
td .price-cell { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
td .price-cell input { width: 92px; text-align: right; padding: 6px 8px; }

.ratio-good { color: var(--green); font-weight: 600; }
.ratio-bad { color: var(--red); font-weight: 600; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.good { background: var(--green-bg); color: var(--green); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.badge.warn { background: rgba(212,164,55,.15); color: var(--gold-soft); }
.badge.croq { background: rgba(212,164,55,.22); color: var(--gold-soft); }
.muted { color: var(--text-dim); }

/* ---------------------------------------------------------------- toggle & bangers */
.toggle { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-dim); cursor: pointer; user-select: none; }
.toggle input { width: auto; accent-color: var(--gold); }
tr.banger { background: rgba(111,191,79,.06); }
tr.banger:hover { background: rgba(111,191,79,.12); }
.star { font-size: 13px; }

/* ---------------------------------------------------------------- tri colonnes */
th.sortable { cursor: pointer; user-select: none; transition: color .12s ease; white-space: nowrap; }
th.sortable:hover { color: var(--gold-soft); }
th.sorted { color: var(--gold); }
.hint.micro { font-size: 12px; margin: -6px 0 12px; }

/* ---------------------------------------------------------------- bannière familier */
.fam-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: rgba(212,164,55,.12); border: 1px solid rgba(212,164,55,.4);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px;
}
.fam-banner b { color: var(--gold-soft); }
.cost-val { font-weight: 600; color: var(--text); }

/* ---------------------------------------------------------------- familiers grid */
.familier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.fam-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.fam-card.fam-selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,164,55,.3), var(--shadow); }
.fam-card h3 { font-size: 17px; color: var(--gold-soft); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.fam-targets { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }
.fam-targets th { background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: right; color: var(--gold-soft); font-size: 12px; }
.fam-targets th:first-child { text-align: left; }
.fam-targets td { padding: 6px 4px; border: 0; }
.fam-targets td:first-child { color: var(--text-dim); }
.fam-targets tr.profit-line td { border-top: 1px solid var(--line); font-weight: 700; font-size: 15px; padding-top: 9px; }
.fam-targets tr.profit-line td:first-child { font-weight: 600; font-size: 13px; color: var(--text); }
.fam-targets tr.muted td { color: var(--text-dim); font-size: 12px; }
.fam-rows { display: grid; gap: 7px; font-size: 14px; }
.fam-row { display: flex; justify-content: space-between; }
.fam-row span:first-child { color: var(--text-dim); }
.fam-row .v { font-variant-numeric: tabular-nums; font-weight: 550; }
.fam-profit { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.fam-profit .big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.profit-pos { color: var(--green); }
.profit-neg { color: var(--red); }
.fam-actions { display: flex; gap: 8px; margin-top: 14px; }
.fam-actions .btn { flex: 1; }

/* ---------------------------------------------------------------- chart */
.chart-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; height: 420px; }
.empty { color: var(--text-dim); text-align: center; padding: 40px; }
#history-select { min-width: 240px; }

/* ---------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8,6,3,.65); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  animation: fade .15s ease;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  width: min(520px, 92vw); box-shadow: var(--shadow); overflow: hidden;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { color: var(--gold-soft); font-size: 17px; }
.modal-close { border: 0; background: transparent; color: var(--text-dim); font-size: 18px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; display: grid; gap: 14px; }
.modal-body .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-body input, .modal-body select, .modal-body textarea { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); }
.field-note { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input { width: auto; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--panel-2); border: 1px solid var(--gold); color: var(--text);
  padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow);
  z-index: 80; opacity: 0; transition: opacity .2s ease, transform .2s ease; font-size: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================ ONGLETS (vues) */
.view { display: none; }
.view.active { display: flex; flex-direction: column; gap: 22px; }

/* sous-onglets de Ressources */
.sub-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sub-tab {
  border: 1px solid var(--line); background: var(--panel); color: var(--text-dim);
  padding: 7px 15px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 550;
  transition: all .12s ease;
}
.sub-tab:hover { color: var(--text); border-color: var(--gold); }
.sub-tab.active { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: #1a1408; border-color: transparent; }

/* layout Ressources : liste + panneau familier */
.ress-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.ress-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ress-side {
  background: linear-gradient(180deg, #2c2415, #251d11);
  border: 1px solid rgba(212,164,55,.4); border-radius: var(--radius);
  padding: 16px; position: sticky; top: 90px; display: flex; flex-direction: column; gap: 10px;
}
.side-head { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--gold-soft); font-weight: 600; }
.ress-side select { width: 100%; }
#side-summary { display: flex; flex-direction: column; gap: 8px; }
.side-row { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
.side-row span:first-child { color: var(--text-dim); }
.side-row b { font-variant-numeric: tabular-nums; }
#side-configure { align-self: flex-start; }

/* facettes (catégories / métiers) */
.facet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.facet-chip {
  text-align: left; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 12px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 550;
  display: flex; justify-content: space-between; align-items: center; transition: all .12s ease;
}
.facet-chip:hover { border-color: var(--gold); background: var(--panel-2); }
.facet-count { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }

/* fil d'ariane du drill */
.drill-head { display: flex; align-items: center; gap: 12px; }
.drill-title { font-size: 16px; font-weight: 650; color: var(--gold-soft); }

/* arbre de zones */
.zone-tree { display: flex; flex-direction: column; gap: 14px; max-height: 70vh; overflow-y: auto; padding-right: 6px; }
.zone-area-name { font-size: 13px; font-weight: 600; color: var(--gold-soft); margin-bottom: 7px; }
.zone-subs { display: flex; flex-wrap: wrap; gap: 7px; }
.zone-sub {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all .12s ease;
}
.zone-sub:hover { border-color: var(--gold); background: var(--panel-2); color: var(--gold-soft); }

/* étoile watchlist */
.icon-btn.star { font-size: 15px; }
.icon-btn.star.on { color: var(--gold); }

@media (max-width: 860px) {
  .ress-layout { grid-template-columns: 1fr; }
  .ress-side { position: static; order: -1; }
}

/* ============================================ ÉCRAN UNIQUE — panneaux */
main { display: block; }
main > .view { max-width: 1180px; margin: 0 auto; }
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.panel[hidden] { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 18px; color: var(--gold-soft); }

.fam-picker { display: flex; align-items: center; gap: 8px; }
.fam-picker select { min-width: 200px; }

/* config */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.config-grid label { font-weight: 550; color: var(--text); margin-bottom: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.config-grid input, .config-grid select { width: 100%; }
.config-grid label.readonly input { color: var(--text-dim); }

/* cartes résumé (objectif + progression) */
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.sum-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px;
}
.sum-card.good { border-color: rgba(111,191,79,.5); background: var(--green-bg); }
.sum-card.danger { border-color: rgba(224,107,90,.5); background: var(--red-bg); }
.sum-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.sum-value { font-size: 23px; font-weight: 700; color: var(--gold-soft); margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.sum-card.good .sum-value { color: var(--green); }
.sum-card.danger .sum-value { color: var(--red); }
.sum-sub { font-size: 12px; color: var(--text-dim); }
.warn-banner {
  grid-column: 1 / -1; background: var(--red-bg); border: 1px solid rgba(224,107,90,.5);
  border-radius: 10px; padding: 12px 16px; font-size: 13.5px; color: var(--text);
}

/* statut + barre de progression */
.status { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.status.neutral { background: var(--panel); color: var(--text-dim); }
.status.ok { background: rgba(212,164,55,.15); color: var(--gold-soft); }
.status.good { background: var(--green-bg); color: var(--green); }
.status.danger { background: var(--red-bg); color: var(--red); }
.progress-bar-wrap { height: 9px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); transition: width .3s ease; }
.progress-bar.good { background: linear-gradient(90deg, #4f9f37, var(--green)); }
.progress-bar.danger { background: linear-gradient(90deg, #b8463a, var(--red)); }

/* groupes ressources utilisées */
.group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; background: var(--bg-2); }
.group.open { border-color: rgba(212,164,55,.4); }
.group-head {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: transparent; border: 0; color: var(--text); cursor: pointer;
  padding: 13px 16px; font-size: 14.5px; transition: background .12s ease;
}
.group-head:hover { background: var(--panel-2); }
.chev { color: var(--gold); width: 14px; }
.group-name { font-weight: 600; color: var(--gold-soft); min-width: 160px; }
.group-summary { color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.group-detail { padding: 4px 12px 12px; }
.entry-row {
  display: grid; grid-template-columns: 72px 70px 70px 70px 1fr 1fr 1fr 1fr 72px;
  align-items: center; gap: 8px; padding: 8px 6px; font-size: 13px;
  border-top: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.entry-row.head { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-top: 0; }
.entry-row .strong, .num.strong, td.strong { font-weight: 600; color: var(--text); }
.entry-idx { color: var(--text-dim); }
.entry-actions { text-align: right; }

/* tableau des ressources : lignes dépliables */
.res-row { cursor: pointer; }
.res-row .chev { display: inline-block; color: var(--gold); width: 16px; font-size: 12px; }
.res-row.open { background: var(--panel-2); }
.res-row.open .res-name { color: var(--gold-soft); }
.res-detail td { background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 0; }
.lot-prices { display: flex; flex-wrap: wrap; gap: 18px; padding: 11px 16px 11px 46px; font-size: 13px; color: var(--text-dim); align-items: baseline; }
.lot-prices .lot-label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.lot-prices b { color: var(--gold-soft); font-variant-numeric: tabular-nums; margin-left: 3px; }

/* bouton + du tableau */
.icon-btn.add { background: rgba(212,164,55,.14); color: var(--gold-soft); font-weight: 700; font-size: 16px; padding: 3px 11px; border-radius: 8px; }
.icon-btn.add:hover { background: var(--gold); color: #1a1408; }
.icon-btn.add:disabled { opacity: .3; cursor: not-allowed; }
.icon-btn.add:disabled:hover { background: rgba(212,164,55,.14); color: var(--gold-soft); }

/* modale d'achat */
.modal-body .grid3 { display: grid; grid-template-columns: 1.2fr .8fr 1fr; gap: 12px; }
.modal-res { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 4px; }
.modal-res-name { font-size: 17px; font-weight: 650; color: var(--gold-soft); }
.modal-res-xp { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.advised { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.advised-title { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.advised-grid, .preview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; font-size: 12px; color: var(--text-dim); }
.advised-grid b, .preview-grid b { display: block; color: var(--gold-soft); font-size: 14px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.preview { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 10px; }
.preview-grid b { color: var(--text); }
.preview-impact { font-size: 13px; color: var(--text-dim); }
.preview-impact b { color: var(--text); font-variant-numeric: tabular-nums; }
.verdict { font-size: 13px; padding: 8px 12px; border-radius: 8px; }
.verdict.good { background: var(--green-bg); color: var(--green); }
.verdict.bad { background: var(--red-bg); color: var(--red); }

/* ressource sans XP (à renseigner) */
.tag-verify {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--gold-soft); background: rgba(212,164,55,.14);
  border: 1px solid rgba(212,164,55,.35); border-radius: 999px; padding: 1px 8px;
  white-space: nowrap;
}
.res-row.no-xp .res-name { color: var(--text-dim); }

/* modale d'édition de ressource */
.res-edit { display: grid; gap: 12px; }
.res-edit label { font-weight: 550; color: var(--text); display: flex; flex-direction: column; gap: 6px; }

/* bonus du familier sélectionné (onglet Familiers) */
.fam-bonus-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin: 14px 0 4px;
}
.fam-bonus-head { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: 10px; }
.fam-bonus-note { font-size: 12px; color: var(--text-dim); margin-top: 10px; line-height: 1.5; }
.fam-bonus-table { width: 100%; border-collapse: collapse; }
.fam-bonus-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); padding: 4px 10px 8px; font-weight: 600; }
.fam-bonus-table th.num, .fam-bonus-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.fam-bonus-table td { padding: 5px 10px; border-top: 1px solid var(--line); color: var(--text); }
.fam-bonus-table td.strong { color: var(--gold-soft); font-weight: 600; }
.seuil-tag { font-size: 10px; color: var(--gold-soft); background: rgba(212,164,55,.12); border: 1px solid rgba(212,164,55,.3); border-radius: 5px; padding: 0 5px; margin-left: 4px; white-space: nowrap; }

/* encyclopédie des familiers (liste sobre) */
.ency-filters { display: flex; gap: 10px; margin-bottom: 14px; }
.ency-filters #ency-search { flex: 1; }
.ency-filters select { width: auto; }
.ency-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 10px 4px; border-bottom: 1px solid var(--line);
}
.ency-main { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.ency-name { font-weight: 600; color: var(--text); }
.ency-type { font-size: 12px; color: var(--text-dim); }
.ency-stats { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.ency-stat {
  font-size: 12px; color: var(--gold-soft); background: rgba(212,164,55,.1);
  border: 1px solid rgba(212,164,55,.25); border-radius: 6px; padding: 2px 8px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
@media (max-width: 760px) {
  .ency-row { flex-direction: column; gap: 6px; }
  .ency-stats { justify-content: flex-start; }
}

@media (max-width: 760px) {
  header { flex-wrap: wrap; gap: 12px; }
  main { padding: 18px; }
  .group-summary { display: none; }
  .entry-row { grid-template-columns: 1fr 1fr; }
  .entry-row.head { display: none; }
}

/* ---------------------------------------------------------------- écran de code */
.login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, #2a2113 0%, var(--bg) 60%);
}
/* L'attribut hidden doit l'emporter sur le display:flex ci-dessus (priorité CSS). */
.login-overlay[hidden] { display: none; }
.login-box {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: 100%; max-width: 360px;
  padding: 36px 32px; text-align: center;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.login-logo { font-size: 44px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.login-box h2 { font-size: 20px; color: var(--gold-soft); }
.login-sub { margin: 0; color: var(--text-dim); font-size: 14px; }
.login-box input {
  width: 100%; margin-top: 6px;
  padding: 12px 14px; font-size: 15px; text-align: center;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; color: var(--text);
}
.login-box input:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,164,55,.15);
}
.login-btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.login-error {
  width: 100%; color: var(--red); font-size: 13px;
  background: var(--red-bg); padding: 8px 12px; border-radius: 8px;
}
