/* ===== Daily Crypto Giveaways — tableau de bord public (Reborn 2026) =====
   Squelette (barre latérale, coquille responsive, cartes KPI, tableaux, menu de langue) repris du dashboard
   de reference ; palette et visuels DCG (wallet 1.0.8, site 2020).
   CSP : style-src 'self' -> aucun style inline dans index.html, tout est ici. */

/* ---------- Palette ---------- */
:root {
  --dcg-blue-900: #0a3a78;
  --dcg-blue-800: #0b4486;
  --dcg-teal: #356877;
  --dcg-sky-1: #6a93c9;
  --dcg-sky-2: #708cc9;
  --dcg-red: #e63b2e;
  --dcg-orange: #f7931e;
  --dcg-yellow: #ffd23f;

  --bg: #eef4fb;
  --fg: #0c1a33;
  --muted: #5b6b85;
  --card: #ffffff;
  --card-soft: #f5f9fe;
  --border: #dbe5f1;
  --accent: #0b4486;
  --num: #2a6475;
  --link: #0b4486;
  --ok: #147a47;
  --warn: #9b6500;
  --bad: #b42318;
  --shadow-sm: 0 2px 8px rgba(10, 30, 70, .08);
  --shadow-md: 0 6px 18px rgba(10, 30, 70, .12);

  --topbar-h: 66px;
  --sidebar-width: 254px;
  --sidebar-collapsed-width: 72px;
  --sidebar-fg: #e9eefb;
  --sidebar-muted: #a9bad8;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
body.theme-dark {
  --bg: #07142a;
  --fg: #e6eefb;
  --muted: #94a7c6;
  --card: #0e2142;
  --card-soft: #12294f;
  --border: #1f3762;
  --accent: #8fb3e6;
  --num: #8fd0de;
  --link: #9cc0f0;
  --ok: #4ad295;
  --warn: #f5b942;
  --bad: #ff7b6e;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; font-family: var(--font-ui); line-height: 1.45;
  background: var(--bg); color: var(--fg); min-width: 0;
  animation: fadeIn .3s ease both;
}
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
pre.code { margin: 8px 0 0; padding: 10px 12px; overflow-x: auto; border-radius: 8px; background: #0b1a33; color: #e6eefb; font-family: var(--font-mono); font-size: 13px; }
.muted { color: var(--muted); }
.hidden-initial { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
:focus-visible { outline: 2px solid var(--dcg-orange); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ---------- Barre du haut (bleu du wallet 1.0.8) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1rem;
  padding: 0 16px;
  background: linear-gradient(90deg, var(--dcg-blue-900), var(--dcg-blue-800));
  color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
  border-bottom: 3px solid var(--dcg-orange);
}
.brand { display: flex; align-items: center; min-width: 0; text-decoration: none; }
.brand-logo { display: block; height: 48px; width: auto; max-width: 100%; }
.topbar-tagline { margin: 0; color: #dbe7fb; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 36px; height: 34px; padding: 0 8px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .1); color: #fff; font: inherit; font-size: 15px;
}
.icon-button:hover { background: rgba(255, 255, 255, .2); }

/* Menu de langue (repris) */
.lang-dropdown { position: relative; }
.lang-dropdown-chevron { font-size: 10px; }
.lang-flag-icon svg { display: block; width: 20px; height: 14px; border-radius: 2px; }
.lang-dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; list-style: none; margin: 0; padding: 4px;
  min-width: 160px; background: var(--card); color: var(--fg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-md);
}
.lang-dropdown-menu li { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
.lang-dropdown-menu li:hover { background: var(--card-soft); }
.lang-dropdown-menu li.active { background: rgba(247, 147, 30, .16); }

/* ---------- Coquille : barre laterale + colonne (repris, couleurs DCG) ---------- */
.dashboard-shell { min-height: calc(100vh - var(--topbar-h)); display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.dashboard-sidebar {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 14px 10px; z-index: 30;
  background: linear-gradient(180deg, #000000 0%, #004488 100%); color: var(--sidebar-fg);
}
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 8px 10px; color: var(--sidebar-muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-collapse, .mobile-menu-button { border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: inherit; border-radius: 9px; cursor: pointer; }
.sidebar-collapse { width: 32px; height: 32px; font-size: 22px; line-height: 1; }
.sidebar-nav { display: grid; gap: 4px; }
.nav-item { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; min-height: 44px; padding: 4px 9px; border-radius: 10px; color: var(--sidebar-muted); text-decoration: none; font-weight: 700; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(106, 147, 201, .35), rgba(247, 147, 30, .18)); box-shadow: inset 3px 0 0 var(--dcg-orange); }
.nav-icon { display: grid; place-items: center; width: 28px; height: 28px; font-size: 19px; }
.sidebar-status { display: flex; align-items: center; gap: 10px; margin: 18px 8px 0; padding: 12px 8px; border-top: 1px solid rgba(255, 255, 255, .14); color: var(--sidebar-muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa7bd; flex: 0 0 auto; }
.status-dot.ok { background: #18a66a; box-shadow: 0 0 0 4px rgba(24, 166, 106, .18); }
.status-dot.stale { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, .18); }
.status-dot.down { background: #dc2626; box-shadow: 0 0 0 4px rgba(220, 38, 38, .18); }
.sidebar-avatar { display: block; width: 96px; height: 96px; margin: 18px auto 0; opacity: .9; }
.dashboard-column { min-width: 0; display: flex; flex-direction: column; }
.dashboard-column main { width: 100%; max-width: 1480px; margin: 0 auto; padding: 20px 24px; flex: 1; }
.mobile-toolbar, .sidebar-backdrop { display: none; }
body.sidebar-collapsed .dashboard-shell { grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr); }
body.sidebar-collapsed .sidebar-title, body.sidebar-collapsed .nav-label, body.sidebar-collapsed .sidebar-avatar { display: none; }
body.sidebar-collapsed .sidebar-heading { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .sidebar-collapse { transform: rotate(180deg); }
body.sidebar-collapsed .nav-item { grid-template-columns: 1fr; padding-left: 8px; padding-right: 8px; }
body.sidebar-collapsed .nav-icon { margin: auto; }
body.sidebar-collapsed .sidebar-status { justify-content: center; padding-left: 0; padding-right: 0; }

/* ---------- Sections, cartes, KPI ---------- */
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: 0 0 14px; }
.section-heading h2 { margin: 0; font-size: clamp(1.3rem, 2.2vw, 1.8rem); }
.section-kicker { margin: 0 0 2px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 800; }
h3 { margin: 0 0 10px; font-size: 1.05rem; }
.card { position: relative; background: var(--card); padding: 16px; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.card + .card, .stack > * + * { margin-top: 14px; }
.card .label { color: var(--muted); font-size: 12px; font-weight: 600; }
.card .value { margin-top: 6px; font-size: 20px; font-weight: 700; color: var(--fg); }
.card .sub { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid .card { display: flex; flex-direction: column; gap: 2px; }
.kpi-grid .value .fig { color: var(--num); }
.na { color: var(--muted) !important; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-2 > .card + .card { margin-top: 0; }
.mt-16 { margin-top: 16px; }
.lead { font-size: 15px; max-width: 70ch; }
ul.bullets { margin: 8px 0 0; padding-left: 1.2rem; }
ul.bullets li + li { margin-top: 4px; }
ol.steps { margin: 8px 0 0; padding-left: 1.4rem; }
ol.steps li + li { margin-top: 6px; }
.note { padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--card-soft); font-size: 13px; }
.note.warn { border-color: rgba(245, 158, 11, .5); background: rgba(245, 158, 11, .1); }
.note.danger { border-color: rgba(220, 38, 38, .45); background: rgba(220, 38, 38, .08); }
.pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--card-soft); border: 1px solid var(--border); white-space: nowrap; }
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; background: var(--dcg-blue-800); color: #fff; font: inherit; font-weight: 700; text-decoration: none;
}
.btn:hover { background: var(--dcg-blue-900); }
.btn.alt { background: var(--dcg-orange); color: #1d1200; }
.btn.alt:hover { background: #ffa53d; }
.btn.ghost { background: transparent; color: var(--link); border-color: var(--border); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Fraicheur des donnees */
.fresh { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.fresh::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #18a66a; }
.fresh.fresh-stale { color: var(--warn); }
.fresh.fresh-stale::before { background: #f59e0b; }

/* Barres de progression (SVG, largeur par attribut : pas de style inline) */
.bar { display: block; width: 100%; height: 8px; margin-top: 8px; }
.bar-bg { fill: var(--border); }
.bar-fg { fill: var(--dcg-orange); }
.bar-fg.blue { fill: var(--dcg-sky-1); }

/* ---------- Tableaux (repris) ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); background: var(--card); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
thead th { text-align: left; color: var(--muted); font-weight: 700; font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, rgba(106, 147, 201, .16), transparent); white-space: nowrap; }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(106, 147, 201, .08); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.num { color: var(--num); font-weight: 600; }
td.pos { color: var(--ok); }
td.nowrap { white-space: nowrap; }
td.neg { color: var(--bad); }
.hash { font-family: var(--font-mono); font-size: 13px; word-break: break-all; }
.kv { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 0; margin: 0; }
.kv dt, .kv dd { margin: 0; padding: 8px 0; border-top: 1px solid var(--border); }
.kv dt { color: var(--muted); font-size: 13px; font-weight: 600; }
.kv dd { font-size: 14px; word-break: break-all; }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* ---------- Recherche ---------- */
.search-form { display: flex; gap: 8px; flex-wrap: wrap; }
.search-input { flex: 1 1 320px; min-width: 0; padding: 10px 12px; font: inherit; font-size: 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--card); color: var(--fg); }
.search-msg { margin: 8px 0 0; font-size: 13px; }

/* ---------- Accueil : ciel du site 2020 ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: center;
  margin-bottom: 16px; padding: 22px 24px; border-radius: 16px; overflow: hidden; color: #10243f;
  background:
    radial-gradient(ellipse 30% 22% at 12% 88%, rgba(255, 255, 255, .85), transparent 70%),
    radial-gradient(ellipse 26% 18% at 88% 12%, rgba(255, 255, 255, .7), transparent 70%),
    linear-gradient(180deg, #8ed3e6 0%, #b8e3f1 60%, #dff3fa 100%);
  border: 1px solid rgba(10, 58, 120, .15);
}
body.theme-dark .hero { color: #10243f; }
.hero h2 { margin: 0 0 8px; font-size: clamp(1.4rem, 3vw, 2.1rem); color: var(--dcg-red); text-shadow: 0 2px 0 #fff3c4; }
.hero p { margin: 0 0 8px; max-width: 62ch; font-weight: 500; }
.hero ul { margin: 6px 0 0; padding-left: 1.2rem; font-weight: 600; }
.hero-img { display: block; width: 100%; max-width: 420px; height: auto; margin-left: auto; border-radius: 12px; }
.hero .btn.ghost { color: var(--dcg-blue-900); border-color: rgba(10, 58, 120, .35); background: rgba(255, 255, 255, .55); }

/* ---------- Graphique d'emission ---------- */
.chart { display: block; width: 100%; height: auto; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-axis { fill: var(--muted); font-size: 11px; }
.ch-cap { stroke: var(--dcg-red); stroke-width: 1.5; stroke-dasharray: 6 4; fill: none; }
.ch-supply { stroke: var(--dcg-blue-800); stroke-width: 2.5; fill: none; }
body.theme-dark .ch-supply { stroke: var(--dcg-sky-1); }
.ch-area { fill: rgba(106, 147, 201, .18); stroke: none; }
.ch-bar { fill: rgba(247, 147, 30, .55); }
.ch-now { stroke: var(--dcg-orange); stroke-width: 2; }
.ch-now-dot { fill: var(--dcg-orange); }
.ch-label { fill: var(--fg); font-size: 11px; font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 4px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.legend .lg-supply::before { background: var(--dcg-sky-1); }
.legend .lg-cap::before { background: var(--dcg-red); }
.legend .lg-bar::before { background: var(--dcg-orange); height: 10px; }

/* ---------- Telechargement ---------- */
.dl-card .value { font-size: 18px; }
.dl-os { font-size: 30px; }

/* ---------- Roadmap (esprit du visuel 2020) ---------- */
.roadmap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.roadmap-img { display: block; width: 100%; height: auto; border-radius: 12px; }
.roadmap-col { padding: 18px; border-radius: 16px; background: linear-gradient(180deg, #8ed3e6, #dff3fa); color: #10243f; }
.roadmap-pill { display: inline-block; margin: 8px 0 10px; padding: 4px 16px; border-radius: 999px; font-weight: 900; font-size: 18px; color: #fff; background: var(--dcg-orange); }
.roadmap-pill.next { background: var(--dcg-teal); }
.roadmap-list { list-style: none; margin: 0; padding: 0; }
.roadmap-list li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-weight: 700; font-size: 15px; }
.roadmap-list li::before { content: ""; flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--dcg-orange); background: transparent; }
.roadmap-list li.done::before { background: var(--dcg-orange); }
.roadmap-list.next li::before { border-color: var(--dcg-teal); }
.roadmap-list li.done::after { content: "\2713"; color: var(--dcg-orange); font-weight: 900; }

/* ---------- Pied de page ---------- */
.dashboard-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .5rem; min-height: 60px; padding: 14px 24px; color: var(--muted); border-top: 1px solid var(--border); background: var(--card); font-size: 12px; text-align: center; }
.footer-sep { color: var(--dcg-orange); font-weight: 900; }

/* ---------- Responsive (repris) ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-tagline { display: none; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; }
}
@media (max-width: 900px) {
  .topbar { position: relative; }
  .dashboard-shell { display: block; }
  .dashboard-sidebar { position: fixed; top: 0; left: 0; height: 100dvh; width: min(86vw, 300px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 12px 0 30px rgba(5, 10, 24, .32); z-index: 50; }
  body.sidebar-mobile-open .dashboard-sidebar { transform: translateX(0); }
  .sidebar-collapse { display: none; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 45; width: 100%; height: 100%; border: 0; background: rgba(5, 10, 24, .5); }
  body.sidebar-mobile-open .sidebar-backdrop { display: block; }
  .mobile-toolbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 52px; padding: 6px 14px; background: var(--card); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
  .mobile-menu-button { width: 40px; height: 40px; color: var(--fg); background: var(--card); border-color: var(--border); font-size: 20px; }
  body.sidebar-collapsed .sidebar-title, body.sidebar-collapsed .nav-label, body.sidebar-collapsed .sidebar-avatar { display: initial; }
  body.sidebar-collapsed .nav-item { grid-template-columns: 36px minmax(0, 1fr); }
  .dashboard-column main { padding: 16px; }
  .hero, .roadmap, .grid-2 { grid-template-columns: 1fr; }
  .hero-img { margin: 0 auto; max-width: 320px; }
}
@media (max-width: 640px) {
  .kpi-grid, .kpi-grid.cols-3 { grid-template-columns: 1fr; }
  .brand-logo { height: 36px; }
  .topbar { padding: 0 10px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { padding-bottom: 0; }
  .kv dd { border-top: 0; padding-top: 2px; }
  .card { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
