:root {
  --bg:         #08071a;
  --card:       #0f0e22;
  --card2:      #161529;
  --steel:      #18172c;
  --rivet:      #262440;
  --text:       #ede9ff;
  --muted:      #7b79a0;
  --border:     rgba(255,255,255,0.07);
  --accent:     #e6384a;
  --gold:       #ffd23f;
  --green:      #52b788;
  --ring-track: rgba(255,255,255,0.06);
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124,58,237,0.12), transparent),
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: auto, 36px 36px, 36px 36px;
}

/* ── HEADER ─────────────────────────────────────────── */

header {
  background: rgba(8,7,26,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 0 28px;
  height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 8px 32px rgba(0,0,0,0.5);
  gap: 16px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.logo span {
  background: linear-gradient(135deg, #ff4d5a 0%, #f4a261 60%, #ffd23f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.money-display {
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: rgba(255,210,63,0.08);
  border: 1px solid rgba(255,210,63,0.18);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
}

.save-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}
.save-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }

.logout-btn {
  background: rgba(230,57,70,0.08);
  border: 1px solid rgba(230,57,70,0.2);
  border-radius: var(--radius-sm);
  color: rgba(230,57,70,0.7);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}
.logout-btn:hover { background: rgba(230,57,70,0.18); color: #ff6b78; }

.player-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.player-badge:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.16);
  color: var(--text);
}
.player-icon { font-size: 0.85rem; opacity: 0.7; }

.save-status {
  font-size: 0.65rem;
  color: var(--muted);
  cursor: default;
  opacity: 0.6;
}
.save-status.save-ok  { color: var(--green); opacity: 1; }
.save-status.save-err { color: var(--accent); opacity: 1; }

#money-value {
  color: var(--gold);
  min-width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.money-euro { color: rgba(255,210,63,0.5); font-size: 0.9rem; }

/* ── WEATHER BOX ────────────────────────────────────── */

.weather-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 99px;
  padding: 5px 12px 5px 8px;
  font-size: 0.78rem;
  font-weight: 500;
}

.weather-icon  { font-size: 1.1rem; }
.weather-name  { font-weight: 700; font-size: 0.8rem; }
.weather-timer { color: var(--muted); font-size: 0.7rem; font-variant-numeric: tabular-nums; }

.weather-bar-wrap {
  width: 48px;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
}

.weather-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 1s linear;
}

/* ── PRESTIGE ───────────────────────────────────────── */

.prestige-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #ffd23f 100%);
  border: none;
  border-radius: 99px;
  padding: 7px 18px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  animation: prestige-glow 2s ease-in-out infinite;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

@keyframes prestige-glow {
  0%,100% { box-shadow: 0 0 12px rgba(124,58,237,0.45), 0 0 0 1px rgba(124,58,237,0.3); }
  50%      { box-shadow: 0 0 28px rgba(255,210,63,0.6),  0 0 0 1px rgba(255,210,63,0.4); }
}

.prestige-btn:hover { opacity: 0.88; transform: scale(1.02); }

/* ── APP LAYOUT (sidebar + main) ────────────────────── */

.app-layout {
  display: flex;
  min-height: calc(100vh - 58px);
}

.app-main {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

.market-badge {
  font-size: 0.58rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 5px;
  flex-shrink: 0;
  white-space: nowrap;
}
.market-up   { background: rgba(82,183,136,0.18); color: var(--green); }
.market-down { background: rgba(230,57,70,0.18);  color: var(--accent); }
.market-flat { background: rgba(255,255,255,0.06); color: var(--muted); }

.sell-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.sell-btn:hover:not(:disabled) {
  background: rgba(255,210,63,0.12);
  color: var(--gold);
  border-color: rgba(255,210,63,0.25);
}
.sell-btn:disabled { opacity: 0.18; cursor: not-allowed; }

/* ── TABS ───────────────────────────────────────────── */

.tab-bar {
  background: rgba(10,9,25,0.92);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 20px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 13px 15px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.18s, border-color 0.18s;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  letter-spacing: 0.01em;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 99px;
  padding: 1px 6px;
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 16px;
  text-align: center;
}

.tab-content         { display: none; }
.tab-content.active  { display: block; }

/* ── LINE SELECTOR ──────────────────────────────────── */

.line-selector {
  display: flex;
  gap: 8px;
  padding: 14px 20px 0;
  flex-wrap: wrap;
}

.line-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 99px;
  color: var(--muted);
  cursor: pointer;
  padding: 7px 18px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.line-btn:hover:not(:disabled) { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.16); color: var(--text); }

.line-btn.line-active {
  background: rgba(230,57,70,0.12);
  border-color: rgba(230,57,70,0.4);
  color: var(--accent);
}

.line-btn.line-locked {
  opacity: 0.5;
  border-style: dashed;
  font-size: 0.72rem;
}

.line-btn.line-locked:disabled { opacity: 0.28; cursor: not-allowed; }

/* ── CHAIN WRAPPER (sol d'usine) ────────────────────── */

.chain-wrapper {
  padding: 24px 28px 36px;
  background: #0b0a0f;
  background-image:
    linear-gradient(rgba(245,197,66,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,197,66,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  border-radius: var(--radius-lg);
  margin: 12px 16px 0;
  border: 1px solid rgba(245,197,66,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 4px 32px rgba(0,0,0,0.4);
}

/* Conteneur serpentin */
.factory-chain {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Structure : section = machines + bande de tapis ─── */

/* Conteneur d'une section (machines + tapis) */
.factory-section {
  display: flex;
  flex-direction: column;
}

/* Rangée de machines avec espacement automatique */
.machines-row {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: stretch;
  padding: 0 16px;
  gap: 12px;
}
.machines-row-reversed {
  flex-direction: row-reverse;
}

/* Machine dans la rangée */
.machines-row .factory-node {
  flex: 1;
  max-width: 320px;
  position: relative;
  z-index: 2;
}

/* Indicateur de connexion vers le tapis (bas pour rangée paire) */
.factory-section:not(.section-reversed) .machines-row .factory-node:not(.locked)::after {
  content: '';
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  width: 28px; height: 10px;
  background: linear-gradient(to bottom, #a07800, #f5c542);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 10px rgba(245,197,66,0.5);
  z-index: 3;
}

/* ── Bande de tapis pleine largeur ───────────────────── */
.belt-strip {
  position: relative;
  height: 54px;
  background-color: #16151a;
  background-image: repeating-linear-gradient(
    -55deg, transparent 0, transparent 9px,
    rgba(245,197,66,0.09) 9px, rgba(245,197,66,0.09) 18px
  );
  background-size: 26px 26px;
  animation: belt-roll 3s linear infinite;
  border-top: 5px solid #f5c542;
  border-bottom: 5px solid #f5c542;
  box-shadow:
    inset 0 4px 12px rgba(0,0,0,0.6),
    inset 0 -4px 8px rgba(0,0,0,0.45),
    0 0 20px rgba(245,197,66,0.07);
  overflow: hidden;
  display: flex;
}
.belt-strip-reversed {
  animation-direction: reverse;
}

/* Containers d'items animés (1 par usine, occupent chacun 1/3 du tapis) */
.belt-items-section {
  flex: 1;
  position: relative;
  height: 100%;
  overflow: hidden;
}

/* Connecteur de retour entre deux rangées */
/* Virage entre sections — prolonge le tapis (hauteur = séparation entre sections) */
.factory-turn {
  position: relative;
  height: 44px;
  margin: 0;
}
.factory-turn.turn-right {
  margin-left: auto;
  /* Largeur = épaisseur du tapis (height de belt-strip = 54px) */
  width: 54px;
  background: #16151a;
  border-right: 5px solid #f5c542;
  border-bottom: 5px solid #f5c542;
  border-bottom-right-radius: 16px;
}
.factory-turn.turn-left {
  margin-right: auto;
  width: 54px;
  background: #16151a;
  border-left: 5px solid #f5c542;
  border-bottom: 5px solid #f5c542;
  border-bottom-left-radius: 16px;
}

/* ── CONTENT INNER (non-production tabs) ────────────── */

.content-inner {
  padding: 28px 28px 60px;
  max-width: 1320px;
  margin: 0 auto;
}

/* ── FACTORY NODE ───────────────────────────────────── */

.factory-node {
  background: linear-gradient(160deg, #161528 0%, #111023 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  width: 100%;
  padding: 12px 14px 12px 12px;
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 3px solid var(--fc, #444);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.4s;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

.factory-node:not(.locked):hover {
  transform: translateY(-4px);
  box-shadow:
    0 12px 32px rgba(0,0,0,0.7),
    0 0 0 1px rgba(255,255,255,0.12),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

.factory-node.locked { opacity: 0.15; filter: grayscale(1) blur(0.5px); pointer-events: none; }

.factory-node.just-unlocked { animation: unlock-pop 0.5s cubic-bezier(0.34,1.56,0.64,1); }

@keyframes unlock-pop {
  0%   { transform: scale(0.85); opacity: 0.3; }
  100% { transform: scale(1);    opacity: 1;   }
}

/* ── NODE LAYOUT (horizontal) ───────────────────────── */

.node-ring-col {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
}

.node-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.node-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.node-stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recipe-arrow {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.75;
}

/* prod-mult badge (weather/prestige indicator) */
.node-mult-badge {
  flex-shrink: 0;
  font-size: 0.6rem;
  font-weight: 800;
  border-radius: 8px;
  padding: 2px 6px;
  display: none;
  align-self: center;
}

.node-mult-badge.active {
  display: block;
  background: rgba(255,215,0,0.2);
  color: var(--gold);
}

.node-mult-badge.penalty {
  display: block;
  background: rgba(230,57,70,0.2);
  color: var(--accent);
}

.node-mult-badge.stopped {
  display: block;
  background: rgba(100,100,100,0.3);
  color: #aaa;
}

/* ── RING PROGRESS ──────────────────────────────────── */

.ring-wrap { position: relative; width: 72px; height: 72px; flex-shrink: 0; }

.ring-wrap svg { transform: rotate(-90deg); }

.ring-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; pointer-events: none;
}

.ring-stall-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 800;
  color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em;
  opacity: 0; transition: opacity 0.25s; pointer-events: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
}

.ring-stall-overlay.visible { opacity: 1; animation: stall-pulse 1s ease-in-out infinite; }

@keyframes stall-pulse { 0%,100%{opacity:0.6}50%{opacity:1} }

/* ── NODE META ──────────────────────────────────────── */

.node-name  { font-size: 0.74rem; font-weight: 700; text-align: left; line-height: 1.3; color: rgba(255,255,255,0.85); }
.node-count { font-size: 1.8rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -0.03em; flex-shrink: 0; }

.node-recipe {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.68rem; color: var(--muted);
  flex-wrap: wrap; justify-content: flex-start;
}

.node-recipe-item {
  display: flex; align-items: center; gap: 2px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-sm); padding: 2px 6px;
  font-size: 0.66rem; font-weight: 600;
}

.node-rate {
  font-size: 0.58rem; color: var(--muted); text-align: left;
  min-height: 14px; width: 100%; word-break: break-all;
  opacity: 0.8;
}

.buy-btn-group {
  display: flex; gap: 4px; margin-top: 4px; width: 100%;
}

.buy-btn {
  flex: 1; min-width: 0; padding: 7px 6px; border: none;
  border-radius: var(--radius-sm);
  font-size: 0.7rem; font-weight: 700; cursor: pointer; color: #fff;
  background: var(--fcolor, #52b788);
  transition: opacity 0.15s, transform 0.12s, box-shadow 0.15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.buy-x1  { flex: 1.2; }
.buy-x10 { flex: 1.4; }
.buy-max { flex: 1; font-size: 0.65rem; opacity: 0.82; }

.buy-btn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.5); }
.buy-btn:active:not(:disabled){ transform: translateY(0); box-shadow: none; }
.buy-btn:disabled { opacity: 0.22; cursor: not-allowed; box-shadow: none; }

/* ── CONVEYOR BELT ──────────────────────────────────── */

.belt-segment {
  width: 72px; min-width: 72px; height: 130px;
  position: relative; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; z-index: 1;
}

/* Tambours / rouleaux aux extrémités */
.belt-segment::before, .belt-segment::after {
  content: ''; position: absolute; top: 50%; transform: translateY(-50%);
  width: 12px; height: 48px;
  background: linear-gradient(135deg, #3d2e00 0%, #c89600 40%, #f5c542 55%, #c89600 70%, #3d2e00 100%);
  border-radius: 4px; z-index: 3;
  border: 1px solid #f5c542;
  box-shadow: 0 0 10px rgba(245,197,66,0.35);
}
.belt-segment::before { left: -6px; }
.belt-segment::after  { right: -6px; }

/* Surface du tapis */
.belt-track {
  position: absolute; left: 0; right: 0;
  top: 50%; transform: translateY(-50%); height: 44px;
  background-color: #16151a;
  background-image: repeating-linear-gradient(
    -55deg,
    transparent 0px, transparent 9px,
    rgba(245,197,66,0.07) 9px, rgba(245,197,66,0.07) 18px
  );
  background-size: 26px 26px;
  animation: belt-roll 0.55s linear infinite;
  border-top: 5px solid #f5c542;
  border-bottom: 5px solid #f5c542;
  box-shadow:
    inset 0 3px 8px rgba(0,0,0,0.55),
    inset 0 -3px 6px rgba(0,0,0,0.4),
    0 0 12px rgba(245,197,66,0.1);
}

.belt-track::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom,
    rgba(255,255,255,0.07) 0%,
    transparent 50%,
    rgba(0,0,0,0.18) 100%);
  pointer-events: none;
}

@keyframes belt-roll {
  from { background-position: 0 0; }
  to   { background-position: 26px 0; }
}

.belt-segment.stalled .belt-track {
  animation-play-state: paused;
  border-color: #444;
  opacity: 0.4;
}

.belt-items {
  position: absolute; left: 0; right: 0;
  top: 50%; transform: translateY(-50%);
  height: 44px; overflow: hidden; pointer-events: none; z-index: 4;
}

/* ── ITEMS SORTANT DES MACHINES (position:fixed, coordonnées réelles) ── */

.belt-fly {
  position: fixed;
  font-size: 1.25rem;
  pointer-events: none;
  z-index: 200;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.8));
  transform-origin: center center;
}

/* Rangée normale : machine au-dessus → item tombe vers le tapis */
.belt-fly-down.fly-enters {
  animation: fly-down-enter 0.85s ease-in forwards;
}
.belt-fly-down.fly-passes {
  animation: fly-down-pass  0.85s ease-in forwards;
}

@keyframes fly-down-enter {
  0%   { transform: translateY(0)    scale(1);    opacity: 1; }
  55%  { transform: translateY(32px) scale(1);    opacity: 1; }
  85%  { transform: translateY(44px) scale(0.85); opacity: 0.8; }
  100% { transform: translateY(50px) scale(0.6);  opacity: 0; }
}
@keyframes fly-down-pass {
  0%   { transform: translate(0, 0)     scale(1);   opacity: 1; }
  50%  { transform: translate(8px, 30px) scale(1);  opacity: 1; }
  100% { transform: translate(18px, 50px) scale(0.6); opacity: 0; }
}

/* Rangée inversée : machine en-dessous → item monte vers le tapis */
.belt-fly-up.fly-enters {
  animation: fly-up-enter 0.85s ease-in forwards;
}
.belt-fly-up.fly-passes {
  animation: fly-up-pass  0.85s ease-in forwards;
}

@keyframes fly-up-enter {
  0%   { transform: translateY(0)     scale(1);    opacity: 1; }
  55%  { transform: translateY(-32px) scale(1);    opacity: 1; }
  85%  { transform: translateY(-44px) scale(0.85); opacity: 0.8; }
  100% { transform: translateY(-50px) scale(0.6);  opacity: 0; }
}
@keyframes fly-up-pass {
  0%   { transform: translate(0, 0)      scale(1);   opacity: 1; }
  50%  { transform: translate(-8px, -30px) scale(1); opacity: 1; }
  100% { transform: translate(-18px, -50px) scale(0.6); opacity: 0; }
}

/* ── UPGRADES ───────────────────────────────────────── */

.upgrade-group { margin-bottom: 28px; }

.upgrade-group-label {
  font-size: 0.67rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.upgrade-group-label:hover { color: var(--text); }

.upgrade-group-label::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.06);
}

.upg-group-chevron {
  font-size: 0.6rem; margin-left: 2px; display: inline-block;
  transition: transform 0.2s; flex-shrink: 0;
}
.upgrade-group.collapsed .upg-group-chevron { transform: rotate(-90deg); }
.upgrade-group.collapsed .upgrade-row { display: none; }

.upgrade-row { display: flex; flex-wrap: wrap; gap: 10px; }

.upgrade-card {
  background: var(--steel);
  border: 1px solid rgba(255,255,255,0.07);
  border-left: 3px solid var(--factory-color, #555);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  width: 215px; min-width: 215px;
  display: flex; flex-direction: column; gap: 7px;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.3s;
}

.upgrade-card:not(.maxed):not(.upgrade-locked):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.upgrade-card.maxed          { opacity: 0.4; }
.upgrade-card.upgrade-locked { opacity: 0.18; pointer-events: none; filter: grayscale(1); }

.upg-header { display: flex; align-items: center; gap: 8px; }
.upg-icon   { font-size: 1.2rem; }
.upg-name   { font-size: 0.78rem; font-weight: 700; line-height: 1.2; }
.upg-desc   { font-size: 0.68rem; color: var(--muted); line-height: 1.4; }

.upg-levels { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }

.lvl-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.1); transition: background 0.2s;
}

.lvl-dot.filled {
  background: var(--factory-color, var(--accent));
  box-shadow: 0 0 5px var(--factory-color, var(--accent));
}

.upg-level-text  { font-size: 0.62rem; color: var(--muted); margin-left: 4px; }
.upg-maxed-badge { font-size: 0.62rem; font-weight: 700; color: var(--gold); margin-left: auto; }

.upg-buy-btn {
  width: 100%; padding: 8px; border: none; border-radius: var(--radius-sm);
  font-size: 0.74rem; font-weight: 700; cursor: pointer; color: #fff;
  background: var(--factory-color, var(--accent));
  transition: opacity 0.15s, transform 0.1s; margin-top: 2px;
  font-family: inherit;
}

.upg-buy-btn:hover:not(:disabled) { opacity: 0.82; transform: translateY(-1px); }
.upg-buy-btn:disabled { opacity: 0.25; cursor: not-allowed; }

/* ── EMPLOYEES ──────────────────────────────────────── */

.employees-grid { display: flex; flex-wrap: wrap; gap: 16px; }

.employee-card {
  background: var(--steel);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  padding: 18px;
  width: 230px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s;
}

.employee-card:not(.hired):not(.emp-locked):hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.employee-card.emp-locked { opacity: 0.25; pointer-events: none; filter: grayscale(1); }

.employee-card.hired {
  border-color: rgba(82,183,136,0.4);
  background: rgba(82,183,136,0.06);
}

.emp-header { display: flex; align-items: center; gap: 10px; }
.emp-icon   { font-size: 2rem; }
.emp-info   { display: flex; flex-direction: column; gap: 2px; }
.emp-name   { font-size: 0.88rem; font-weight: 700; }
.emp-title  { font-size: 0.7rem; color: var(--muted); }
.emp-desc   { font-size: 0.76rem; color: #c4c5d8; line-height: 1.4; }

.emp-hired-badge {
  font-size: 0.72rem; font-weight: 700;
  color: #52b788; text-align: center;
}

.emp-hire-btn {
  width: 100%; padding: 9px; border: none; border-radius: 11px;
  font-size: 0.82rem; font-weight: 700; cursor: pointer;
  background: var(--accent); color: #fff;
  transition: opacity 0.15s;
}

.emp-hire-btn:hover:not(:disabled) { opacity: 0.82; }
.emp-hire-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── RESEARCH ───────────────────────────────────────── */

.research-tier { margin-bottom: 8px; }

.research-tier-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}

.research-tier-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.research-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }

.research-node {
  background: var(--steel);
  border: 1px solid var(--rivet);
  border-radius: 14px;
  padding: 14px;
  width: 240px;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform 0.2s, opacity 0.3s;
}

.research-node:not(.res-locked):not(.res-done):hover { transform: translateY(-2px); }
.research-node.res-locked { opacity: 0.3; pointer-events: none; filter: grayscale(0.7); }

.research-node.res-done {
  border-color: #52b788;
  background: rgba(82,183,136,0.07);
}

.research-node.res-active { border-color: #f4a261; }

.res-header { display: flex; align-items: center; gap: 9px; }
.res-icon   { font-size: 1.5rem; }
.res-name   { font-size: 0.85rem; font-weight: 700; }
.res-desc   { font-size: 0.72rem; color: var(--muted); }

.res-meta {
  display: flex; gap: 8px; font-size: 0.68rem; color: var(--muted);
}

.res-requires {
  display: flex; flex-wrap: wrap; gap: 4px; font-size: 0.66rem;
}

.req-tag {
  background: rgba(255,255,255,0.06);
  border-radius: 6px; padding: 1px 6px; color: var(--muted);
}

.res-progress-wrap {
  background: rgba(255,255,255,0.06);
  border-radius: 6px; height: 6px; overflow: hidden;
}

.res-progress-fill {
  height: 100%; border-radius: 6px;
  background: #f4a261;
  transition: width 0.5s linear;
}

.res-done-badge {
  font-size: 0.72rem; font-weight: 700; color: #52b788; text-align: center;
}

.res-btn {
  width: 100%; padding: 8px; border: none; border-radius: 10px;
  font-size: 0.78rem; font-weight: 700; cursor: pointer;
  background: #f4a261; color: #fff;
  transition: opacity 0.15s;
}

.res-btn:hover:not(:disabled) { opacity: 0.82; }
.res-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── CONTRACTS ──────────────────────────────────────── */

.contracts-layout { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.contracts-col    { flex: 1; min-width: 280px; }

.contracts-col-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}

.contracts-col-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.contract-card {
  background: var(--steel);
  border: 1px solid var(--rivet);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 8px;
}

.contract-header { display: flex; align-items: center; gap: 8px; }
.contract-res    { font-size: 1.4rem; }
.contract-info   { display: flex; flex-direction: column; gap: 2px; }
.contract-need   { font-size: 0.88rem; font-weight: 700; }
.contract-reward { font-size: 0.72rem; color: var(--gold); }

.contract-progress-wrap {
  background: rgba(255,255,255,0.06); border-radius: 6px; height: 6px; overflow: hidden;
}

.contract-progress-fill {
  height: 100%; border-radius: 6px; background: var(--accent);
  transition: width 0.5s linear;
}

.contract-time {
  font-size: 0.7rem; color: var(--muted); text-align: right;
}

.contract-time.urgent { color: var(--accent); font-weight: 700; }

.contract-btns { display: flex; gap: 8px; }

.contract-btn {
  flex: 1; padding: 7px; border: none; border-radius: 9px;
  font-size: 0.76rem; font-weight: 700; cursor: pointer; color: #fff;
  transition: opacity 0.15s;
}

.contract-btn.accept  { background: #52b788; }
.contract-btn.deliver { background: var(--gold); color: #000; }
.contract-btn.decline { background: rgba(255,255,255,0.1); color: var(--muted); }
.contract-btn:hover:not(:disabled) { opacity: 0.82; }
.contract-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.contract-stock { font-size: 0.72rem; color: var(--muted); }

.no-contracts { color: var(--muted); font-size: 0.82rem; padding: 20px 0; }

/* ── REGIONS ────────────────────────────────────────── */

.regions-grid { display: flex; flex-wrap: wrap; gap: 16px; }

.region-card {
  background: var(--steel);
  border: 1px solid var(--rivet);
  border-radius: 16px;
  padding: 18px;
  width: 250px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform 0.2s, opacity 0.3s;
}

.region-card:not(.region-owned):hover { transform: translateY(-3px); }

.region-card.region-owned {
  border-color: var(--gold);
  background: rgba(255,215,0,0.05);
}

.region-header { display: flex; align-items: center; gap: 10px; }
.region-icon   { font-size: 2rem; }
.region-name   { font-size: 0.92rem; font-weight: 700; }
.region-desc   { font-size: 0.74rem; color: var(--muted); line-height: 1.4; }

.region-effects { display: flex; flex-wrap: wrap; gap: 5px; }

.region-effect-tag {
  font-size: 0.68rem; font-weight: 600;
  background: rgba(255,215,0,0.1); color: var(--gold);
  border-radius: 8px; padding: 2px 7px;
}

.region-owned-badge {
  font-size: 0.76rem; font-weight: 700; color: var(--gold); text-align: center;
}

.region-buy-btn {
  width: 100%; padding: 9px; border: none; border-radius: 11px;
  font-size: 0.82rem; font-weight: 700; cursor: pointer;
  background: var(--gold); color: #000;
  transition: opacity 0.15s;
}

.region-buy-btn:hover:not(:disabled) { opacity: 0.82; }
.region-buy-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── TOAST NOTIFICATIONS ────────────────────────────── */

#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999; pointer-events: none;
}

.toast {
  background: rgba(22,21,42,0.97);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex; align-items: center; gap: 9px;
  animation: toast-in 0.3s ease, toast-out 0.4s ease 2.6s forwards;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  max-width: 300px;
}

@keyframes toast-in  { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
@keyframes toast-out { from{opacity:1} to{opacity:0;transform:translateX(20px)} }

/* ── FLOAT NUMBERS ──────────────────────────────────── */

#float-container { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 998; }

.float-num {
  position: absolute; font-weight: 700; font-size: 0.95rem;
  animation: float-up 1.2s ease-out forwards; white-space: nowrap;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

@keyframes float-up { 0%{transform:translateY(0);opacity:1} 100%{transform:translateY(-60px);opacity:0} }

/* ── CRISIS OVERLAY ─────────────────────────────────── */

.node-crisis-overlay {
  position: absolute; inset: 0; border-radius: 18px;
  background: rgba(230,57,70,0.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 10; animation: crisis-pulse 1.5s ease-in-out infinite;
}

@keyframes crisis-pulse { 0%,100%{background:rgba(230,57,70,0.85)} 50%{background:rgba(230,57,70,0.95)} }

.crisis-content { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.crisis-title   { font-size: 0.78rem; font-weight: 800; color: #fff; letter-spacing: 0.05em; }

.crisis-repair-btn {
  background: #fff; color: #e63946; border: none; border-radius: 10px;
  padding: 7px 14px; font-size: 0.74rem; font-weight: 800; cursor: pointer;
  line-height: 1.4; transition: opacity 0.15s;
}
.crisis-repair-btn:hover:not(:disabled) { opacity: 0.85; }
.crisis-repair-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── STORAGE REQUIREMENT OVERLAY ───────────────────── */

.node-storage-req-overlay {
  position: absolute; inset: 0; border-radius: 18px;
  background: rgba(10,10,20,0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; z-index: 9;
  border: 2px solid rgba(255,165,0,0.4);
}

.storage-req-icon { font-size: 1.6rem; }

.storage-req-text {
  font-size: 0.72rem; font-weight: 600; color: #ffd166;
  text-align: center; line-height: 1.5;
}

.storage-req-btn {
  background: rgba(255,165,0,0.15); color: #ffd166;
  border: 1px solid rgba(255,165,0,0.4); border-radius: 8px;
  padding: 5px 12px; font-size: 0.7rem; font-weight: 700; cursor: pointer;
  transition: background 0.15s;
}
.storage-req-btn:hover { background: rgba(255,165,0,0.3); }

/* ── EVENT MODAL ────────────────────────────────────── */

.overlay-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in { from{opacity:0} to{opacity:1} }

.overlay-modal {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 380px; width: 90%;
  text-align: center;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  animation: modal-pop 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes modal-pop { from{transform:scale(0.88);opacity:0} to{transform:scale(1);opacity:1} }

.overlay-icon  { font-size: 3rem; }
.overlay-title { font-size: 1.2rem; font-weight: 800; }

.overlay-type {
  font-size: 0.72rem; font-weight: 700; border-radius: 20px; padding: 4px 12px;
  display: inline-block; align-self: center;
}

.ev-positive { background: rgba(82,183,136,0.2); color: #52b788; }
.ev-negative { background: rgba(230,57,70,0.2);  color: #e63946; }

.overlay-desc { font-size: 0.88rem; color: #c4c5d8; line-height: 1.5; }

.overlay-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 12px;
  padding: 11px 24px; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  transition: opacity 0.15s; margin-top: 4px;
}
.overlay-btn:hover { opacity: 0.85; }

/* ── AUCTION BAR ────────────────────────────────────── */

#auction-bar {
  background: linear-gradient(135deg, #7c3aed22, #ffd70022);
  border-bottom: 1px solid rgba(255,215,0,0.3);
  padding: 8px 24px;
}

.auction-content {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 1300px; margin: 0 auto;
}

.auction-label    { font-size: 0.7rem; font-weight: 800; color: var(--gold); white-space: nowrap; }
.auction-res      { font-size: 0.82rem; font-weight: 700; }
.auction-discount { font-size: 0.7rem; font-weight: 800; background: rgba(82,183,136,0.25); color: #52b788; border-radius: 8px; padding: 2px 7px; }
.auction-price    { font-size: 0.82rem; font-weight: 700; color: var(--gold); }
.auction-time     { font-size: 0.7rem; color: var(--muted); white-space: nowrap; }

.auction-timer-bar  { width: 80px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.auction-timer-fill { height: 100%; background: var(--gold); border-radius: 2px; transition: width 0.5s linear; }

.auction-btn {
  background: var(--gold); color: #000; border: none; border-radius: 9px;
  padding: 5px 14px; font-size: 0.76rem; font-weight: 800; cursor: pointer;
  transition: opacity 0.15s; white-space: nowrap;
}
.auction-btn:hover:not(:disabled) { opacity: 0.82; }
.auction-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.auction-dismiss {
  background: rgba(255,255,255,0.08); border: none; border-radius: 8px;
  color: var(--muted); cursor: pointer; padding: 4px 9px; font-size: 0.8rem;
  transition: background 0.15s; margin-left: auto;
}
.auction-dismiss:hover { background: rgba(255,255,255,0.14); }

/* ── TROPHIES TAB ───────────────────────────────────── */

.trophies-progress-wrap {
  margin-bottom: 28px; display: flex; flex-direction: column; gap: 8px;
}
.trophies-count { font-size: 0.92rem; font-weight: 700; color: var(--gold); }
.trophies-hint  { font-size: 0.72rem; color: var(--muted); }
.trophies-bar-outer { background: rgba(255,255,255,0.07); border-radius: 6px; height: 8px; overflow: hidden; width: 300px; }
.trophies-bar-inner { height: 100%; background: linear-gradient(90deg, #7c3aed, var(--gold)); border-radius: 6px; transition: width 0.6s ease; }

.trophies-grid { display: flex; flex-wrap: wrap; gap: 14px; }

.trophy-card {
  background: var(--steel);
  border: 1px solid var(--rivet);
  border-radius: 16px;
  padding: 16px;
  width: 200px;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  text-align: center;
  opacity: 0.45; filter: grayscale(0.7);
  transition: transform 0.2s, opacity 0.3s;
}

.trophy-card.trophy-done {
  opacity: 1; filter: none;
  border-color: var(--gold);
  background: rgba(255,215,0,0.06);
}

.trophy-card.trophy-done:hover { transform: translateY(-3px); }

.trophy-icon  { font-size: 2rem; }
.trophy-name  { font-size: 0.82rem; font-weight: 700; }
.trophy-desc  { font-size: 0.68rem; color: var(--muted); line-height: 1.4; }
.trophy-bonus { font-size: 0.68rem; color: var(--gold); font-weight: 600; }

/* ── STATS TAB ──────────────────────────────────────── */

.stats-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 32px; }

.stat-card {
  background: var(--steel);
  border: 1px solid var(--rivet);
  border-radius: 14px;
  padding: 18px 20px;
  min-width: 160px;
  display: flex; flex-direction: column; gap: 6px;
}

.stat-icon  { font-size: 1.4rem; }
.stat-label { font-size: 0.7rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.4rem; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }

.stats-section-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.stats-section-label::after { content:''; flex:1; height:1px; background:var(--border); }

.stats-factories { display: flex; flex-direction: column; gap: 6px; }
.stat-factory-row { font-size: 0.8rem; color: #c4c5d8; padding: 8px 12px; background: var(--steel); border-radius: 9px; border: 1px solid var(--border); }
.stat-factory-row.muted { opacity: 0.35; }

/* ── MISSIONS TAB ───────────────────────────────────── */

.missions-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 8px;
}
.missions-title   { font-size: 1.05rem; font-weight: 800; }
.missions-refresh { font-size: 0.76rem; color: var(--muted); }
.missions-refresh strong { color: var(--text); }

.missions-grid { display: flex; flex-direction: column; gap: 14px; max-width: 600px; }

.mission-card {
  background: var(--steel);
  border: 1px solid var(--rivet);
  border-radius: 14px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform 0.2s;
}

.mission-card:hover { transform: translateY(-2px); }

.mission-card.mission-done {
  border-color: #52b788;
  background: rgba(82,183,136,0.07);
  opacity: 0.7;
}

.mission-top    { display: flex; align-items: center; gap: 12px; }
.mission-icon   { font-size: 1.6rem; }
.mission-info   { display: flex; flex-direction: column; gap: 2px; }
.mission-desc   { font-size: 0.86rem; font-weight: 700; }
.mission-reward { font-size: 0.7rem; color: var(--gold); margin-top: 2px; }

.mission-progress-wrap { background: rgba(255,255,255,0.07); border-radius: 6px; height: 6px; overflow: hidden; }
.mission-progress-fill { height: 100%; border-radius: 6px; background: #52b788; transition: width 0.4s ease; }
.mission-progress-text { font-size: 0.68rem; color: var(--muted); text-align: right; }

/* ═══════════════════════════════════════════════════════════════
   BANK TAB
   ═══════════════════════════════════════════════════════════════ */

/* ── Header dashboard ──────────────────────────────────────────── */
.bank-header {
  display: grid;
  grid-template-columns: 160px 1fr;
  background: var(--card2);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: 0 2px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,215,0,0.06);
}

/* Panneau de gauche — jour */
.bank-day-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 20px;
  background: linear-gradient(160deg, rgba(255,215,0,0.08), rgba(255,215,0,0.03));
  border-right: 1px solid rgba(255,215,0,0.15);
}
.bank-day-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255,215,0,0.55);
  text-transform: uppercase;
  letter-spacing: .14em;
}
.bank-day-num {
  font-size: 3.2rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 28px rgba(255,215,0,0.4);
}
.bank-day-bar-wrap {
  width: 72px;
  height: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
}
.bank-day-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #b58a00, var(--gold));
  border-radius: 99px;
  transition: width 0.6s linear;
}
.bank-day-timer {
  font-size: 0.62rem;
  color: rgba(255,215,0,0.45);
  font-variant-numeric: tabular-nums;
}

/* Panneau de droite — stats */
.bank-summary-block {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
}
.bank-summary-item {
  flex: 1;
  min-width: 130px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 20px 22px;
  border-right: 1px solid var(--border);
}
.bank-summary-item:last-child { border-right: none; }
.bank-summary-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
}
.bank-summary-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

/* ── Séparateurs de section ────────────────────────────────────── */
.bank-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin: 24px 0 12px;
}
.bank-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.bank-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 18px;
  border: 1px dashed rgba(255,255,255,0.07);
  border-radius: 10px;
  background: rgba(255,255,255,0.015);
}

/* ── Prêts actifs ──────────────────────────────────────────────── */
.bank-loans-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bank-loan-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(82,183,136,0.45);
  border-radius: 14px;
  padding: 16px 18px;
  transition: box-shadow 0.2s, border-left-color 0.2s;
}
.bank-loan-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  border-left-color: #52b788;
}
.bank-loan-card.bank-loan-danger {
  border-left-color: rgba(230,57,70,0.7);
  background: rgba(230,57,70,0.03);
}

.bank-loan-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.bank-loan-icon {
  font-size: 1.9rem;
  width: 46px;
  height: 46px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bank-loan-info { flex: 1; min-width: 0; }
.bank-loan-name {
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bank-loan-detail {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 3px;
}
.bank-loan-days {
  flex-shrink: 0;
  text-align: right;
  background: rgba(255,215,0,0.05);
  border: 1px solid rgba(255,215,0,0.12);
  border-radius: 10px;
  padding: 8px 14px;
}
.bank-loan-days > span:first-child {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--gold);
  display: block;
  line-height: 1;
}
.bank-loan-days > span:last-child {
  font-size: 0.58rem;
  color: rgba(255,215,0,0.5);
  display: block;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.bank-loan-progress-wrap {
  height: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 12px;
}
.bank-loan-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2d6a4f, #52b788);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.bank-loan-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.73rem;
  color: var(--muted);
}
.bank-loan-footer > span {
  padding: 4px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.bank-loan-footer strong { color: var(--text); font-weight: 600; }

/* ── Bouton corruption ─────────────────────────────────────────── */
.bank-corrupt-btn {
  margin-left: auto;
  padding: 5px 13px;
  background: rgba(100,20,160,0.3);
  border: 1px solid rgba(170,90,240,0.3);
  border-radius: 8px;
  color: #c89eff;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
  text-align: center;
}
.bank-corrupt-btn:hover:not(:disabled) {
  background: rgba(130,30,200,0.45);
  border-color: rgba(200,120,255,0.5);
}
.bank-corrupt-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.bank-corrupt-btn small {
  display: block;
  font-size: 0.6rem;
  opacity: 0.75;
  margin-top: 2px;
}
.bank-corrupt-used {
  margin-left: auto;
  font-size: 0.62rem;
  color: rgba(180,100,240,0.4);
  font-style: italic;
}
.bank-corrupt-waived {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  color: #52b788;
  background: rgba(82,183,136,0.1);
  border: 1px solid rgba(82,183,136,0.28);
  border-radius: 5px;
  padding: 1px 7px;
  vertical-align: middle;
}

/* ── Badge ancienneté ─────────────────────────────────────────── */
.bank-offer-minday {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.bank-offer-minday-locked {
  color: #f0818a;
  background: rgba(230,57,70,0.1);
  border: 1px solid rgba(230,57,70,0.25);
}
.bank-offer-minday-ok {
  color: #52b788;
  background: rgba(82,183,136,0.1);
  border: 1px solid rgba(82,183,136,0.25);
}
.bank-offer-locked { opacity: 0.55; }

/* ── Grille des offres ─────────────────────────────────────────── */
.bank-offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.bank-offer-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-top: 3px solid rgba(255,215,0,0.12);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: border-top-color 0.2s, box-shadow 0.2s;
}
.bank-offer-card:hover:not(.bank-offer-maxed):not(.bank-offer-locked) {
  border-top-color: rgba(255,215,0,0.5);
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
}
.bank-offer-card.bank-offer-maxed { opacity: 0.38; pointer-events: none; }

.bank-offer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.bank-offer-icon {
  font-size: 1.7rem;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,215,0,0.06);
  border: 1px solid rgba(255,215,0,0.1);
  border-radius: 12px;
  flex-shrink: 0;
}
.bank-offer-name {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
}
.bank-offer-sub {
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 2px;
}

.bank-offer-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  font-size: 0.74rem;
}
.bank-offer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.bank-offer-row:last-child { border-bottom: none; }
.bank-offer-row strong { color: var(--text); font-weight: 600; }
.bank-offer-daily { background: rgba(230,57,70,0.04); }
.bank-offer-daily strong { color: #f0818a; }
.bank-offer-corrupt { background: rgba(120,40,180,0.05); }
.bank-offer-corrupt strong { color: #c89eff; }

.bank-borrow-btn {
  width: 100%;
  padding: 11px 0;
  background: linear-gradient(135deg, #183628 0%, #1d5235 100%);
  border: 1px solid rgba(82,183,136,0.3);
  border-radius: 10px;
  color: #52b788;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .02em;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  margin-top: auto;
}
.bank-borrow-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4530 0%, #246040 100%);
  border-color: rgba(82,183,136,0.55);
}
.bank-borrow-btn:active:not(:disabled) { transform: scale(0.98); }
.bank-borrow-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── InputStock bar ────────────────────────────────────────────── */
.node-inputstock {
  margin: 4px 0 2px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  width: 100%;
}

.inputstock-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.inputstock-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
}

.inputstock-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 99px;
  transition: width 0.3s ease, background 0.3s;
}

.inputstock-bar-fill.empty   { background: var(--accent); }
.inputstock-bar-fill.full    { background: var(--gold); }

/* ── Split panel ───────────────────────────────────────────────── */
.split-panel {
  max-width: 760px;
  margin: 18px auto 0;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
}

.split-panel:empty { display: none; }

.split-panel-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 14px;
}

.split-item {
  margin-bottom: 14px;
}

.split-item:last-child { margin-bottom: 0; }

.split-res-label {
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.split-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.split-factory-name {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  min-width: 90px;
}

.split-factory-name:last-child { text-align: right; }

.split-pct {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  min-width: 32px;
  text-align: center;
}

.split-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.12);
  outline: none;
  cursor: pointer;
}

.split-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f4a261;
  cursor: pointer;
  border: 2px solid #0d0c18;
  box-shadow: 0 0 6px rgba(244,162,97,0.5);
}

.split-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f4a261;
  cursor: pointer;
  border: 2px solid #0d0c18;
}

/* ══════════════════════════════════════════════════════════════
   LAYOUT REFACTOR — rail nav gauche + sidebar droite
   ══════════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* ── Rail de navigation gauche ──────────────────────────────── */
.tab-rail {
  width: 200px;
  min-width: 200px;
  background: var(--steel, #18172c);
  border-right: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px 0 16px;
  gap: 2px;
  flex-shrink: 0;
}

.tab-rail .tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
}

.tab-rail .tab-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }

.tab-rail .tab-btn.active {
  background: rgba(230,56,74,0.12);
  color: var(--text);
  border-left-color: var(--accent);
  font-weight: 700;
}

.tab-rail-section {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 14px 4px;
  opacity: 0.6;
}

/* ── Zone principale ─────────────────────────────────────────── */
.app-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Suppression ancienne tab-bar horizontale si présente */
.tab-bar { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   CONVEYOR SCENE — scène industrielle animée
   ══════════════════════════════════════════════════════════════ */

/* Zone de production */
#tab-production { padding: 0; overflow-y: auto; }
.chain-wrapper  { display: block !important; padding: 0 !important; margin: 0 !important; }

#factories-grid {
  position: relative;
  width: 100%;
}

/* ── Scène ───────────────────────────────────────────────────── */
.cv-scene {
  position: relative;
  width: 100%;
  min-height: 640px;
  background: linear-gradient(180deg, #08071a 0%, #15122e 60%, #0e0c20 100%);
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  --belt-speed-mult: 1;
}

/* Grille de fond */
.cv-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ── Plafond ─────────────────────────────────────────────────── */
.cv-ceiling {
  position: relative;
  height: 74px;
  background: linear-gradient(180deg, #050413 0%, #0c0a1e 100%);
  border-bottom: 2px solid rgba(255,255,255,0.05);
  overflow: visible;
  z-index: 5;
}

.cv-pipe {
  position: absolute;
  left: 0; right: 0;
  height: 8px;
  border-radius: 4px;
}
.cv-pipe1 { top: 12px; background: linear-gradient(90deg, #2a2742, #3a3560, #2a2742); }
.cv-pipe2 { top: 26px; background: linear-gradient(90deg, #1e1c38, #2e2b55, #1e1c38); height: 5px; }

.cv-lights-row { position: absolute; bottom: 0; left: 0; right: 0; }

.cv-light {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cv-light-arm { width: 3px; height: 16px; background: #2a2742; }
.cv-light-bulb {
  width: 22px; height: 22px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 40% 35%, #fffde0, #ffd23f 60%, #c8a800);
  box-shadow: 0 0 16px 6px rgba(255,210,63,0.35), 0 0 40px 10px rgba(255,210,63,0.12);
}
.cv-light-cone {
  width: 0; height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 24px solid rgba(255,210,63,0.06);
  margin-top: -2px;
}

/* ── Corps de la scène ───────────────────────────────────────── */
.cv-body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 530px;
}

/* ── Rangées machines ─────────────────────────────────────────── */
.cv-top-row,
.cv-bottom-row {
  position: relative;
  width: 100%;
  height: 210px;
  overflow: visible;
}

/* ── Nœuds machine ───────────────────────────────────────────── */
.cv-node {
  position: absolute;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: default;
  z-index: 10;
  /* position relative so absolute arms are relative to node */
  /* but: absolute arms escape the node via overflow:visible on row */
}

.cv-node-top  { bottom: 0; }  /* node bottom = row bottom = belt top */
.cv-node-bottom { top: 0; }   /* node top = row top = belt bottom */

/* ── Support de fixation (top) & base (bottom) ────────────────── */
.cv-mount {
  position: relative;
  width: 80px;
  height: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 30px;
}
.cv-mount-strap-l,
.cv-mount-strap-r {
  position: absolute;
  bottom: 0;
  width: 3px;
  height: 18px;
  background: #2a2742;
  border-radius: 2px;
}
.cv-mount-strap-l { left: 14px; }
.cv-mount-strap-r { right: 14px; }
.cv-mount-bolt {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4a4770;
  border: 1px solid #6a67a0;
  position: absolute;
  top: 2px;
}
.cv-mount-bolt:first-child { left: 10px; }
.cv-mount-bolt:nth-child(2) { right: 10px; }

.cv-base {
  width: 90px; height: 16px;
  background: linear-gradient(90deg, #1e1c38, #2e2b55, #1e1c38);
  border-radius: 0 0 6px 6px;
  border-top: 2px solid #3a3756;
}

/* ── Boîtier machine ─────────────────────────────────────────── */
.cv-mbox {
  position: relative;
  width: 140px;
  height: 120px;
  border-radius: 10px;
  background: linear-gradient(160deg, #22203c 0%, #1a1830 50%, #22203c 100%);
  border: 1.5px solid #3a3756;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: visible; /* steam must escape upward */
  transition: box-shadow 0.3s, border-color 0.3s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.cv-mbox:hover { border-color: var(--fc, #e6384a); }

.cv-mbox.cv-working { border-color: rgba(var(--fc-raw, 230,56,74),0.5); }
.cv-mbox.cv-active  {
  box-shadow: 0 0 0 2px var(--fc, #e6384a),
              0 0 30px 8px color-mix(in srgb, var(--fc, #e6384a) 30%, transparent),
              0 4px 20px rgba(0,0,0,0.5);
  border-color: var(--fc, #e6384a);
}

/* Rivets */
.cv-rivets { position: absolute; inset: 6px; pointer-events: none; }
.cv-rivets i {
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #3a3756;
  border: 1px solid #4a4770;
}
.cv-rivets i:nth-child(1) { top: 0;   left: 0; }
.cv-rivets i:nth-child(2) { top: 0;   right: 0; }
.cv-rivets i:nth-child(3) { bottom: 0; left: 0; }
.cv-rivets i:nth-child(4) { bottom: 0; right: 0; }

/* LED */
.cv-led {
  position: absolute;
  top: 8px; right: 8px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #2a2742;
  transition: background 0.2s;
}
.cv-led.cv-led-on {
  background: var(--fc, #52b788);
  box-shadow: 0 0 8px 3px var(--fc, #52b788);
  animation: cv-led-pulse 0.6s ease-in-out infinite alternate;
}
@keyframes cv-led-pulse {
  from { opacity: 0.7; }
  to   { opacity: 1; }
}

/* Écran */
.cv-screen {
  position: relative;
  width: 64px; height: 40px;
  background: #080715;
  border-radius: 4px;
  border: 1px solid #2a2742;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cv-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(255,255,255,0.02) 3px,
    rgba(255,255,255,0.02) 4px
  );
  pointer-events: none;
}
.cv-screen-icon { font-size: 1.4rem; position: relative; z-index: 1; }

/* Badges */
.cv-badge-n {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(0,0,0,0.55);
  color: var(--fc, #e6384a);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--fc, #e6384a);
}
.cv-badge-recipe {
  position: absolute;
  bottom: 5px;
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.cv-name {
  position: absolute;
  bottom: 18px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
}

/* ── Stock indicator ─────────────────────────────────────────── */
.cv-stock {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 110px;
  pointer-events: none;
}
.cv-stk-icon { font-size: 0.62rem; flex-shrink: 0; line-height: 1; }
.cv-stk-bar-wrap {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
}
.cv-stk-bar { height: 100%; border-radius: 99px; transition: width 0.4s, background 0.3s; }
.cv-stk-val {
  font-size: 0.54rem;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Vapeur ──────────────────────────────────────────────────── */
.cv-steam-wrap {
  position: absolute;
  top: -30px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: none;
}
.cv-steam {
  width: 7px; height: 18px;
  background: rgba(180,200,255,0.25);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s;
}
.cv-steam-on .cv-steam { opacity: 1; }
.cv-steam-on .cv-s1 { animation: cv-steam-rise 1.4s ease-out 0.0s infinite; }
.cv-steam-on .cv-s2 { animation: cv-steam-rise 1.4s ease-out 0.3s infinite; }
.cv-steam-on .cv-s3 { animation: cv-steam-rise 1.4s ease-out 0.6s infinite; }

@keyframes cv-steam-rise {
  0%   { transform: translateY(0)   scaleX(1);   opacity: 0.7; }
  60%  { transform: translateY(-22px) scaleX(1.5); opacity: 0.4; }
  100% { transform: translateY(-40px) scaleX(2);   opacity: 0; }
}

/* ── Bras mécanique ──────────────────────────────────────────── */
.cv-arm {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  flex-direction: column;
  z-index: 20;
  pointer-events: none;
}

/* Top arm: anchored at top of arm zone (below mbox+mount), extends DOWN */
.cv-arm-top {
  top: 142px;  /* mount(22) + mbox(120) */
}
.cv-arm-top .cv-arm-rail {
  order: 1;    /* rail first = at top */
  width: 7px;
  background: linear-gradient(90deg, #1e1c38, #3a3756, #1e1c38);
  transition: height 0.28s ease;
  border-radius: 0 0 3px 3px;
}
.cv-arm-top .cv-arm-head { order: 2; } /* head second = at bottom = belt side */

/* Bottom arm: anchored at bottom of node (above mbox), extends UP */
.cv-arm-bot {
  bottom: 136px; /* mbox(120) + base(16) */
  top: auto;
  /* column: head first=top(belt side), rail second=bottom(machine side)
     container anchored at bottom → expands upward as rail grows ✓ */
}
.cv-arm-bot .cv-arm-rail {
  width: 7px;
  background: linear-gradient(90deg, #1e1c38, #3a3756, #1e1c38);
  transition: height 0.28s ease;
  border-radius: 3px 3px 0 0;
}

.cv-arm-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  background: #1e1c38;
  border-radius: 5px;
  border: 1px solid #3a3756;
}

/* Griffes */
.cv-claw {
  width: 8px; height: 14px;
  background: linear-gradient(180deg, #4a4770, #2a2742);
  border-radius: 0 0 3px 3px;
  transition: transform 0.2s ease;
  transform-origin: top center;
}
.cv-claw-l { transform: rotate(-30deg); }
.cv-claw-r { transform: rotate(30deg); }

/* Item tenu */
.cv-held {
  font-size: 1.1rem;
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  filter: drop-shadow(0 0 4px rgba(255,210,63,0.6));
  pointer-events: none;
}

/* ── Tapis roulant ────────────────────────────────────────────── */
.cv-belt-wrap {
  position: relative;
  height: 56px;
  margin: 0;
  z-index: 8;
}

/* Rails métalliques */
.cv-belt-wrap::before,
.cv-belt-wrap::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, #2a2742, #3a3560, #2a2742);
  z-index: 2;
}
.cv-belt-wrap::before { top: 0; box-shadow: 0 -2px 6px rgba(0,0,0,0.5); }
.cv-belt-wrap::after  { bottom: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.5); }

/* Surface du tapis */
.cv-belt-surface {
  position: absolute;
  top: 5px; bottom: 5px;
  left: 0; right: 0;
  background: repeating-linear-gradient(
    90deg,
    #22203c 0px,
    #22203c 32px,
    #1a1830 32px,
    #1a1830 64px,
    rgba(255,210,63,0.12) 62px,
    rgba(255,210,63,0.12) 64px
  );
  animation: cv-belt-move linear infinite;
  animation-duration: calc(4s / var(--belt-speed-mult, 1));
  z-index: 1;
}
@keyframes cv-belt-move {
  from { background-position-x: 0; }
  to   { background-position-x: 64px; }
}

/* Rouleaux */
.cv-rollers-row {
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  z-index: 3;
  pointer-events: none;
}
.cv-roller {
  position: absolute;
  top: 50%;
  width: 10px; height: 10px;
  margin-top: -5px;
  left: 0; /* positioned by JS via style.left */
  transform: translateX(-50%) rotate(0deg);
  background: conic-gradient(#3a3756 0deg, #5a5780 90deg, #3a3756 180deg, #5a5780 270deg);
  border-radius: 50%;
  animation: cv-roller-spin linear infinite;
  animation-duration: calc(0.7s / var(--belt-speed-mult, 1));
}
@keyframes cv-roller-spin {
  from { transform: translateX(-50%) rotate(0deg); }
  to   { transform: translateX(-50%) rotate(360deg); }
}

/* Supports */
.cv-supports { position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 0; }
.cv-support {
  position: absolute;
  top: 55px;
  width: 6px;
  height: 18px;
  background: #1a1830;
  border: 1px solid #2a2742;
  transform: translateX(-50%);
}

/* Couche items */
.cv-items-layer {
  position: absolute;
  top: 4px; bottom: 4px;
  left: 0; right: 0;
  z-index: 15;
  pointer-events: none;
}

/* Items sur le tapis */
.cv-item {
  position: absolute;
  font-size: 1.4rem;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
  user-select: none;
}
.cv-item::after {
  content: attr(data-qty);
  position: absolute;
  bottom: -7px;
  right: -6px;
  font-size: 0.52rem;
  font-weight: 800;
  background: rgba(0,0,0,0.75);
  color: #ffd23f;
  border-radius: 4px;
  padding: 0 3px;
  line-height: 1.5;
  pointer-events: none;
  white-space: nowrap;
}
.cv-item[data-qty=""]::after, .cv-item:not([data-qty])::after { display: none; }
.cv-item-pop {
  animation: cv-item-pop 0.35s cubic-bezier(0.18, 1.3, 0.5, 1);
}
@keyframes cv-item-pop {
  0%   { transform: translate(-50%, -50%) scale(0); }
  70%  { transform: translate(-50%, -50%) scale(1.25); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
.cv-item-sold {
  animation: cv-item-sold 0.5s ease-out forwards;
}
@keyframes cv-item-sold {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(0.3); opacity: 0; }
}

/* Float +€ au niveau de la vente */
.cv-sale-float {
  position: absolute;
  top: -10px;
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffd23f;
  text-shadow: 0 0 8px rgba(255,210,63,0.8);
  animation: cv-float-up 0.7s ease-out forwards;
  transform: translateX(-50%);
  pointer-events: none;
}
@keyframes cv-float-up {
  0%   { transform: translateX(-50%) translateY(0);   opacity: 1; }
  100% { transform: translateX(-50%) translateY(-40px); opacity: 0; }
}

/* Float +€ pour money producers */
.cv-money-pop {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffd23f;
  text-shadow: 0 0 8px rgba(255,210,63,0.8);
  animation: cv-float-up 0.8s ease-out forwards;
  pointer-events: none;
  z-index: 30;
}

/* ── Zone de vente ────────────────────────────────────────────── */
.cv-sale-zone {
  position: absolute;
  right: 0;
  top: 0; bottom: 0;
  width: 60px;
  background: repeating-linear-gradient(
    45deg,
    rgba(255,210,63,0.08) 0px,
    rgba(255,210,63,0.08) 6px,
    transparent 6px,
    transparent 14px
  );
  border-left: 2px solid rgba(255,210,63,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 16;
}
.cv-sale-label {
  font-size: 0.55rem;
  color: rgba(255,210,63,0.7);
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}
.cv-sale-hatch {
  position: absolute;
  inset: 0;
}

/* ── Sol ─────────────────────────────────────────────────────── */
.cv-floor {
  height: 28px;
  background: linear-gradient(180deg, #0d0c1e 0%, #07060f 100%);
  border-top: 2px solid rgba(255,255,255,0.05);
  overflow: hidden;
}
.cv-floor-stripe {
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    rgba(255,210,63,0.05) 0px,
    rgba(255,210,63,0.05) 30px,
    transparent 30px,
    transparent 60px
  );
}

/* ── Boutons de vitesse ───────────────────────────────────────── */
.cv-speed-bar {
  position: absolute;
  top: 10px; right: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 20;
}
.cv-speed-label {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}
.cv-spd-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--muted);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.cv-spd-btn:hover { background: rgba(255,255,255,0.14); color: var(--text); }
.cv-spd-btn.active {
  background: rgba(230,56,74,0.2);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Popover achat ───────────────────────────────────────────── */
.cv-popover {
  position: fixed;
  z-index: 1000;
  background: #1a1830;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 0;
  width: 280px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  overflow: hidden;
}
.cv-pop-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 2px solid;
}
.cv-pop-icon { font-size: 1.6rem; }
.cv-pop-info { flex: 1; }
.cv-pop-name { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.cv-pop-count { font-size: 0.78rem; font-weight: 600; }
.cv-pop-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  width: 26px; height: 26px;
  font-size: 0.8rem;
}
.cv-pop-desc {
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--muted);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cv-pop-warn {
  padding: 6px 14px;
  font-size: 0.76rem;
  color: #f4a261;
  background: rgba(244,162,97,0.08);
}
.cv-pop-stats {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cv-pop-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
}
.cv-pop-stat-label { color: var(--muted); }
.cv-pop-stat-val   { color: var(--text); font-weight: 600; }

.cv-pop-repair {
  padding: 10px 14px;
  background: rgba(230,56,74,0.10);
  border-top: 1px solid rgba(230,56,74,0.25);
  border-bottom: 1px solid rgba(230,56,74,0.25);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cv-pop-repair-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #e63946;
  letter-spacing: 0.03em;
}
.cv-pop-repair-btn {
  background: linear-gradient(135deg, #e63946, #c1121f);
  border: none;
  border-radius: 7px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.cv-pop-repair-btn:hover:not(:disabled) { opacity: 0.85; transform: scale(1.02); }
.cv-pop-repair-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.cv-pop-buy-row {
  display: flex;
  gap: 6px;
  padding: 10px 14px 14px;
}
.cv-pop-btn {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.cv-pop-btn:hover:not(:disabled) { background: rgba(230,56,74,0.18); border-color: var(--accent); }
.cv-pop-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cv-pop-btn-max { font-weight: 800; }

/* ── Sélecteur de ligne (line-selector) ─────────────────────── */
.line-selector {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* ── Split panel (masqué dans la nouvelle scène) ─────────────── */
.split-panel { display: none; }

/* ── Utilitaires inline ────────────────────────────────────────── */
.bank-danger      { color: #f0818a !important; }
.bank-rate-danger { color: #f0818a; font-weight: 700; }
.bank-rate-good   { color: #52b788; font-weight: 700; }
.bank-mult {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 5px;
  background: rgba(255,255,255,0.08);
  vertical-align: middle;
}

/* ── Prestige progress bar ───────────────────────────────────────── */
.prestige-progress-wrap {
  display: flex; align-items: center; gap: 6px;
  background: rgba(124,58,237,0.12); border-radius: 99px;
  padding: 4px 10px; border: 1px solid rgba(124,58,237,0.3);
}
.prestige-progress-label { font-size: 0.72rem; font-weight: 700; color: #a855f7; white-space: nowrap; }
.prestige-bar-outer { flex: 1; height: 5px; background: rgba(255,255,255,0.08); border-radius: 99px; min-width: 60px; }
.prestige-bar-inner { height: 100%; background: linear-gradient(90deg,#7c3aed,#a855f7); border-radius: 99px; transition: width 1s; }
.prestige-progress-pct { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }

/* ── Sparkline marché ────────────────────────────────────────────── */
.mkt-spark { display: inline-block; vertical-align: middle; margin-left: 3px; opacity: 0.85; }
.market-badge { display: flex; align-items: center; gap: 2px; font-size: 0.65rem; }

/* ── Status chip convoyeur ──────────────────────────────────────── */
.cv-status-chip {
  font-size: 0.6rem; font-weight: 700; text-align: center;
  padding: 1px 4px; border-radius: 4px; margin-top: 2px; min-height: 12px;
}
.cv-status-active   { color: #52b788; background: rgba(82,183,136,0.12); }
.cv-status-stalled  { color: #f4a261; background: rgba(244,162,97,0.12); }
.cv-status-broken   { color: #e63946; background: rgba(230,57,70,0.12); }
.cv-status-blackout { color: #a78bfa; background: rgba(167,139,250,0.14); font-weight: 700; animation: blink-slow 1s step-end infinite; }
.cv-status-idle     { color: var(--muted); }
.cv-status-blocked  { color: #f4a261; background: rgba(244,162,97,0.18); font-weight: 700; animation: blink-slow 1.2s step-end infinite; }
@keyframes blink-slow { 0%,100%{opacity:1} 50%{opacity:0.35} }

/* ── Contrats — deadline & décroissance ─────────────────────────── */
.contract-accept-deadline { margin: 4px 0; }
.contract-deadline-bar-wrap { height: 3px; background: rgba(255,255,255,0.08); border-radius: 3px; margin-bottom: 2px; }
.contract-deadline-bar-fill { height: 100%; border-radius: 3px; transition: width 1s; }
.contract-deadline-time { font-size: 0.67rem; color: #f4a261; }
.contract-deadline-time.urgent { color: #e63946; font-weight: 700; animation: pulse 1s infinite; }
.contract-decay-pct { font-size: 0.68rem; margin-left: 4px; }

/* ── Crise globale header ────────────────────────────────────────── */
.global-crisis-header {
  background: rgba(167,139,250,0.15); border: 1px solid rgba(167,139,250,0.4);
  border-radius: 99px; padding: 4px 12px; font-size: 0.72rem; font-weight: 700;
  color: #c4b5fd; white-space: nowrap; animation: blink-slow 1s step-end infinite;
}

/* ── NPC alerte header ───────────────────────────────────────────── */
.npc-header-alert {
  background: rgba(230,57,70,0.18); border: 1px solid rgba(230,57,70,0.4);
  border-radius: 99px; padding: 4px 12px; font-size: 0.72rem; font-weight: 700;
  color: #f0818a; cursor: pointer; white-space: nowrap; animation: pulse 1.5s infinite;
}

/* ── Saison spéciale (widget header doré) ────────────────────────── */
.special-season-box { border-color: #ffd700 !important; background: rgba(255,215,0,0.08) !important; }
.special-season-box .weather-bar-fill { background: #ffd700 !important; }

/* ── NPC threat panel ────────────────────────────────────────────── */
.npc-threat-panel {
  background: rgba(230,57,70,0.07); border: 1px solid rgba(230,57,70,0.25);
  border-radius: 14px; padding: 16px; margin-top: 20px;
}
.npc-peaceful { background: rgba(82,183,136,0.05); border-color: rgba(82,183,136,0.2); }
.npc-threat-title { font-size: 0.82rem; font-weight: 800; color: #f0818a; margin-bottom: 6px; }
.npc-peaceful .npc-threat-title { color: #52b788; }
.npc-threat-name  { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.npc-threat-desc  { font-size: 0.78rem; color: var(--muted); margin-bottom: 10px; }
.npc-threat-bar-wrap { height: 5px; background: rgba(255,255,255,0.07); border-radius: 3px; margin-bottom: 6px; }
.npc-threat-bar-fill { height: 100%; background: #e63946; border-radius: 3px; transition: width 1s; }
.npc-threat-time  { font-size: 0.72rem; color: var(--muted); margin-bottom: 10px; }
.npc-repel-btn {
  background: linear-gradient(135deg,#e63946,#ff6b6b);
  border: none; border-radius: 9px; padding: 8px 18px;
  font-weight: 700; color: #fff; cursor: pointer; font-size: 0.82rem;
}
.npc-repel-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Fin de jeu (endgame tab) ────────────────────────────────────── */
.endgame-header { text-align: center; padding: 24px 0 16px; }
.endgame-title  { font-size: 1.2rem; font-weight: 900; margin-bottom: 12px; }
.endgame-progress-wrap { height: 8px; background: rgba(255,255,255,0.07); border-radius: 99px; margin: 0 auto 6px; max-width: 400px; }
.endgame-progress-fill { height: 100%; background: linear-gradient(90deg,#52b788,#ffd700); border-radius: 99px; transition: width 1s; }
.endgame-pct    { font-size: 0.8rem; color: var(--muted); }
.endgame-milestones { display: flex; flex-direction: column; gap: 10px; padding: 0 0 20px; }
.endgame-milestone {
  display: flex; align-items: center; gap: 14px;
  background: var(--card2); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px; padding: 14px 16px;
}
.endgame-milestone.em-done      { border-color: rgba(82,183,136,0.4); background: rgba(82,183,136,0.06); }
.endgame-milestone.em-inprogress{ border-color: rgba(244,162,97,0.4); background: rgba(244,162,97,0.06); }
.em-icon   { font-size: 1.6rem; min-width: 36px; text-align: center; }
.em-body   { flex: 1; }
.em-name   { font-weight: 800; font-size: 0.9rem; margin-bottom: 2px; }
.em-desc   { font-size: 0.75rem; color: var(--muted); }
.em-status { font-size: 0.72rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.em-done   .em-status   { color: #52b788; }
.em-inprogress .em-status { color: #f4a261; }

/* ══════════════════════════════════════════════════════════════
   NOUVELLES FEATURES v27
══════════════════════════════════════════════════════════════ */

/* ── Réputation (header) ─────────────────────────────────────── */
.reputation-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  cursor: help;
  transition: color 0.5s;
}

/* ── Fusion Panel (onglet Production) ───────────────────────── */
.fusion-panel {
  margin: 16px 12px 0;
  border-top: 2px solid rgba(155,89,182,0.3);
  padding-top: 12px;
}
.fusion-title {
  font-size: 1rem;
  font-weight: 800;
  color: #9b59b6;
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}
.fusion-locked {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  border: 1px dashed rgba(255,255,255,0.1);
}
.fusion-card {
  background: var(--card2);
  border: 1px solid rgba(155,89,182,0.2);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.fusion-card:hover { border-color: rgba(155,89,182,0.5); }
.fusion-card.fusion-stalled { border-color: rgba(230,57,70,0.4); }
.fusion-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fusion-icon  { font-size: 1.5rem; }
.fusion-name  { font-weight: 800; font-size: 0.92rem; }
.fusion-desc  { font-size: 0.72rem; color: var(--muted); }
.fusion-count { margin-left: auto; font-size: 1.2rem; font-weight: 900; }
.fusion-recipe {
  font-size: 0.8rem;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.fusion-input       { color: var(--text); }
.fusion-input-short { color: #e63946; font-weight: 700; }
.fusion-progress-wrap {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.fusion-progress-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.fusion-footer { display: flex; align-items: center; justify-content: space-between; }
.fusion-time   { font-size: 0.72rem; color: var(--muted); }
.fusion-buy-btn {
  background: linear-gradient(135deg, #9b59b6, #6c3483);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.fusion-buy-btn:hover:not(:disabled) { opacity: 0.85; }
.fusion-buy-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Arbre de Talents ───────────────────────────────────────── */
.talents-header {
  text-align: center;
  padding: 16px;
  margin-bottom: 20px;
  background: var(--card2);
  border-radius: 14px;
  border: 1px solid rgba(255,210,63,0.2);
}
.talents-title  { font-size: 1.2rem; font-weight: 900; margin-bottom: 8px; }
.talents-points-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 4px; }
.talents-points-label { font-size: 0.85rem; color: var(--muted); }
.talents-points-value {
  font-size: 1.8rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255,215,0,0.5);
}
.talents-hint { font-size: 0.72rem; color: var(--muted); }

.talent-tier { margin-bottom: 20px; }
.talent-tier-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding-bottom: 6px;
}
.talent-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.talent-card {
  flex: 1;
  min-width: 150px;
  background: var(--card2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  transition: border-color 0.2s, transform 0.1s;
}
.talent-card.talent-available { border-color: rgba(255,215,0,0.4); }
.talent-card.talent-available:hover { border-color: #ffd700; transform: translateY(-2px); }
.talent-card.talent-done  { border-color: rgba(82,183,136,0.5); background: rgba(82,183,136,0.06); }
.talent-card.talent-locked { opacity: 0.5; }
.talent-icon   { font-size: 1.8rem; margin-bottom: 6px; }
.talent-name   { font-weight: 800; font-size: 0.88rem; margin-bottom: 4px; }
.talent-desc   { font-size: 0.72rem; color: var(--muted); margin-bottom: 8px; }
.talent-cost   { font-size: 0.72rem; color: #ffd700; font-weight: 700; margin-bottom: 8px; }
.talent-status { font-size: 0.78rem; color: #52b788; font-weight: 700; }
.talent-btn {
  background: linear-gradient(135deg, #ffd700, #e6ac00);
  border: none;
  border-radius: 8px;
  color: #1a1a2e;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.talent-btn:hover:not(:disabled) { opacity: 0.85; }
.talent-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Quêtes Narratives ──────────────────────────────────────── */
.quests-title {
  font-size: 1.1rem;
  font-weight: 900;
  margin-bottom: 16px;
  color: var(--text);
}
.quests-list { display: flex; flex-direction: column; gap: 14px; }
.quest-card {
  background: var(--card2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px;
  transition: border-color 0.2s;
}
.quest-card.quest-done { border-color: rgba(82,183,136,0.4); background: rgba(82,183,136,0.04); }
.quest-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.quest-icon   { font-size: 2rem; flex-shrink: 0; }
.quest-meta   { flex: 1; }
.quest-name   { font-weight: 800; font-size: 0.95rem; }
.quest-desc   { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.quest-badge  { font-size: 0.72rem; color: #52b788; font-weight: 700; white-space: nowrap; }
.quest-flavor {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 10px;
  padding: 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border-left: 3px solid rgba(255,210,63,0.4);
}
.quest-progress-wrap {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}
.quest-progress-fill { height: 100%; background: linear-gradient(90deg,#f4a261,#ffd700); border-radius: 3px; transition: width 0.5s; }
.quest-steps  { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.quest-step   { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); }
.quest-step.step-done   { color: #52b788; }
.quest-step.step-active { color: var(--text); font-weight: 600; }
.step-check { font-size: 1rem; flex-shrink: 0; }
.quest-reward {
  font-size: 0.78rem;
  color: #ffd700;
  font-weight: 700;
  padding: 6px 10px;
  background: rgba(255,215,0,0.08);
  border-radius: 8px;
}

/* ── Boss Économique ────────────────────────────────────────── */
.boss-panel {
  margin: 16px 0;
  background: var(--card2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 16px;
}
.boss-panel.boss-active { border-color: rgba(230,57,70,0.5); background: rgba(230,57,70,0.05); }
.boss-header { font-size: 1rem; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.boss-badge { font-size: 0.7rem; background: #e63946; color: #fff; border-radius: 20px; padding: 2px 8px; }
.boss-desc  { font-size: 0.82rem; color: var(--muted); margin-bottom: 10px; }
.boss-goal-label, .boss-time-label { font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }
.boss-bar-wrap { height: 8px; background: rgba(255,255,255,0.07); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.boss-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; background: #52b788; }
.boss-bar-fill.time-fill { background: #e63946; }
.boss-reward { font-size: 0.82rem; color: #ffd700; font-weight: 700; }
.boss-panel.boss-waiting { opacity: 0.7; }

/* ── Franchises ─────────────────────────────────────────────── */
.franchise-section { margin-top: 24px; }
.franchise-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.franchise-info { font-size: 0.75rem; color: var(--muted); margin-bottom: 14px; }
.franchise-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.franchise-card {
  background: var(--card2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
  transition: border-color 0.2s;
}
.franchise-card.franchise-owned { border-color: rgba(82,183,136,0.4); }
.franchise-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.franchise-icon { font-size: 1.4rem; }
.franchise-name { font-weight: 700; font-size: 0.88rem; }
.franchise-desc { font-size: 0.75rem; color: var(--muted); margin-bottom: 10px; }
.franchise-owned-badge { font-size: 0.75rem; color: #52b788; font-weight: 700; }
.franchise-buy-btn {
  width: 100%;
  background: linear-gradient(135deg, #52b788, #2d6a4f);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 7px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.franchise-buy-btn:hover:not(:disabled) { opacity: 0.85; }
.franchise-buy-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Stats avancées ─────────────────────────────────────────── */
.rep-bar-wrap {
  height: 10px;
  background: rgba(255,255,255,0.07);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 4px;
}
.rep-bar-fill { height: 100%; border-radius: 5px; transition: width 0.5s, background 0.5s; }
.rep-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--muted); margin-bottom: 14px; }
.stats-market { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.stat-market-row { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; padding: 4px 8px; background: rgba(255,255,255,0.03); border-radius: 6px; }
.stats-section-label { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 14px 0 8px; border-bottom: 1px solid rgba(255,255,255,0.07); padding-bottom: 4px; }

/* ── PROFILE MODAL ──────────────────────────────────── */

.profile-modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

.profile-modal {
  background: var(--card2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  width: 480px; max-width: calc(100vw - 32px);
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
  display: flex; flex-direction: column;
}

.profile-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 1rem; font-weight: 800;
}

.profile-close-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  width: 30px; height: 30px;
  cursor: pointer; color: var(--muted);
  font-size: 0.8rem; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.profile-close-btn:hover { background: rgba(255,255,255,0.14); color: var(--text); }

.profile-modal-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 20px; }
.profile-loading { text-align: center; padding: 2rem; color: var(--muted); }

/* Profil utilisateur */
.profile-info { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.profile-avatar { font-size: 3rem; }
.profile-username { font-size: 1.15rem; font-weight: 800; }
.profile-stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-top: 6px;
}
.profile-stat {
  background: var(--steel); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; display: flex; flex-direction: column; gap: 3px;
}
.profile-stat .ps-label { font-size: 0.68rem; color: var(--muted); font-weight: 600; }
.profile-stat strong { font-size: 1rem; color: var(--gold); font-weight: 800; }

/* Zone dangereuse */
.profile-danger-zone {
  background: rgba(230,57,70,0.07);
  border: 1px solid rgba(230,57,70,0.25);
  border-radius: var(--radius-md);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
}
.danger-title { font-size: 0.82rem; font-weight: 800; color: #e63946; }
.danger-desc  { font-size: 0.76rem; color: var(--muted); line-height: 1.5; }
.danger-btn {
  background: rgba(230,57,70,0.14);
  border: 1px solid rgba(230,57,70,0.4);
  border-radius: 9px; color: #e63946;
  font-size: 0.8rem; font-weight: 700;
  padding: 9px 16px; cursor: pointer;
  transition: background 0.15s;
  align-self: flex-start;
}
.danger-btn:hover { background: rgba(230,57,70,0.28); }

/* Panel Admin */
.admin-links { display: flex; gap: 10px; margin-bottom: 4px; }
.admin-link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(82,183,136,0.12);
  border: 1px solid rgba(82,183,136,0.3);
  border-radius: 9px; color: var(--green);
  font-size: 0.8rem; font-weight: 700;
  padding: 8px 14px; text-decoration: none;
  transition: background 0.15s;
}
.admin-link-btn:hover { background: rgba(82,183,136,0.22); }

.admin-users-list {
  display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto;
}
.admin-user-row {
  display: grid; grid-template-columns: 20px 1fr auto auto; align-items: center; gap: 10px;
  background: var(--steel); border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 12px;
}
.admin-user-nosave { opacity: 0.45; }
.admin-user-role   { font-size: 0.9rem; }
.admin-user-name   { font-size: 0.82rem; font-weight: 700; }
.admin-user-stat   { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.admin-reset-btn {
  background: rgba(230,57,70,0.12);
  border: 1px solid rgba(230,57,70,0.3);
  border-radius: 7px; color: #e63946;
  font-size: 0.72rem; font-weight: 700;
  padding: 4px 10px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s;
}
.admin-reset-btn:hover { background: rgba(230,57,70,0.26); }
