/* =========================================================
   🍌 Banane Corp — Interface spatiale (Canvas + overlays)
   Thème sombre spatial / vert végétal
   ========================================================= */

:root {
  --bg: #2b5a26;                            /* sous le canvas (repli si rendu absent) */
  --panel: rgba(46, 32, 18, 0.94);          /* bois foncé chaud */
  --panel-2: #2e2115;
  --line: #5b4126;
  --line-soft: #43301c;
  --txt: #f8eed8;
  --txt-dim: #c8ae87;
  --txt-mute: #9b8462;
  --leaf: #6cc94f;                          /* vert feuille */
  --leaf-dim: #4a9a33;
  --banana: #ffd23f;
  --banana-dark: #e09a12;
  --coin: #ffd23f;
  --red: #e2553f;
  --leaf-soft: rgba(108, 201, 79, 0.15);
  --r: 12px;
  --r-sm: 8px;
  --mono: ui-monospace, "SF Mono", Consolas, Menlo, monospace;
  --shadow: 0 8px 30px rgba(20, 12, 4, .5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--txt);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

#app { position: relative; width: 100%; height: 100%; background: var(--bg); }

#map {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hidden { display: none !important; }

/* ================= BARRE HAUTE ================= */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(38, 26, 12, .88), rgba(38, 26, 12, .3) 70%, transparent);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { font-size: 26px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)); }
.brand h1 { font-size: 17px; font-weight: 800; letter-spacing: .3px; }

.kpis { display: flex; gap: 8px; margin-left: 8px; flex-wrap: wrap; }

.kpi {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 96px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  backdrop-filter: blur(8px);
}
.kpi-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--txt-mute); }
.kpi-value { font-family: var(--mono); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-unit { font-size: 10px; color: var(--txt-mute); margin-left: 3px; }
.kpi-coins { border-color: rgba(255, 210, 63, .4); background: rgba(255, 210, 63, .1); }
.kpi-coins .kpi-value { color: var(--coin); }
.kpi-cash .kpi-value { color: var(--leaf); }

/* ── Lignage : la graine permanente ── */
.kpi-seed {
  border-color: rgba(139, 212, 95, .38);
  background: linear-gradient(180deg, rgba(139, 212, 95, .16), rgba(139, 212, 95, .04));
}
.kpi-seed .kpi-value { color: #a8e878; }
.kpi-seed.zero { opacity: .5; }

.btn-lignage {
  background: linear-gradient(180deg, #a8e878, #4e9b34);
  color: #12300a;
  box-shadow: 0 3px 0 #2f6a1e;
}
.btn-lignage:active:not(:disabled) { box-shadow: 0 1px 0 #2f6a1e; }
.btn-lignage:disabled { box-shadow: none; }

.dock-seed { color: #a8e878; }
.dock-seed:hover { color: #c6f5a0; background: rgba(139, 212, 95, .14); border-color: rgba(139, 212, 95, .35); }

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  font-size: 12.5px;
}
.score-row b { font-family: var(--mono); color: var(--banana); font-size: 13px; }
.score-row.total { margin-top: 6px; padding-top: 9px; border-top: 1px solid var(--line); font-weight: 700; }
.score-row.total b { color: #a8e878; font-size: 15px; }

/* ── bilan de saison : ce que l'on perd, ce que l'on garde ── */
.loss {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 122, 90, .3);
  border-left: 3px solid rgba(255, 122, 90, .75);
  border-radius: 8px;
  background: rgba(255, 122, 90, .07);
}
.loss-t { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #ff8f70; }
.loss-l { margin-top: 5px; font-size: 12.5px; color: var(--txt); }
.loss-k { margin-top: 5px; font-size: 12px; color: var(--leaf); }

/* ── les deux façons de clôturer ── */
.closures { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 0; }
@media (max-width: 620px) { .closures { grid-template-columns: 1fr; } }
.closure-card {
  padding: 11px 12px;
  border: 1px solid rgba(168, 232, 120, .45);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(139, 212, 95, .13), rgba(139, 212, 95, .03));
  cursor: pointer;
  transition: border-color .15s, transform .08s, background .15s;
}
.closure-card:hover { border-color: #a8e878; background: rgba(139, 212, 95, .2); }
.closure-card:active { transform: scale(.99); }
.closure-t { font-size: 12.5px; font-weight: 800; color: var(--leaf); }
.closure-g { font-family: var(--mono); font-size: 19px; font-weight: 800; color: #a8e878; margin: 3px 0 5px; }
.closure-n { font-size: 11px; line-height: 1.45; color: var(--txt-mute); }

/* ── carte « banque de graines » : l'information, pas un bouton ── */
.seedcard {
  border: 1px solid rgba(168, 232, 120, .38);
  border-radius: 12px;
  padding: 12px 13px;
  background: linear-gradient(180deg, rgba(139, 212, 95, .15), rgba(139, 212, 95, .03));
  margin-bottom: 6px;
}
.seedcard-top { display: flex; gap: 14px; }
.seedcard-top > div { flex: 1; }
.seedcard-top > div:last-child { text-align: right; }
.seedcard-top .sub { margin: 0 0 2px; }
.seedcard-top b {
  display: block;
  font-family: var(--mono);
  font-size: 25px;
  font-weight: 800;
  line-height: 1.1;
  color: #a8e878;
}
.seedcard-top > div:last-child b { font-size: 19px; color: var(--banana); }

/* butée : le prochain achat que la banque ne couvre pas encore */
.goal { margin-top: 11px; }
.goal-h {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 11.5px;
  min-width: 0;
}
.goal-l {
  flex: none;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--txt-mute);
}
.goal-n {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--txt-dim);
}
.goal-c { flex: none; font-family: var(--mono); font-size: 12px; font-weight: 700; color: #a8e878; }
.gbar {
  height: 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .42);
  border: 1px solid rgba(0, 0, 0, .3);
  overflow: hidden;
}
.gbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf-dim), #a8e878); transition: width .25s ease; }

/* le palier ×2 d'une statistique de parcelle */
.lvl.palier { color: var(--banana); font-weight: 700; }
.goal-note { margin-top: 5px; font-size: 11px; color: var(--txt-mute); }

/* « d'où vient la graine ? » : replié par défaut, la boucle s'apprend à la demande */
.why {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 9px;
  padding: 6px 2px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--txt-dim);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.why:hover { color: #a8e878; }
.why i { font-style: normal; transition: transform .18s ease; }
.why.open i { transform: rotate(180deg); }
.score-detail { display: none; }
.why.open + .score-detail { display: block; animation: fadeIn .18s ease; }
.score-detail .scores { padding-top: 6px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── ligne d'outillage ── */
.mrow {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 9px 11px;
  margin-bottom: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .08s;
}
.mrow:hover { border-color: rgba(255, 210, 63, .4); }
.mrow:active { transform: scale(.99); }
.mrow.afford { border-color: rgba(168, 232, 120, .5); background: rgba(139, 212, 95, .09); }
.mrow.best { border-color: rgba(255, 210, 63, .5); }
.mrow.best.afford { border-color: rgba(168, 232, 120, .75); background: rgba(139, 212, 95, .14); }
.mrow-ico { font-size: 17px; text-align: center; }
.mrow-body { min-width: 0; }
.mrow-name { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 700; }
.mrow-name .lvl { font-family: var(--mono); font-size: 10.5px; font-weight: 400; color: var(--txt-mute); }
.mrow-bar { height: 4px; margin: 5px 0 4px; border-radius: 3px; background: rgba(0, 0, 0, .4); overflow: hidden; }
.mrow-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf-dim), var(--leaf)); }
.mrow-desc { font-family: var(--mono); font-size: 10.5px; color: var(--leaf); }
.mrow-cta { text-align: right; }
.mrow-cost, .mrow-need { font-family: var(--mono); font-size: 12px; font-weight: 700; white-space: nowrap; }
.mrow-cost { color: #a8e878; }
.mrow-need { color: var(--txt-mute); }
.mrow-max { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; color: var(--banana); }
.mrow-tag {
  position: absolute;
  top: -7px; left: 10px;
  padding: 1px 7px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #3d2606;
  background: var(--banana);
  border-radius: 6px;
}
.mrow.ready { animation: pulseSeed 1.8s ease-in-out infinite; }

/* ── branches d'outillage : une seule active à la fois ── */
.branch {
  margin-bottom: 8px;
  padding: 9px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
}
.branch.on { border-color: rgba(168, 232, 120, .5); background: rgba(139, 212, 95, .07); }
.branch-h { display: flex; align-items: center; gap: 9px; margin-bottom: 2px; }
.branch-e { font-size: 17px; }
.branch-n { flex: 1; min-width: 0; }
.branch-t { font-size: 12.5px; font-weight: 700; color: var(--txt); }
.branch-s { font-size: 10.5px; color: var(--txt-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-tag {
  flex: none;
  padding: 2px 8px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #12300a;
  background: #a8e878;
  border-radius: 6px;
}
.branch-go {
  flex: none;
  padding: 5px 11px;
  border: 1px solid rgba(168, 232, 120, .4);
  border-radius: 8px;
  background: rgba(139, 212, 95, .1);
  color: #a8e878;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.branch-go:hover { background: rgba(139, 212, 95, .24); border-color: #a8e878; }
.branch-on .mrow:last-child { margin-bottom: 0; }
@keyframes pulseSeed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 232, 120, .35); }
  50% { box-shadow: 0 0 0 4px rgba(168, 232, 120, 0); }
}

/* ── terres à découvrir ── */
.lands { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
@media (max-width: 620px) { .lands { grid-template-columns: repeat(2, 1fr); } }
.land {
  padding: 11px 5px 9px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.land:hover { border-color: rgba(168, 232, 120, .45); }
.land.afford { border-style: solid; border-color: rgba(168, 232, 120, .55); background: rgba(139, 212, 95, .1); }
.land.done { border-style: solid; cursor: default; border-color: rgba(108, 201, 79, .4); }
.land .ic { font-size: 20px; display: block; margin-bottom: 3px; }
.land .n { font-size: 10.5px; color: var(--txt-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.land .c { font-family: var(--mono); font-size: 11px; font-weight: 700; color: #a8e878; margin-top: 2px; }
.land.done .c { color: var(--banana); }

/* ── goulot : le maillon faible, en clair ── */
.bridge {
  margin-top: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--leaf);
  border-radius: 8px;
  background: var(--panel-2);
  font-size: 12px;
  line-height: 1.45;
  color: var(--txt-dim);
}
.bridge.ok { border-left-color: var(--leaf); }
.bridge.warn { border-left-color: var(--banana); color: #e6d9a8; }
.bridge.bad { border-left-color: var(--red); color: #ffb0a0; background: rgba(255, 122, 90, .08); }

/* ── fin de partie ── */
.mastery {
  margin-bottom: 8px;
  padding: 12px 13px;
  border: 1px solid rgba(255, 210, 63, .5);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 210, 63, .16), rgba(255, 210, 63, .04));
}
.mastery-t { font-size: 14px; font-weight: 800; color: var(--banana); letter-spacing: .02em; }
.mastery p { margin: 6px 0 10px; font-size: 12px; line-height: 1.5; color: var(--txt-dim); }
.career .score-row b { color: var(--banana); }

/* ── export / import ── */
.save-io {
  width: 100%;
  min-height: 120px;
  margin: 8px 0 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .35);
  color: var(--txt);
  font-family: var(--mono);
  font-size: 11px;
  resize: vertical;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.save-state { font-size: 11px; color: var(--txt-mute); font-family: var(--mono); }

/* ================= BOUTONS ================= */
.btn {
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  color: #3d2606;
  background: linear-gradient(180deg, #ffe066, var(--banana-dark));
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 14px;
  box-shadow: 0 3px 0 #a9700a;
  cursor: pointer;
  transition: filter .12s, transform .08s, opacity .12s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #a9700a; }
.btn:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.btn-ghost { background: var(--panel-2); color: var(--txt); border: 1px solid var(--line); box-shadow: none; }
.btn-ghost:hover { background: #3d2c1b; }
.btn-danger { background: var(--panel-2); color: #ffab96; border: 1px solid rgba(226, 85, 63, .35); box-shadow: none; }
.btn-danger:hover { background: rgba(226, 85, 63, .16); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-wide { width: 100%; margin-top: 12px; padding: 10px; }

.close {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--txt-dim);
  border-radius: 8px;
  width: 30px; height: 30px;
  cursor: pointer;
  font-size: 14px;
}
.close:hover { background: rgba(255, 255, 255, .07); color: var(--txt); }

/* ================= PANNEAU LATÉRAL ================= */
.panel {
  position: absolute;
  top: 72px;
  right: 14px;
  bottom: 84px;
  width: min(380px, 92vw);
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
  animation: slide-in .2s ease;
}
@keyframes slide-in { from { transform: translateX(18px); opacity: 0; } to { transform: none; opacity: 1; } }

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 15px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.panel-head h2 { font-size: 17px; font-weight: 800; }
.panel-head p { font-size: 11.5px; color: var(--txt-mute); margin-top: 2px; }
.panel-head .close { margin-left: auto; flex-shrink: 0; }

.panel-body { flex: 1; overflow-y: auto; padding: 13px 15px 18px; min-height: 0; }

.section-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--txt-mute);
  margin: 16px 0 9px;
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.section-title:first-child { margin-top: 0; }

.callout { font-size: 12.5px; color: var(--txt-dim); line-height: 1.6; }
.callout .warn { color: var(--coin); margin: 8px 0; }

/* --- lignes d'amélioration --- */
.upg {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
}
.upg-ico { font-size: 18px; text-align: center; }
.upg-name { font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.upg-lvl { font-family: var(--mono); font-size: 11px; color: var(--txt-mute); font-weight: 500; }
.upg-val { font-family: var(--mono); font-size: 11.5px;  color: var(--leaf);
  margin-top: 3px;
  white-space: nowrap; }

.cost {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--banana);
  background: none;
  border: 1px solid rgba(255, 210, 63, .4);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s;
}
.cost:hover:not(:disabled) { background: rgba(255, 210, 63, .14); }
.cost:disabled { color: var(--txt-mute); border-color: var(--line); cursor: not-allowed; }

/* --- état de la cueillette --- */
.diag { margin: 2px 0 6px; }
.diag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--txt-dim);
  border-bottom: 1px dashed var(--line-soft);
}
.diag-row:last-child { border-bottom: none; }
.diag-row b { font-family: var(--mono); font-size: 12.5px; color: var(--txt); font-weight: 600; }

/* --- barres --- */
.bar {
  height: 8px;
  background: #0a1410;
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #b5892b, var(--coin));
  transition: width .15s linear;
}
.bar-load > i { background: linear-gradient(90deg, #2b93bd, #4cc9f0); }

/* --- ateliers --- */
.machine {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 11px;
  margin-bottom: 9px;
}
.machine.locked { opacity: .7; }
.m-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.m-head .emoji { font-size: 18px; }
.m-head .name { font-size: 13px; font-weight: 700; }
.m-head .val { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--coin); }
.m-recipe { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 11.5px; color: var(--txt-dim); margin-bottom: 8px; }
.m-recipe .ing.out { color: var(--leaf); font-weight: 700; }
.m-recipe .arrow { color: var(--txt-mute); }
.m-foot { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.m-foot .cycle { font-family: var(--mono); font-size: 11px; color: var(--txt-mute); margin-right: auto; }

.switch {
  font: inherit; font-size: 11.5px; font-weight: 700;
  padding: 5px 11px; border-radius: 99px; cursor: pointer;
  background: var(--panel-2); color: var(--txt-mute);
  border: 1px solid var(--line);
}
.switch.on { background: var(--leaf-soft); color: var(--leaf); border-color: rgba(108, 201, 79, .45); }
.switch:disabled { opacity: .4; cursor: not-allowed; }

/* --- projets --- */
.tech {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 11px;
  margin-bottom: 8px;
}
.tech.done { border-color: rgba(108, 201, 79, .45); background: var(--leaf-soft); }
.tech.blocked { opacity: .55; }
.tech-head { display: flex; align-items: center; gap: 8px; }
.tech-head .emoji { font-size: 18px; }
.tech-head .name { font-size: 13px; font-weight: 700; }
.tech-head .tick { margin-left: auto; color: var(--leaf); }
.tech-head .name { flex: 1; }
.tech-desc { font-size: 11.5px; color: var(--txt-dim); margin: 5px 0 8px; line-height: 1.5; }
.tech-req { font-size: 11px; color: var(--coin); margin-bottom: 7px; }
.tech-cost { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  color: var(--txt-mute);
  background: none;
  cursor: pointer;
}
.pill.ok { color: var(--banana); border-color: rgba(255, 210, 63, .4); }
.pill.ok:hover { background: rgba(255, 210, 63, .14); }
.pill.no { color: var(--red); border-color: rgba(226, 85, 63, .35); cursor: not-allowed; }
.pill.item.ok { color: var(--leaf); border-color: rgba(108, 201, 79, .45); }

/* --- vente --- */
.sale-row {
  display: grid;
  grid-template-columns: 22px 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  margin-bottom: 6px;
}
.sale-row.zero { opacity: .45; }
.sale-row .upg-name { font-size: 12.5px; }
.sale-row .sub { font-size: 10.5px; color: var(--txt-mute); }
.sale-row .qty { font-family: var(--mono); font-size: 13px; font-weight: 700; min-width: 46px; text-align: right; }
.sale-row .sum { font-family: var(--mono); font-size: 11.5px; color: var(--coin); min-width: 62px; text-align: right; }

.sale-actions { display: flex; gap: 7px; margin: 11px 0 4px; }
.sale-actions .btn { flex: 1; }

.auto-box { margin-top: 14px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm); }
.auto-box h4 { font-size: 12.5px; margin-bottom: 4px; }
.auto-box p { font-size: 11px; color: var(--txt-mute); line-height: 1.5; }
.pct-row { display: flex; gap: 5px; margin-top: 9px; flex-wrap: wrap; }
.pct {
  font: inherit; font-size: 11.5px; font-weight: 700;
  padding: 5px 9px; border-radius: 99px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--txt-mute);
}
.pct.on { background: rgba(255, 210, 63, .18); color: var(--banana); border-color: rgba(255, 210, 63, .5); }
.pct:disabled { opacity: .4; cursor: not-allowed; }

/* ================= DOCK ================= */
.dock {
  position: absolute;
  left: 50%;
  bottom: 46px;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.dock-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--txt-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}
.dock-btn:hover { color: var(--banana); background: rgba(255, 210, 63, .1); border-color: rgba(255, 210, 63, .3); }
.dock-hint { font-size: 11.5px; color: var(--txt-mute); padding: 0 12px 0 6px; }

/* ================= PIED ================= */
.statusbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 18px;
  background: linear-gradient(0deg, rgba(38, 26, 12, .95), rgba(38, 26, 12, .4) 70%, transparent);
  font-size: 12px;
  color: var(--txt-dim);
  pointer-events: none;
}
.statusbar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--banana); box-shadow: 0 0 8px rgba(255, 210, 63, .8); flex-shrink: 0; }

/* ================= MODALE ================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 16, 6, .82);
  backdrop-filter: blur(3px);
  padding: 20px;
}
.modal-card {
  width: min(520px, 94vw);
  max-height: 84vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  animation: slide-in .2s ease;
}
.modal-card h3 { font-size: 18px; margin-bottom: 12px; color: var(--banana); }
.modal-card h4 { font-size: 13px; margin: 15px 0 5px; }
.modal-card p, .modal-card li { font-size: 12.5px; color: var(--txt-dim); line-height: 1.65; }
.modal-card ul { padding-left: 18px; }
.modal-card .big { font-family: var(--mono); font-size: 25px; font-weight: 800; color: var(--coin); margin: 8px 0; }
.report-grid { display: grid; grid-template-columns: 1fr auto; gap: 5px 14px; margin: 12px 0; }
.report-grid .k { font-size: 12px; color: var(--txt-dim); }
.report-grid .v { font-family: var(--mono); font-size: 13px; text-align: right; color: var(--leaf); }
.diag-row b { color: var(--banana); }

/* ================= ATELIER DE TRICHE ================= */
.cheat-state {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--banana);
}

.cheat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.cheat-row:last-of-type { border-bottom: none; }
.cheat-info { flex: 1; min-width: 0; }
.cheat-name { font-size: 13px; font-weight: 700; }
.cheat-hint { font-size: 11.5px; color: var(--txt-mute); margin-top: 2px; line-height: 1.45; }
.cheat-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 55%; }
.cheat-actions .btn { font-size: 12px; padding: 6px 10px; }

.cheat-msg {
  margin-top: 14px;
  padding: 9px 12px;
  background: var(--leaf-soft);
  border-left: 3px solid var(--leaf);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 12px;
  color: #d8f0c8;
}

/* ================= TOAST ================= */
.toast {
  position: fixed;
  right: 18px;
  bottom: 100px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: flex-end;
  pointer-events: none;
}
.toast-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--leaf);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: slide-in .2s ease;
}
.toast-item.err { border-left-color: var(--red); }
.toast-item.gold { border-left-color: var(--banana); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #5b4126; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #7a5731; }

/* ================= RESPONSIVE ================= */
@media (max-width: 1150px) {
  /* la barre haute se charge : on compacte les boutons secondaires */
  #btnSave { font-size: 0; padding: 8px 11px; }
  #btnSave::after { content: "💾"; font-size: 13px; }
  .save-state { display: none; }
}
@media (max-width: 900px) {
  .brand h1 { display: none; }
  .kpi { min-width: 0; flex: 1; padding: 5px 9px; }
  .kpi-value { font-size: 14.5px; }
  .dock-hint { display: none; }
  .panel { top: 66px; bottom: 76px; }
}
@media (max-width: 620px) {
  .topbar { padding: 9px 11px; gap: 10px; }
  .kpis { order: 3; width: 100%; }
  #btnSave { font-size: 0; padding: 8px 11px; }
  #btnSave::after { content: "💾"; font-size: 14px; }
  .dock { bottom: 40px; }
  .dock-btn { padding: 6px 10px; font-size: 11.5px; }
}
