
:root{
  --bg:#071229;
  --card: rgba(255,255,255,.06);
  --card2: rgba(255,255,255,.08);
  --stroke: rgba(255,255,255,.10);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.64);
  --accent: #4cc9f0;
  --ok:#58d68d;
  --warn:#f7c948;
  --bad:#ff6b6b;
  --shadow: 0 20px 60px rgba(0,0,0,.35);
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
.bg{
  position:fixed; inset:0;
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(76,201,240,.18), transparent 60%),
    radial-gradient(1000px 600px at 80% 30%, rgba(88,214,141,.12), transparent 65%),
    radial-gradient(900px 600px at 50% 90%, rgba(247,201,72,.10), transparent 60%);
  pointer-events:none;
}
.topbar{
  position:sticky; top:0; z-index:10;
  backdrop-filter: blur(10px);
  background: rgba(7,18,41,.65);
  border-bottom: 1px solid var(--stroke);
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 16px;
}
.brand{ display:flex; gap:12px; align-items:center;}
.logo{
  width:40px; height:40px; border-radius:12px;
  background: linear-gradient(135deg, rgba(76,201,240,.9), rgba(88,214,141,.9));
  display:grid; place-items:center;
  color:#062039; font-weight:800;
  box-shadow: var(--shadow);
}
.title{ font-weight:800; letter-spacing:.2px; }
.subtitle{ font-size:12px; color:var(--muted); margin-top:2px; }
.actions{ display:flex; gap:10px; }
.btn{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.08);
  color: var(--text);
  padding:10px 12px;
  border-radius:12px;
  font-weight:600;
}
.btn.ghost{ background: transparent; }
.btn:active{ transform: translateY(1px); }
.container{
  width:min(1100px, 94vw);
  margin: 18px auto 40px;
  display:flex;
  flex-direction:column;
  gap:14px;
}
.card{
  background: var(--card);
  border:1px solid var(--stroke);
  border-radius:18px;
  padding:16px;
  box-shadow: var(--shadow);
}
.card-head{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
h2{ margin:0; font-size:18px; }
h3{ margin: 0 0 10px 0; font-size:14px; color: rgba(255,255,255,.86); }
.pill{
  border:1px solid var(--stroke);
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  color: var(--muted);
  background: rgba(255,255,255,.06);
  white-space:nowrap;
}
.pill.ok{ color: rgba(88,214,141,.95); border-color: rgba(88,214,141,.35); background: rgba(88,214,141,.12); }
.grid3{ display:grid; grid-template-columns: repeat(3, 1fr); gap:12px; }
.grid4{ display:grid; grid-template-columns: repeat(4, 1fr); gap:12px; }
.grid2{ display:grid; grid-template-columns: repeat(2, 1fr); gap:12px; }
@media (max-width: 860px){
  .grid3{ grid-template-columns: 1fr; }
  .grid4{ grid-template-columns: 1fr; }
  .grid2{ grid-template-columns: 1fr; }
  .actions{ display:none; }
}
.stat{
  background: var(--card2);
  border:1px solid var(--stroke);
  border-radius:16px;
  padding:12px;
}
.stat .label{ font-size:12px; color:var(--muted); }
.stat .value{ margin-top:6px; font-size:22px; font-weight:800; }
.stat .hint{ margin-top:6px; font-size:12px; color:var(--muted); }
.divider{ height:1px; background: var(--stroke); margin:14px 0; }

.bars{ display:flex; flex-direction:column; gap:10px; }
.bar{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  font-size:13px;
}
.track{
  flex:1;
  height:10px;
  background: rgba(255,255,255,.08);
  border:1px solid var(--stroke);
  border-radius:999px;
  overflow:hidden;
}
.fill{ height:100%; background: rgba(76,201,240,.75); }

.list{ display:flex; flex-direction:column; gap:10px; }
.item{
  background: rgba(255,255,255,.06);
  border:1px solid var(--stroke);
  border-radius:14px;
  padding:10px;
}
.item .k{ font-weight:700; }
.item .v{ color: var(--muted); font-size:12px; margin-top:4px; }

.row{ display:flex; gap:10px; align-items:center; }
.input, .select{
  background: rgba(255,255,255,.06);
  border:1px solid var(--stroke);
  border-radius:12px;
  padding:10px 12px;
  color: var(--text);
  outline:none;
}
.input{ width: min(420px, 100%); }
.select{ min-width:120px; }

.form .label{
  display:block;
  font-size:12px;
  color: rgba(255,255,255,.78);
  margin: 6px 0 6px;
}

.chart-wrap{
  position: relative;
  width:100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--stroke);
  border-radius:14px;
  padding:10px;
  overflow:hidden;
}

canvas{ max-width:100%; height:auto; }
.table-wrap{ overflow:auto; border-radius:14px; border:1px solid var(--stroke); }
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 860px;
  background: rgba(5,14,32,.35);
}
th,td{
  padding:10px 10px;
  border-bottom:1px solid rgba(255,255,255,.08);
  font-size:13px;
}
th{ text-align:left; color: rgba(255,255,255,.78); font-weight:700; background: rgba(255,255,255,.05); position:sticky; top:0; }
td.num, th.num{ text-align:right; font-variant-numeric: tabular-nums; }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.small{ font-size:12px; }
.muted{ color: var(--muted); }
.footer{
  text-align:center;
  padding: 20px 10px;
  color: var(--muted);
  font-size:12px;
}
.diag{
  background: rgba(255,255,255,.06);
  border:1px solid var(--stroke);
  border-radius:14px;
  padding:12px;
}
tr.stale td { opacity: 0.9; }
tr.stale td:nth-child(4) { filter: brightness(1.05); }

.badge{
  display:inline-block;
  margin-left:8px;
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  opacity:0.9;
}
.badge.live{ background: rgba(40, 180, 120, 0.18); }
.badge.fb{ background: rgba(255, 165, 0, 0.18); }
.badge.miss{ background: rgba(255, 80, 80, 0.18); }
/* Highlight lines where price is not real-time */
tr.stale-price td {
  background: rgba(255, 183, 77, 0.10);
}

/* Badges */
.badge{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  font-weight:700;
  font-size:12px;
  line-height:18px;
  border:1px solid rgba(255,255,255,0.12);
}
.badge.rt{  background: rgba(46, 204, 113, 0.18); }
.badge.fb{  background: rgba(241, 196, 15, 0.18); }
.badge.miss{background: rgba(231, 76, 60, 0.18); }

.subtle{
  font-size:12px;
  opacity:0.75;
  margin-top:2px;
}
.pxTag{
  display:inline-block;
  font-size:12px;
  padding:3px 8px;
  border-radius:999px;
  margin-left:8px;
  vertical-align:middle;
  opacity:.95;
}
.pxLive{ background: rgba(0,255,120,.18); border:1px solid rgba(0,255,120,.35); }
.pxFallback{ background: rgba(255,200,0,.18); border:1px solid rgba(255,200,0,.35); }
.pxMissing{ background: rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.18); }
/* ===== V2.2 - badges + lignes fallback ===== */

.badge{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  line-height:1.4;
  margin-left:8px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.06);
}

.badge-api{
  background:rgba(72, 187, 120, .18);
  border-color:rgba(72, 187, 120, .35);
}

.badge-fallback{
  background:rgba(236, 201, 75, .16);
  border-color:rgba(236, 201, 75, .35);
}

.badge-missing{
  background:rgba(245, 101, 101, .14);
  border-color:rgba(245, 101, 101, .35);
}

/* Lignes dont le prix n'est PAS temps réel */
.row-fallback td{
  background: rgba(236, 201, 75, .07);
}

/* Optionnel : petit texte "muted" (provider symbol / resolved symbol) */
.muted{
  opacity:.65;
  font-size:.92em;
}
/* =========================
   V2.2 — Badge source prix + lignes non temps-réel
   ========================= */

/* petit badge "API / Saisi / Manquant" */
.px-badge{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  padding:.18rem .55rem;
  border-radius:999px;
  font-size:.78rem;
  font-weight:700;
  letter-spacing:.02em;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:rgba(255,255,255,.85);
  white-space:nowrap;
}

.px-badge--api{
  background:rgba(46, 204, 113, .14);
  border-color:rgba(46, 204, 113, .25);
  color:rgba(213, 255, 233, .95);
}

.px-badge--fallback{
  background:rgba(241, 196, 15, .14);
  border-color:rgba(241, 196, 15, .28);
  color:rgba(255, 248, 214, .95);
}

.px-badge--missing{
  background:rgba(231, 76, 60, .14);
  border-color:rgba(231, 76, 60, .28);
  color:rgba(255, 220, 216, .95);
}

/* mise en évidence de la ligne quand prix ≠ temps réel */
tr.row--fallback td{
  background:rgba(241, 196, 15, .06);
}
tr.row--missing td{
  background:rgba(231, 76, 60, .06);
}

/* option: rendre le badge "Saisi" que tu vois déjà plus lisible */
.pill, .tag{
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
}
.badge{
  display:inline-block;
  font-size:12px;
  padding:2px 8px;
  border-radius:999px;
  margin-left:6px;
  vertical-align:middle;
  border:1px solid rgba(255,255,255,.12);
}
.badge-api{ background: rgba(46, 204, 113, .18); }
.badge-fallback{ background: rgba(241, 196, 15, .18); }
.badge-missing{ background: rgba(231, 76, 60, .18); }

.row-fallback td{
  background: rgba(241, 196, 15, .06);
}
/* V3 – badges + surlignage lignes non temps réel */
.badge{
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  margin-left:8px;
  vertical-align:middle;
  border:1px solid rgba(255,255,255,.18);
}
.badge-api{ background:rgba(46,204,113,.18); color:rgba(220,255,235,.95); }
.badge-fallback{ background:rgba(241,196,15,.18); color:rgba(255,245,210,.95); }
.badge-missing{ background:rgba(231,76,60,.18); color:rgba(255,225,220,.95); }

.row-fallback td{
  background: rgba(241,196,15,.06);
}
.row-fallback:hover td{
  background: rgba(241,196,15,.10);
}

/* Diagnostic pill états */
.pill.ok{ background: rgba(46,204,113,.16); border-color: rgba(46,204,113,.28); }
.pill.warn{ background: rgba(241,196,15,.14); border-color: rgba(241,196,15,.26); }
.pill.bad{ background: rgba(231,76,60,.14); border-color: rgba(231,76,60,.26); }
.badge{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  margin-left:8px;
  vertical-align:middle;
}
.badge-api{ border:1px solid rgba(0,255,170,.5); }
.badge-fallback{ border:1px solid rgba(255,210,0,.6); }
.badge-missing{ border:1px solid rgba(255,80,80,.6); }

.row-fallback{
  background: rgba(255, 210, 0, 0.08);
}

/* Tooltip chart (tap/hover) */
.tooltip{
  position:absolute;
  pointer-events:none;
  display:none;
  z-index:5;
  padding:10px 12px;
  border-radius:12px;
  background: rgba(8,12,20,.92);
  border:1px solid rgba(255,255,255,.12);
  color:#e9f1ff;
  max-width:260px;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  font-size:13px;
  line-height:1.35;
}
.tooltip strong{ display:block; font-size:13px; margin-bottom:4px; }

/* Tooltip rows for monthly chart */
.tooltip .tt-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin: 2px 0;
  font-size:12px;
}
.tooltip .tt-label{ opacity: 0.75; }
