:root {
  --bg1: #0a0e1a;
  --bg2: #111827;
  --panel: #151b2b;
  --panel2: #1b2338;
  --border: #28324a;
  --text: #e7ecf7;
  --muted: #8b96b3;
  --accent: #5eb1ff;
  --accent2: #9d7cff;
  --good: #3ddc97;
  --warn: #ffb454;
  --bad: #ff6b6b;
  --solar: #ffa726;
  --solar-bg: #2b1d0c;
  --solar-border: #663c00;
  --planet: #a594fd;
  --planet-border: #4d4375;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 15% -10%, #1a2544 0%, transparent 60%),
              radial-gradient(1000px 500px at 110% 10%, #241a3d 0%, transparent 55%),
              var(--bg1);
  color: var(--text);
  min-height: 100vh;
  padding: 24px 16px 60px;
}

.wrap {
  max-width: 1220px;
  margin: 0 auto;
}

header {
  margin-bottom: 22px;
}

header h1 {
  font-size: 1.7rem;
  margin: 0 0 4px;
  letter-spacing: 0.3px;
  background: linear-gradient(90deg, #8fd0ff, #ffb259);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

header p {
  color: var(--muted);
  margin: 0;
  font-size: 0.92rem;
}

/* Barre de navigation inter-pages */
.nav-bar {
  display: flex;
  gap: 8px;
  margin: 22px 0 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.nav-link {
  color: var(--muted);
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-link.solar-link.active {
  color: var(--solar);
  border-bottom-color: var(--solar);
}

.nav-link.planet-link.active {
  color: var(--planet);
  border-bottom-color: var(--planet);
}

/* Cartes et panneaux */
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card.card-solar {
  border-color: var(--solar-border);
  background: linear-gradient(180deg, #191522, #1f1a18);
}

.card.card-planet {
  border-color: var(--planet-border);
  background: linear-gradient(180deg, #181726, #161520);
}

.card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2 .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.card h2 .dot-solar {
  background: var(--solar);
}

.card h2 .dot-planet {
  background: var(--planet);
}

/* Grilles */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 760px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* Formulaires */
label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

select, input {
  width: 100%;
  background: #0d1322;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
  margin-bottom: 12px;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
}

.card-solar select:focus, .card-solar input:focus {
  border-color: var(--solar);
}

.card-planet select:focus, .card-planet input:focus {
  border-color: var(--planet);
}

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

.row-inline > div {
  flex: 1;
}

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

.row-inline3 > div {
  flex: 1;
}

/* Boutons */
button.btn, a.btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0a0e1a;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.btn:hover, a.btn:hover {
  filter: brightness(1.08);
}

button.btn.solar {
  background: linear-gradient(135deg, #ffa726, #f57c00);
}

button.btn.planet {
  background: linear-gradient(135deg, #a594fd, #7b61ff);
}

button.btn.secondary, a.btn.secondary {
  background: #232c44;
  color: var(--text);
  border: 1px solid var(--border);
}

button.btn.danger {
  background: #3a1c22;
  color: #ff9d9d;
  border: 1px solid #5c2530;
}

button.btn.small, a.btn.small {
  padding: 5px 10px;
  font-size: 0.75rem;
}

/* Tableaux */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  padding: 8px 9px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}

th:hover {
  color: var(--accent);
}

tbody tr:hover {
  background: #ffffff06;
}

.ngc-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.ngc-row:hover {
  background: rgba(94, 177, 255, 0.1) !important;
}

.type-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 20px;
  background: #233252;
  color: #a9c6ff;
  white-space: nowrap;
}

.scroll-table {
  overflow-x: auto;
}

/* Indicateurs de résultats */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.stat {
  background: #0d1322;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.stat.solar-stat {
  background: #181313;
  border-color: #472c10;
}

.stat.planet-stat {
  background: #171622;
  border-color: #3c3656;
}

.stat .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.stat.solar-stat .value {
  color: var(--solar);
}

.stat.planet-stat .value {
  color: var(--planet);
}

.stat .sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.verdict {
  padding: 12px 16px;
  border-radius: 10px;
  margin-top: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  gap: 10px;
}

.verdict.good {
  background: #0f2e23;
  color: var(--good);
  border: 1px solid #1d5c44;
}

.verdict.ok {
  background: #2a2410;
  color: var(--warn);
  border: 1px solid #5c4a1d;
}

.verdict.bad {
  background: #331717;
  color: var(--bad);
  border: 1px solid #5c2222;
}

.info-box {
  background: #1d2538;
  border-left: 4px solid var(--planet);
  padding: 12px 16px;
  border-radius: 6px;
  margin-top: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.info-box ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.bin-table th, .bin-table td {
  text-align: center;
}

.bin-table td:first-child, .bin-table th:first-child {
  text-align: left;
}

.form-panel {
  display: none;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.form-panel.open {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.muted-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  margin-top: 8px;
}

.combo-factor {
  margin-top: 2px;
  padding: 10px 14px;
  background: #0d1322;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.combo-factor b {
  color: var(--accent);
  font-size: 1.05rem;
}

/* Modales & Graphiques */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.modal-overlay.open {
  display: flex;
  animation: fade 0.2s ease;
}

.modal-content {
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 12px;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
  margin-top: 0;
  color: var(--text);
}

.modal-content p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-buttons button {
  flex: 1;
}

.ephem-tabs button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.ephem-tabs button.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.ephem-tabs button:first-child {
  border-radius: 6px 0 0 6px;
}

.ephem-tabs button:last-child {
  border-radius: 0 6px 6px 0;
  border-left: none;
}

.ephem-tabs button:nth-child(2) {
  border-left: none;
}

/* Portail d'accueil (Tuiles de modules) */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.hub-card {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s, transform 0.15s;
}

.hub-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.hub-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-card p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0 0 14px;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}