/* ===== Khangouloot Flotte (40k) : complète market.css ===== */
.fl-budget { justify-content: flex-start; gap: 18px; }
.fl-budget input { width: 80px; padding: 3px 6px; border: 1px solid var(--border); font-family: inherit; }
.fl-over { color: var(--error); }

.fl-layout { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(360px, 1.6fr); gap: 14px; align-items: start; }
@media (max-width: 900px) {
    .fl-layout { grid-template-columns: 1fr; }
}

.fl-ship { padding: 10px; }
.fl-ship-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 6px; padding-right: 16px; }
.fl-sp { font-weight: 600; white-space: nowrap; }

.fl-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0; font-size: 0.9rem; }
.fl-stats b { font-weight: normal; color: var(--color-text-secondary); font-size: 0.8rem; }

.fl-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.fl-filters input[type=text] { flex: 1; min-width: 180px; }
.fl-filters input[type=text], .fl-filters select { padding: 4px 7px; border: 1px solid var(--border); border-radius: 5px; font-family: inherit; }
.fl-hull { align-items: center; }
.fl-hull.fl-unknown { opacity: 0.75; }
.fl-hull-buy { display: flex; flex-direction: column; align-items: end; gap: 4px; flex-shrink: 0; }
.mk .modal-footer button.mk-btn-danger { background: var(--error, #8e1b1b); color: #fff; border-color: var(--error, #8e1b1b); }

/* thème sombre 40k : market.css est pensé pour le parchemin fantasy (lignes claires, champs blancs) */
.theme-40k .fl-hull, .theme-40k .fl-ship { background: #222826; border-color: rgba(156, 124, 69, 0.45); color: var(--text); }
.theme-40k .fl-hull strong, .theme-40k .fl-ship .mk-ship-name { color: var(--primary); }
.theme-40k .fl-budget input, .theme-40k .fl-filters select, .theme-40k .fl-filters input, .theme-40k .mk-field input {
    background: #121514; color: var(--text); border-color: var(--border);
}
.theme-40k .fl-stats b, .theme-40k .fl-ship .mk-muted, .theme-40k .fl-hull .mk-muted { color: #a89c82; }
.theme-40k .fl-sp { color: #d9b56a; }
.theme-40k .fl-sp.fl-over, .theme-40k .fl-over { color: #e07a6e; }
.theme-40k .mk .modal { background: var(--card-bg); color: var(--text); }

/* composants */
.fl-balance { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.9rem; margin: 2px 0; }
.mk .modal.fl-fit { max-width: 860px; }
.fl-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.fl-row > span:first-child { min-width: 120px; }
.fl-row select { flex: 1; min-width: 200px; max-width: 100%; padding: 4px 6px; border: 1px solid var(--border); border-radius: 5px; font-family: inherit; }
.fl-facing { margin: 4px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fl-chip { display: inline-flex; gap: 6px; align-items: center; margin: 2px 4px 2px 0; font-size: 0.8rem; }
.theme-40k .fl-row select { background: #121514; color: var(--text); }
.theme-40k .fl-fit .panel-title { color: var(--primary); }

/* ===== origine des composants : fond légèrement teinté (puces et options de liste) ===== */
.fl-tech-archeo { background: rgba(201, 164, 99, 0.18) !important; border-color: #c9a463 !important; }
.fl-tech-xenos { background: rgba(79, 154, 126, 0.18) !important; border-color: #4f9a7e !important; }
.fl-tech-faction { background: rgba(140, 90, 180, 0.18) !important; border-color: #8a6ac4 !important; }
.fl-tech-upgrade { background: rgba(120, 140, 170, 0.16) !important; border-color: #8d99a8 !important; font-style: italic; }
.theme-40k option.fl-tech-archeo { background: #2d2a1f !important; }
.theme-40k option.fl-tech-xenos { background: #1c2b25 !important; }
.theme-40k option.fl-tech-faction { background: #251e2e !important; }
.theme-40k option.fl-tech-upgrade { background: #1f2329 !important; }
.fl-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; font-size: 0.75rem; }
.fl-legend .fl-chip { padding: 1px 8px; border: 1px solid; border-radius: 10px; }
/* type d'arme : liseré à gauche (macrobatterie laiton, lance bleu électrique, torpilles rouge, baies gris) */
.fl-chip.fl-w-macrobattery { box-shadow: inset 3px 0 0 #c9a463; }
.fl-chip.fl-w-lance { box-shadow: inset 3px 0 0 #6fb7e6; }
.fl-chip.fl-w-nova-cannon { box-shadow: inset 3px 0 0 #e0b83a; }
.fl-chip.fl-w-torpedo-tubes { box-shadow: inset 3px 0 0 #e07a6e; }
.fl-chip.fl-w-landing-bay { box-shadow: inset 3px 0 0 #8d99a8; }
.fl-hull.fl-estimated .fl-sp { font-style: italic; }

/* ===== thèmes par faction (cartes, chantier, fenêtre des composants), comme les cartes d'objets du générateur ===== */
.fl-ship, .fl-hull, .fl-fit { --fl-tint: transparent; --fl-rule: rgba(156, 124, 69, 0.45); --fl-orn: '✠'; }
.theme-40k .fl-ship, .theme-40k .fl-hull { background: linear-gradient(var(--fl-tint), var(--fl-tint)), #222826; border-color: var(--fl-rule); position: relative; }
.theme-40k .fl-fit { background: linear-gradient(var(--fl-tint), var(--fl-tint)), var(--card-bg); border-color: var(--fl-rule); }
.fl-ship::after { content: var(--fl-orn); position: absolute; top: 4px; right: 8px; font-size: 13px; color: var(--fl-rule); opacity: .9; }
.fl-faction-imperium { --fl-tint: rgba(201, 164, 99, 0.05); --fl-rule: #9c7c45; --fl-orn: '✠'; }
.fl-faction-adeptus-astartes { --fl-tint: rgba(36, 66, 122, 0.22); --fl-rule: #c9a463; --fl-orn: '✦'; }
.fl-faction-mechanicum { --fl-tint: rgba(155, 42, 28, 0.18); --fl-rule: #b4793a; --fl-orn: '⚙'; }
.fl-faction-chaos { --fl-tint: rgba(110, 15, 15, 0.25); --fl-rule: #8a3a2a; --fl-orn: '✸'; }
.fl-faction-ork { --fl-tint: rgba(79, 107, 37, 0.22); --fl-rule: #8a9a3a; --fl-orn: '☠'; }
.fl-faction-eldar-corsair { --fl-tint: rgba(78, 46, 138, 0.2); --fl-rule: #6fb7c9; --fl-orn: '◈'; }
.fl-faction-eldar-craftworld { --fl-tint: rgba(43, 107, 85, 0.2); --fl-rule: #7fd1ac; --fl-orn: '◈'; }
.fl-faction-dark-eldar { --fl-tint: rgba(60, 20, 70, 0.3); --fl-rule: #8a4a9e; --fl-orn: '✶'; }
.fl-faction-rak-gol { --fl-tint: rgba(110, 70, 40, 0.22); --fl-rule: #a06a3a; --fl-orn: '⚠'; }
.fl-faction-stryxis { --fl-tint: rgba(150, 120, 40, 0.18); --fl-rule: #c9a227; --fl-orn: '◆'; }
.fl-faction-kroot { --fl-tint: rgba(90, 110, 50, 0.2); --fl-rule: #9a8a4a; --fl-orn: '❦'; }
.fl-faction-pirate { --fl-tint: rgba(90, 90, 90, 0.2); --fl-rule: #a83a3a; --fl-orn: '☠'; }

/* illustrations des coques : traits sombres sur fond clair ; en thème sombre, inversées en « plan » clair */
.fl-art { display: block; width: 100%; max-height: 190px; object-fit: contain; margin: 6px 0; border-radius: 4px; }
.fl-thumb { width: 120px; height: 64px; object-fit: contain; flex-shrink: 0; margin-right: 8px; border-radius: 3px; }
.theme-40k .fl-art, .theme-40k .fl-thumb { filter: invert(1) sepia(0.35) brightness(0.95) contrast(1.1); mix-blend-mode: screen; }
.theme-40k .fl-art.fl-backdrop, .theme-40k .fl-thumb.fl-backdrop { filter: none; mix-blend-mode: normal; }
@media (max-width: 600px) { .fl-thumb { display: none; } }
.fl-legend .fl-chip, .fl-chip { color: var(--text); }

/* illustrations : miroir pour les proues à gauche, zoom au clic */
.fl-art, .fl-thumb { cursor: zoom-in; }
.fl-flip { transform: scaleX(-1); }
.fl-zoom { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; background: rgba(0, 0, 0, .85); cursor: zoom-out; }
.fl-zoom img { max-width: 96vw; max-height: 86vh; object-fit: contain; background: #fff; border-radius: 4px; }
.fl-zoom img.fl-backdrop { background: none; }
.fl-zoom span { color: #eee; font-size: 1.1em; }

/* chargement des baies et des tubes */
.fl-load { border: 1px solid var(--border, #8884); border-radius: 4px; padding: 6px 8px; margin: 6px 0; }
.fl-load .fl-row { flex-wrap: wrap; }
.fl-load select { max-width: 100%; }
.fl-qty { width: 4.5em; }
/* pastilles neutres (armes, chargement) lisibles en thème 40k sombre ; les fonds archéotech/xenotech/faction restent prioritaires */
.theme-40k .mk-badge.fl-chip { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border, #8886); color: var(--text); }

/* récapitulatif */
.fl-recap-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 4px 0 8px; }
.fl-recap-table th, .fl-recap-table td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--border, #8884); vertical-align: top; }
.fl-recap-table td:last-child, .fl-recap-table th:last-child { text-align: right; }
.fl-rule { font-size: 0.85rem; margin: 3px 0; }
.fl-recap .fl-row > span:first-child { min-width: 140px; }
.fl-tech-relic { background: rgba(200, 80, 60, 0.16) !important; border-color: #c8503c !important; }
.theme-40k option.fl-tech-relic { background: #2e1d1a !important; }
