@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #22d3ee;
  --primary-dark: #0891b2;

  /* Palette de statut validee (fixe, jamais themee) - cf. references/palette.md */
  --danger: #d03b3b;   /* critical / rejete */
  --success: #0ca30c;  /* good / approuve */
  --warning: #fab219;  /* warning / en attente */

  --bg: #0b0f14;
  --bg-alt: #10151c;
  --card: #131a22;
  --card-hover: #17202a;
  --text: #e6edf3;
  --muted: #7d8b99;
  --border: #22303c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

::selection { background: var(--primary); color: #001318; }

a { color: var(--primary); }

nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.2rem;
  padding: 1rem 2rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

nav .brand {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--text);
}

nav .brand::before { content: "> "; color: var(--primary); }

nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.4rem;
  font-size: 0.88rem;
  transition: color 0.15s ease;
}

nav a:hover { color: var(--primary); }

main {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.6rem;
  margin-bottom: 1.4rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

h1 {
  font-size: 1.5rem;
  margin-top: 0;
  letter-spacing: -0.01em;
}

h1::before { content: "$ "; color: var(--primary); font-weight: 400; }

.subtitle { color: var(--muted); font-size: 0.9rem; margin-top: -0.6rem; }

label {
  display: block;
  margin: 1rem 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
  font-family: inherit;
  background: var(--bg-alt);
  color: var(--text);
}

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

textarea { min-height: 110px; resize: vertical; }

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.7rem 1.3rem;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  margin-top: 1.2rem;
  margin-right: 0.5rem;
  transition: filter 0.15s ease, transform 0.05s ease;
}

button:hover { filter: brightness(1.1); }
button:active { transform: translateY(1px); }

.btn-primary { background: var(--primary); color: #001318; }
.btn-success { background: var(--success); color: #001c08; }
.btn-danger { background: var(--danger); color: #2b0000; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-attente { background: rgba(251, 191, 36, 0.15); color: var(--warning); border: 1px solid rgba(251, 191, 36, 0.3); }
.badge-approuve { background: rgba(74, 222, 128, 0.15); color: var(--success); border: 1px solid rgba(74, 222, 128, 0.3); }
.badge-rejete { background: rgba(248, 113, 113, 0.15); color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.3); }

.report-item {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  transition: background 0.15s ease;
}
.report-item:last-child { border-bottom: none; }
.report-item:hover { background: var(--card-hover); }

.report-item .titre { font-weight: 700; font-size: 1rem; }
.report-item .meta { color: var(--muted); font-size: 0.82rem; margin-top: 0.25rem; }
.report-item p { margin: 0.5rem 0 0; color: var(--text); font-size: 0.9rem; }

#map {
  height: 440px;
  border-radius: 8px;
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  filter: saturate(0.85);
}

/* Carte plein ecran (page d'accueil) */
.map-hero {
  position: relative;
  width: 100%;
  height: calc(100vh - 66px);
  min-height: 480px;
}

.map-hero #map {
  height: 100%;
  width: 100%;
  border-radius: 0;
  border: none;
  margin: 0;
}

.map-overlay {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  z-index: 15;
  width: 340px;
  max-width: calc(100% - 2.4rem);
  max-height: calc(100% - 2.4rem);
  overflow-y: auto;
  background: rgba(19, 26, 34, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@media (max-width: 720px) {
  .map-overlay { width: calc(100% - 2.4rem); }
  .map-hero { height: 70vh; }
}

/* Marqueurs animes (pulse) sur la carte */
.pulse-marker {
  position: relative;
  width: 18px;
  height: 18px;
}

.pulse-marker .dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--marker-color, var(--primary));
  box-shadow: 0 0 8px var(--marker-color, var(--primary));
}

.pulse-marker .ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--marker-color, var(--primary));
  opacity: 0.65;
  animation: pulse-ring 2.2s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.6; }
  70%  { transform: scale(3.4); opacity: 0; }
  100% { transform: scale(3.4); opacity: 0; }
}

.error { color: var(--danger); font-size: 0.85rem; margin-top: 0.6rem; }
.success { color: var(--success); font-size: 0.85rem; margin-top: 0.6rem; }

.filters { display: flex; gap: 0.6rem; margin-bottom: 1rem; align-items: center; }
.filters select { width: auto; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 0.8rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 0.4rem;
}

.stat-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.stat {
  flex: 1;
  min-width: 140px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
}
.stat .value { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.stat .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

/* ---- Graphiques (page statistiques) ---- */

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.55rem 0;
}

.bar-row .bar-name {
  width: 160px;
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--text);
}

.bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg-alt);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px 4px 4px 4px;
  min-width: 4px;
  transition: filter 0.15s ease;
}
.bar-fill:hover { filter: brightness(1.2); cursor: pointer; }

.bar-row .bar-value {
  width: 42px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.chart-svg-wrap { position: relative; }
.chart-svg-wrap svg { width: 100%; display: block; overflow: visible; }
.chart-svg-wrap .grid-line { stroke: var(--border); stroke-width: 1; }
.chart-svg-wrap .trend-area { fill: var(--primary); opacity: 0.1; }
.chart-svg-wrap .trend-line { fill: none; stroke: var(--primary); stroke-width: 2; }
.chart-svg-wrap .trend-dot {
  fill: var(--primary);
  stroke: var(--card);
  stroke-width: 2;
}
.chart-svg-wrap .trend-dot:hover { r: 6; cursor: pointer; }
.chart-svg-wrap .axis-label { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart-svg-wrap .end-label { fill: var(--text); font-size: 11px; font-weight: 700; font-family: inherit; }

.viz-tooltip {
  position: fixed;
  z-index: 100;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.viz-tooltip.visible { opacity: 1; }

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.stats-table th, .stats-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.stats-table th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}
.stats-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
