:root {
  --orange: #ff6a1a;
  --orange-2: #ff8b3d;
  --orange-soft: #fff2e9;
  --ink: #171a1f;
  --muted: #6b7280;
  --line: #ececf1;
  --bg: #f7f7fb;
  --card: #ffffff;
  --good: #12a150;
  --warn: #d97706;
  --shadow: 0 10px 30px rgba(23, 26, 31, 0.08);
  --shadow-lg: 0 22px 60px rgba(255, 106, 26, 0.16);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Inter", system-ui, sans-serif; line-height: 1.5;
}
h1, h2, h3 { font-family: "Sora", sans-serif; margin: 0; }
.accent { color: var(--orange); }
.hidden { display: none !important; }

/* ---- Topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px; display: grid; place-items: center;
  font-size: 22px; color: #fff; border-radius: 14px;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  box-shadow: var(--shadow-lg);
}
.brand h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.tag { margin: 0; font-size: 12px; color: var(--muted); }
.live { display: flex; align-items: center; gap: 10px; }
.live .dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 0 rgba(18,161,80,0.5); animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(18,161,80,0.5); }
  70% { box-shadow: 0 0 0 10px rgba(18,161,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(18,161,80,0); }
}
.live-txt { display: flex; flex-direction: column; line-height: 1.1; }
.live-txt strong { font-size: 12px; letter-spacing: 1px; color: var(--good); }
.live-txt small { font-size: 11px; color: var(--muted); }
#refresh-btn {
  border: 1px solid var(--line); background: #fff; width: 38px; height: 38px;
  border-radius: 12px; font-size: 18px; cursor: pointer; color: var(--orange);
  transition: transform .3s, background .2s;
}
#refresh-btn:hover { background: var(--orange-soft); transform: rotate(90deg); }

/* ---- Controls ---- */
.controls {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  max-width: 1180px; margin: 22px auto 0; padding: 18px; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.grow { flex: 1; min-width: 180px; }
.field label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.field input, .field select {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink); min-width: 78px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 40; margin-top: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 280px; overflow-y: auto;
}
.sug-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: 13px; }
.sug-item:last-child { border-bottom: none; }
.sug-item:hover { background: var(--orange-soft); }
.sug-item .sug-code { color: var(--orange); font-weight: 700; font-family: "Sora"; margin-left: 4px; }
.sug-item small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.cta {
  padding: 12px 22px; border: none; border-radius: 12px; cursor: pointer;
  font-weight: 700; font-size: 14px; color: #fff; font-family: "Sora";
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  box-shadow: var(--shadow-lg); transition: transform .15s;
}
.cta:hover { transform: translateY(-2px); }

main { max-width: 1180px; margin: 0 auto; padding: 24px 18px 60px; }

/* ---- Detail ---- */
.detail {
  margin-top: 24px; background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow); overflow: hidden;
}
.detail-hero {
  padding: 26px; display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; flex-wrap: wrap;
  background: linear-gradient(135deg, #fff, var(--orange-soft));
  border-bottom: 1px solid var(--line);
}
.detail-hero h2 { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.detail-hero .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chip { font-size: 11px; padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.total-badge { text-align: right; }
.total-badge .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.total-badge .amt { font-family: "Sora"; font-size: 40px; font-weight: 800; color: var(--orange); line-height: 1; }
.total-badge .per { font-size: 12px; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 22px; }
.cost-card {
  border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  background: #fff; position: relative; transition: transform .15s, box-shadow .15s;
}
.cost-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cost-card .ico { font-size: 22px; }
.cost-card h4 { font-family: "Sora"; font-size: 14px; margin: 8px 0 2px; }
.cost-card .big { font-size: 26px; font-weight: 800; font-family: "Sora"; }
.cost-card .detail-line { font-size: 12px; color: var(--muted); margin-top: 4px; }
.src { display: inline-block; margin-top: 10px; font-size: 10px; padding: 3px 8px; border-radius: 6px; }
.src.real { background: #e7f7ee; color: var(--good); }
.src.est { background: #fff3e0; color: var(--warn); }

.context { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 0 22px 22px; }
.ctx-card { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: #fff; }
.ctx-card h4 { font-family: "Sora"; font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border: none; }
.reviews { display: flex; flex-direction: column; gap: 10px; }
.review { border-left: 3px solid var(--orange); padding: 6px 0 6px 12px; }
.review a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13px; }
.review a:hover { color: var(--orange); }
.review .meta { font-size: 11px; color: var(--muted); }
.senti { font-size: 11px; padding: 3px 10px; border-radius: 999px; margin-left: auto; }
.senti.positif { background: #e7f7ee; color: var(--good); }
.senti.neutre { background: #f1f1f4; color: var(--muted); }
.senti.mitige { background: #fdecec; color: #d33; }

/* ---- Board ---- */
.board-wrap { margin-top: 34px; }
.board-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.board-head h2 { font-size: 22px; font-weight: 800; }
.board-head small { color: var(--muted); font-size: 12px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.board-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.board-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--orange); }
.board-card .bc-top { display: flex; justify-content: space-between; align-items: center; }
.board-card .name { font-family: "Sora"; font-weight: 700; font-size: 16px; }
.board-card .country { font-size: 12px; color: var(--muted); }
.board-card .price { font-family: "Sora"; font-size: 24px; font-weight: 800; color: var(--orange); margin-top: 10px; }
.board-card .mini { display: flex; gap: 10px; font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ---- Sources ---- */
.sources { margin-top: 40px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.sources h3 { font-size: 16px; margin-bottom: 14px; }
.sources-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.source-pill { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.source-pill .s-dot { width: 8px; height: 8px; border-radius: 50%; }
.s-on { background: var(--good); } .s-off { background: #cbd0d6; }
.fineprint { font-size: 11px; color: var(--muted); margin-top: 14px; line-height: 1.6; }

/* ---- Scoring ---- */
.board-tools { display: flex; align-items: center; gap: 10px; }
.board-tools label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.board-tools select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; font-family: inherit; font-size: 13px; background: #fff; }
.score-badge { color: #fff; font-family: "Sora"; font-weight: 800; font-size: 15px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.global-score { margin-top: 12px; font-size: 12px; color: var(--muted); border: 1.5px solid; border-radius: 10px; padding: 6px 10px; display: inline-block; }
.global-score b { font-family: "Sora"; font-size: 18px; }
.score-panel { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; padding: 22px; border-bottom: 1px solid var(--line); }
.score-bars { display: flex; flex-direction: column; gap: 9px; }
.score-row { display: flex; align-items: center; gap: 10px; }
.score-lbl { width: 110px; font-size: 13px; }
.score-track { flex: 1; height: 9px; background: #f0f0f4; border-radius: 999px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 999px; transition: width .5s; }
.score-val { width: 30px; text-align: right; font-family: "Sora"; font-weight: 700; font-size: 13px; }
.signals { display: flex; flex-direction: column; gap: 8px; align-content: start; }
.signal { font-size: 12.5px; padding: 8px 12px; border-radius: 10px; background: #f6f6f9; border: 1px solid var(--line); }
.signal.sig-ok { background: #e7f7ee; border-color: #b6e6c9; }
.signal.sig-warn { background: #fff3e0; border-color: #ffdca8; }
.signal.sig-bad { background: #fdecec; border-color: #f7c5c5; color: #b3261e; }

footer { text-align: center; padding: 24px; color: var(--muted); font-size: 12px; }

.skeleton { color: var(--muted); text-align: center; padding: 40px; }

@media (max-width: 760px) {
  .grid, .context, .score-panel { grid-template-columns: 1fr; }
  .detail-hero { flex-direction: column; }
  .total-badge { text-align: left; }
  .board-tools { flex-wrap: wrap; }
}
