/* Tableau de bord progression — même univers visuel que la page révision */

:root {
  --bg: #000000;
  --card: #1e1e1e;
  --card2: #2a2a2a;
  --text: #eceff1;
  --muted: #8e9399;
  --accent: #8ab4f8;
  --accent-soft: rgba(138, 180, 248, 0.22);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
  --radius: 16px;
  --font: Roboto, system-ui, "Segoe UI", sans-serif;
  --ok: #bbf7d0;
  --ok-bg: rgba(22, 90, 45, 0.45);
  --ko: #fecaca;
  --ko-bg: rgba(120, 24, 24, 0.5);
  --donut-ok: rgba(74, 222, 128, 0.92);
  --donut-ko: rgba(248, 113, 113, 0.88);
  --donut-ring: rgba(255, 255, 255, 0.06);
}

body.theme-violet {
  --bg: #100818;
  --card: #26143d;
  --card2: #321c4f;
  --text: #faf5ff;
  --muted: #d8c8f5;
  --accent: #c084fc;
  --accent-soft: rgba(192, 132, 252, 0.42);
  --border: rgba(167, 139, 250, 0.42);
  --shadow: 0 14px 44px rgba(50, 15, 90, 0.55);
  --ok-bg: rgba(74, 222, 128, 0.15);
  --ko-bg: rgba(248, 113, 113, 0.15);
  --donut-ok: rgba(167, 243, 208, 0.95);
  --donut-ko: rgba(252, 165, 165, 0.9);
  --donut-ring: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(138, 180, 248, 0.12), transparent 45%),
    var(--bg);
  color: var(--text);
  padding: max(0.35rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px))
    calc(2.5rem + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
}

body.theme-violet {
  background:
    radial-gradient(ellipse 100% 85% at 50% -10%, rgba(192, 132, 252, 0.45), transparent 50%),
    radial-gradient(ellipse 85% 70% at 100% 25%, rgba(147, 51, 234, 0.3), transparent 48%),
    linear-gradient(165deg, #0c0518 0%, #150a22 45%, #1f0f32 100%);
}

.dash-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0 1rem;
  max-width: 72rem;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dash-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.dash-nav a,
.dash-nav button {
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.dash-nav a:hover,
.dash-nav button:hover {
  filter: brightness(1.08);
}

.dash-nav .dash-nav-primary {
  background: var(--accent);
  color: #0a0a0a;
  border-color: transparent;
  font-weight: 600;
}

body.theme-violet .dash-nav .dash-nav-primary {
  color: #fff;
}

.dash-nav .dash-nav-ghost {
  background: transparent;
  color: var(--muted);
}

.dash-nav .dash-nav-ghost:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.dash-nav .dash-nav-danger {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
  background: rgba(100, 20, 28, 0.35);
}

main.dash-main {
  max-width: 72rem;
  margin: 0 auto;
  padding-top: 0.75rem;
}

.dash-meta {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dash-intro {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

.dash-insight {
  margin: 0 0 1.1rem;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
}

.dash-insight-pos {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(22, 90, 45, 0.25);
}

.dash-insight-label {
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.dash-hero {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 1.25rem 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1.1rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (max-width: 640px) {
  .dash-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .dash-hero-kpis {
    width: 100%;
  }

  .dash-hero-caption {
    text-align: center;
  }
}

.dash-hero-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.dash-hero-caption {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 14rem;
  text-align: center;
  line-height: 1.4;
}

.dash-donut-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  flex-shrink: 0;
}

.dash-donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--donut-ok) calc(var(--pct, 0) * 1%), var(--donut-ko) 0);
  box-shadow: inset 0 0 0 1px var(--donut-ring);
}

.dash-donut-empty .dash-donut {
  background: conic-gradient(from -90deg, var(--donut-ring) 0 100%, var(--donut-ring) 0);
}

.dash-donut-center {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: var(--card2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.dash-donut-num {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.dash-donut-lbl {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

.dash-hero-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

@media (min-width: 480px) {
  .dash-hero-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.dash-kpi {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}

.dash-kpi-accent {
  border-color: rgba(138, 180, 248, 0.35);
  box-shadow: 0 0 0 1px rgba(138, 180, 248, 0.08);
}

body.theme-violet .dash-kpi-accent {
  border-color: rgba(192, 132, 252, 0.45);
}

.dash-kpi-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}

.dash-kpi-value {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dash-kpi-sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.dash-split {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 960px) {
  .dash-split {
    grid-template-columns: 1.15fr 1fr;
    align-items: start;
  }
}

.dash-section {
  margin-bottom: 0;
}

.dash-section-head {
  margin-bottom: 0.55rem;
}

.dash-section-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
}

.dash-section-sub {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.dash-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.dash-panel-muted {
  background: var(--card2);
}

.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.dash-filter-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dash-filter-input {
  flex: 1;
  min-width: 8rem;
  max-width: 20rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
}

.dash-filter-input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.dash-filter-input:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

.dash-table-wrap {
  overflow-x: auto;
  max-height: min(70vh, 32rem);
}

.dash-caption {
  caption-side: top;
  text-align: left;
  padding: 0.5rem 0.75rem 0.35rem;
  font-size: 0.7rem;
  color: var(--muted);
}

table.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.dash-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card);
  box-shadow: 0 1px 0 var(--border);
}

.dash-table th,
.dash-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.dash-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.dash-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-table tbody tr:last-child td {
  border-bottom: 1px solid var(--border);
}

.dash-table tfoot th,
.dash-table tfoot td {
  background: rgba(138, 180, 248, 0.06);
  font-weight: 600;
  border-bottom: none;
  border-top: 1px solid var(--border);
}

body.theme-violet .dash-table tfoot th,
body.theme-violet .dash-table tfoot td {
  background: rgba(192, 132, 252, 0.1);
}

.dash-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dash-ch-title {
  display: block;
  font-weight: 500;
}

.dash-ch-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.dash-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 6rem;
}

.dash-bar-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
}

.dash-bar-ok {
  height: 100%;
  background: rgba(74, 222, 128, 0.78);
  min-width: 0;
}

.dash-bar-ko {
  height: 100%;
  background: rgba(248, 113, 113, 0.78);
  min-width: 0;
}

.dash-diff {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-diff li {
  display: flex;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.45;
}

.dash-diff li:last-child {
  border-bottom: none;
}

.dash-diff-rank {
  flex-shrink: 0;
  width: 2rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}

.dash-diff-body {
  flex: 1;
  min-width: 0;
}

.dash-diff-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.dash-mini-track {
  margin-top: 0.45rem;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.dash-mini-ko {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.85);
  min-width: 2px;
}

.dash-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.dash-pill-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.dash-pill-ko {
  background: var(--ko-bg);
  color: var(--ko);
}

.dash-never {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.dash-never li {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}

.dash-never li:last-child {
  border-bottom: none;
}

.dash-never-more {
  color: var(--muted) !important;
  font-style: italic;
}

.dash-empty {
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.dash-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ——— Tablette & mobile ——— */
@media (min-width: 721px) and (max-width: 1024px) {
  .dash-main {
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
  }

  .dash-hero {
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .dash-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .dash-brand {
    font-size: 0.84rem;
    text-align: center;
    justify-content: center;
  }

  .dash-nav {
    justify-content: center;
    width: 100%;
  }

  .dash-nav a,
  .dash-nav button {
    min-height: 44px;
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
  }

  .dash-meta {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .dash-table-wrap {
    max-height: min(55vh, 24rem);
  }

  .dash-table th,
  .dash-table td {
    padding: 0.45rem 0.5rem;
    font-size: 0.78rem;
  }

  .dash-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .dash-filter-input {
    max-width: none;
  }
}

@media (max-width: 480px) {
  body {
    padding-left: max(0.65rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.65rem, env(safe-area-inset-right, 0px));
  }

  .dash-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }

  .dash-nav .dash-nav-primary {
    grid-column: 1 / -1;
  }

  .dash-hero {
    padding: 0.85rem 0.75rem;
  }

  .dash-donut-wrap {
    width: 118px;
    height: 118px;
  }

  .dash-donut-center {
    inset: 14px;
  }

  .dash-donut-num {
    font-size: 1.2rem;
  }
}

.dash-nav a,
.dash-nav button {
  touch-action: manipulation;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
