/* =========================================================
   THEME & TOKENS
   ========================================================= */
:root {
  --blue: #1976d2; /* Préd */
  --orange: #fb8c00; /* LDC  */
  --green: #2e7d32; /* OK   */
  --red: #c62828; /* Retard */
  --bg: #0f1216;
  --card: #171b22;
  --text: #e8eef6;
  --muted: #9fb0c3;
  --border: #263040;
  --total: #c6d8ff;
  --purple: #7b1fa2; /* Tag */
  --teal: #00695c; /* libre */

  /* toggles */
  --thumb-bg-dark: #0e1117;
  --thumb-bg-light: #ffffff;
}
:root[data-theme="light"],
html[data-theme="light"] {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #0b1320;
  --muted: #5c6b7b;
  --border: #d7dee8;
  --total: #304a6b;
  --purple: #4a148c;
  --teal: #00332a;
}
html[data-theme="dark"] {
  --thumb-bg: var(--thumb-bg-dark);
}
html[data-theme="light"] {
  --thumb-bg: var(--thumb-bg-light);
}

/* =========================================================
   BASE
   ========================================================= */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
.small {
  font-size: 0.85rem;
}
.muted {
  color: var(--muted);
}

main {
  padding: 16px;
  max-width: 980px;
  margin: 0 auto;
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}
h2,
h3 {
  margin: 6px 0 10px;
}

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg) 0%, #0000 100%);
  backdrop-filter: saturate(120%) blur(6px);
  border-top: none;

  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;

  padding: 8px 14px; /* ← remet le padding */
  overflow: hidden;
}

.topbar * {
  min-width: 0;
}

.topbar h1 {
  margin-top: 25px;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1; /* prend toute la largeur dispo */
}

.topbar .brand {
  display: flex;
  align-items: flex-start; /* au lieu de center */
  gap: 10px;
}

.topbar .logo {
  height: 40px;
  width: auto;
  margin-top: 2px; /* ajuste finement */
}

.settings-section {
  display: flex;
  flex-direction: row; /* empile les boutons */
  justify-content: center;
  align-items: center; /* centre horizontalement */
  gap: 14px; /* espace entre les boutons */
  margin: 10px 0; /* marge haut/bas */
}

/* =========================================================
   LAYOUTS
   ========================================================= */
.row {
  display: grid;
  gap: 12px;
}
.cols-4,
.cols-3,
.cols-2 {
  grid-template-columns: 1fr;
}
.align-end {
  display: flex;
  align-items: end;
}

@media (min-width: 820px) {
  .cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}
.grid-2,
.grid-3 {
  display: grid;
  gap: 10px;
}
@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =========================================================
   CARDS
   ========================================================= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* =========================================================
   PAGES (transition unique, pas de doublons)
   ========================================================= */
.page {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.page.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}
/* classes d’animation utilisées par JS */
.page.anim-in {
  animation: fadeInUp 0.15s ease both;
}
.page.anim-out {
  animation: fadeOutDown 0.18s ease both;
}
@media (prefers-reduced-motion: reduce) {
  .page.anim-in,
  .page.anim-out {
    animation: none !important;
  }
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* =========================================================
   FORM ELEMENTS & BUTTONS
   ========================================================= */
input,
select,
button {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 87%, black 0%);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus,
select:focus {
  border-color: color-mix(in srgb, var(--border), #3a475b 40%);
  box-shadow: 0 0 0 3px color-mix(in srgb, #3a475b 25%, transparent);
}
button:focus-visible {
  outline: 2px solid #3a475b;
  outline-offset: 2px;
}

/* Solid buttons */

.button,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger {
  --ring: 0 0 0 0 rgba(25, 118, 210, 0);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-weight: 700;
  cursor: pointer;
  outline: 0;
  transition: transform 0.05s ease, filter 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--ring);
}
.button:active,
.btn-primary:active,
.btn-secondary:active,
.btn-success:active,
.btn-danger:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, #1d8ce0, #1565c0);
  color: #fff;
  border: 0;
}
.btn-secondary {
  background: linear-gradient(180deg, #6d7b8f, #49576b);
  color: #fff;
  border: 0;
}
.btn-success {
  background: linear-gradient(180deg, #4caf50, #2e7d32);
  color: #fff;
  border: 0;
}
.btn-danger {
  background: linear-gradient(180deg, #e24d4d, #c62828);
  color: #fff;
  border: 0;
}

.button:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-success:focus-visible,
.btn-danger:focus-visible {
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.35);
}

/* Disabled */
button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.15);
}

.btn-primary:hover {
  filter: brightness(1.1);
}
.btn-secondary:hover {
  filter: brightness(1.08);
}
.btn-success:hover {
  filter: brightness(1.1);
}
.btn-danger:hover {
  filter: brightness(1.1);
}

/* Chips */
.quicks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-chip {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 12px;
}

/* =========================================================
   KPI / TAGS / BADGES
   ========================================================= */
.kpi {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.kpi .label {
  color: var(--muted);
  font-size: 0.85rem;
}
.kpi .value {
  font-weight: 700;
}
.kpi .sub {
  font-size: 0.9rem;
  color: var(--muted);
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.tag.ok {
  color: var(--green);
  border-color: #1f4e28;
}
.tag.bad {
  color: var(--red);
  border-color: #692020;
}

.alert-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.tag-retard {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #c62828ab;
  color: #fff;
  font-weight: 600;
}
.tag-warning {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fb8a00ab;
  color: #ffffff;
  font-weight: 700;
}
.tag-ok {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #2e7d32;
  color: #fff;
  font-weight: 600;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: inline-block;
  margin: 2px;
}
.pill-blue {
  color: var(--blue);
  border-color: #1b4d86;
}
.pill-orange {
  color: var(--orange);
  border-color: #7c4a00;
}
.pill-total {
  color: var(--total);
  border-color: #3a475b;
}
.split {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* ===== Badges ===== */
.badges {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-top: 8px;
}
.badge {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--bg) 90%, black 0%);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.badge .ico {
  font-size: 1.2rem;
  line-height: 1;
  width: 1.6rem;
  text-align: center;
}
.badge .meta {
  flex: 1;
}
.badge .title {
  font-weight: 700;
  font-size: 0.95rem;
}
.badge .desc {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}
.badge.earned {
  border-color: #3a475b;
  box-shadow: 0 0 0 1px #3a475b inset;
}
.badge .pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-top: 6px;
}
.badge.next {
  opacity: 0.8;
}
.badge.next .pill {
  border-style: dashed;
}
.badge .date {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 12px 0 6px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 6px;
  opacity: 0.5;
}
.counter-pill {
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, black 0%);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

/* Style KPI avec double halo décoratif */
.kpi {
  position: relative; /* nécessaire pour les ::after et ::before */
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.05),
    rgba(0, 0, 0, 0.15)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

/* Cercle bas/droite */
.kpi::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -22px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 10px solid rgba(255, 255, 255, 0.08);
}

/* Cercle haut/gauche */
.kpi::before {
  content: "";
  position: absolute;
  left: -15px;
  top: -15px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.05);
}

/*==========================================================
  GAUGE
===========================================================*/
.gauge-wrap {
  margin-top: 8px;
}
.gauge-bar {
  height: 12px;
  background: color-mix(in srgb, var(--bg) 85%, black 0%);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.gauge-fill {
  height: 100%;
  width: 0%;
  transition: width 0.4s ease;
  background: linear-gradient(90deg, #1d8ce0, #fb8c00);
}
.gauge-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

/* =========================================================
   LISTS
   ========================================================= */
.list {
  display: grid;
  gap: 8px;
}
.list.condensed .item {
  padding: 8px;
}
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.item .left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot.pred {
  background: var(--blue);
}
.dot.ldc {
  background: var(--orange);
}
.item .hours {
  font-weight: 700;
}
.item .date,
.item .note {
  color: var(--muted);
  font-size: 0.9rem;
}
.item .actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Edition inline */
.inline-edit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.inline-edit input,
.inline-edit select {
  margin: 0;
}
.edit-controls {
  display: flex;
  gap: 4px;
}
.edit-controls button {
  width: auto;
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Tags visuels pour une entrée */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0;
}
.tag-item {
  padding: 2px 6px;
  border-radius: 12px;
  background: var(--purple);
  color: #fff;
  font-size: 0.75rem;
}
.tag-input {
  margin-top: 4px;
}

/* =========================================================
   TABLE
   ========================================================= */
.table {
  width: 100%;
  overflow: auto;
}
.table table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  border: 1px solid var(--border);
  padding: 8px;
  text-align: center;
}
.table th {
  background: color-mix(in srgb, var(--bg) 85%, black 0%);
  color: var(--muted);
  font-weight: 600;
}

/* =========================================================
   CALENDAR + HEATMAP
   ========================================================= */
.calendar {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--bg) 85%, black 0%);
  border-bottom: 1px solid var(--border);
}
.cal-nav {
  display: flex;
  gap: 8px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 44px;
  padding: 6px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
}
.cal-cell:hover {
  background: color-mix(in srgb, var(--bg) 80%, black 0%);
}
.cal-cell.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.cal-cell.selected {
  outline: 2px solid #3a475b;
  background: color-mix(in srgb, var(--bg) 80%, black 0%);
}
.cal-weekday {
  background: color-mix(in srgb, var(--bg) 85%, black 0%);
  color: var(--muted);
  font-weight: 600;
}

/* Heatmap dots */
.heatmap-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.heat-0 {
  background: transparent;
}
.heat-1 {
  background: #1e3a5f;
}
.heat-2 {
  background: #2c5aa0;
}
.heat-3 {
  background: #3a7bd5;
}
.heat-4 {
  background: #4e9df5;
}
.heat-max {
  background: #63b8ff;
}

/* Pastille bleue pour les jours avec des heures (calendrier de saisie) */
.cal-dot {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 1px var(--border) inset;
  pointer-events: none;
}

/* =========================================================
   GOALS GRID
   ========================================================= */
.goal-grid {
  display: grid;
  gap: 8px;
}
@media (min-width: 680px) {
  .goal-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.goal-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}

/* =========================================================
   STREAKS
   ========================================================= */
.streak-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.streak-item {
  text-align: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 90%, black 0%);
}
.streak-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green);
}
.streak-label {
  font-size: 0.85rem;
  color: var(--muted);
}

/* =========================================================
   PREVISION (banner)
   ========================================================= */
.prediction {
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5aa044 100%);
  color: #fff;
  padding: 15px;
  border-radius: 12px;
  margin: 10px 0;
}
.prediction-title {
  font-weight: 700;
  margin-bottom: 8px;
}
.prediction-text {
  font-size: 0.95rem;
}

/* =========================================================
   CHARTS
   ========================================================= */
.chart-wrap {
  position: relative;
  height: 260px;
}
@media (min-width: 720px) {
  .chart-wrap {
    height: 320px;
  }
}
canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}
.hr {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* =========================================================
   TABBAR (fixe, consolidée)
   ========================================================= */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  gap: 6px;
  justify-content: space-around;
  padding: 8px calc(8px + env(safe-area-inset-right, 0px))
    calc(8px + env(safe-area-inset-bottom, 0px))
    calc(8px + env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, var(--bg) 0%, #0000 100%);
  backdrop-filter: saturate(120%) blur(6px);
  border-top: none;
}
.tab {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--bg) 87%, black 0%);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  transition: color 0.25s ease, transform 0.2s ease, border-color 0.25s ease;
}
.tab span {
  display: inline-block;
  line-height: 1.2;
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  color: var(--text);
  transform: scale(1.06);
  border-color: #3a475b;
}
/* Indicateur animé */
.tabbar-indicator {
  position: absolute;
  bottom: 0;
  height: 3px;
  background: var(--blue);
  border-radius: 2px 2px 0 0;
  transition: left 0.3s ease, width 0.3s ease;
}
/* Effet flottant desktop */
@media (min-width: 480px) {
  .tabbar {
    margin: 8px auto;
    width: min(980px, 100%);
    border-radius: 16px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.25);
    background: color-mix(in srgb, var(--bg) 80%, black 0%);
  }
}

/* =========================================================
   TOAST (unique, sans doublon)
   ========================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0));
  transform: translateX(-50%) translateY(20px);
  z-index: 9999;
  background: rgba(20, 24, 30, 0.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: min(92vw, 520px);
  text-align: center;
  font-size: 0.95rem;
  visibility: hidden;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  visibility: visible; /* ← et ceci */
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
/* Bouton du toast : un peu plus d'air */
.toast .toast-action {
  margin: 10px 0 4px 10px; /* top/bottom + left */
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s ease;
}
.toast .toast-action:hover {
  filter: brightness(1.1);
}

/* Barre de progression du toast */
.toast-progress {
  position: relative;
  height: 3px;
  width: 100%;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px; /* espace au-dessus de la barre */
}
.toast-progress-bar {
  position: absolute;
  inset: 0 auto 0 0; /* left:0; top/bottom:0 */
  width: 100%;
  background: linear-gradient(90deg, var(--blue), var(--orange));
  transform-origin: left center;
  animation-name: toastProgress; /* durée injectée en JS */
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes toastProgress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* === Save notice flottant (au-dessus du header) === */
.save-fly {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 94%, transparent 0%);
  color: var(--text);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.2s ease,
    border-color 0.2s ease;
  z-index: 10000; /* au-dessus de la topbar */
  font-weight: 700;
  font-size: 0.9rem;
}
.save-fly.show {
  opacity: 1;
  transform: translateY(0);
}
.save-fly[data-state="saving"] {
  background: color-mix(in srgb, var(--bg) 85%, transparent 0%);
}
.save-fly[data-state="saved"] {
  background: color-mix(in srgb, var(--bg) 75%, transparent 0%);
}
@media (prefers-reduced-motion: reduce) {
  .save-fly {
    transition: none;
  }
}

/* =========================================================
   EXPORT PAGE
   ========================================================= */
.export-section {
  margin: 20px 0;
}
.export-grid {
  display: grid;
  gap: 10px;
}
@media (min-width: 600px) {
  .export-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.export-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
}
.export-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}
.export-title {
  font-weight: 700;
  margin-bottom: 5px;
}
.export-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 15px;
}

/* =========================================================
   COMPARAISONS
   ========================================================= */
.comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 15px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 10px 0;
}
.comparison-item {
  text-align: center;
}
.comparison-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 5px;
}
.comparison-value {
  font-size: 1.2rem;
  font-weight: 700;
}
.comparison-vs {
  color: var(--muted);
  font-weight: 700;
}

/* =========================================================
   QR
   ========================================================= */
.qr-display {
  text-align: center;
  padding: 20px;
}
#qrcode {
  margin: 0 auto;
}

/* =========================================================
   MISC SPACING
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.motivation {
  margin: 20px 0;
}
.ligneAjust {
  margin-top: 10px;
  margin-bottom: 10px;
}
.blocTag {
  margin-bottom: 20px;
}

.helpTag {
  font-size: 13px;
  color: #888888;
}

/* ======= TOGGLE BASE ======= */
.toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.toggle-track {
  position: relative;
  width: 64px;
  height: 34px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, black 0%);
  border: 1px solid var(--border);
  transition: background 0.25s ease, border-color 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px;
  box-sizing: border-box;
}
.toggle-thumb {
  position: absolute;
  top: 50%;
  left: 4px;
  width: 30px;
  height: 30px;
  transform: translate(0, -50%);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: transform 0.25s ease;
}
.toggle-icon {
  font-size: 15px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}
.toggle--icon .moon {
  transform: translateY(0);
}
.toggle--icon .sun {
  transform: translateY(0);
}

/* checked = clair */
.toggle input:checked + .toggle-track {
  background: color-mix(in srgb, var(--card) 90%, white 0%);
  border-color: #3a475b;
}
.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translate(30px, -50%);
}
.toggle input:checked + .toggle-track .moon {
  opacity: 0.15;
  transform: scale(0.9);
}
.toggle input:checked + .toggle-track .sun {
  opacity: 1;
  transform: scale(1.06);
}

/* non checked = sombre */
.toggle input:not(:checked) + .toggle-track .moon {
  opacity: 1;
  transform: scale(1.06);
}
.toggle input:not(:checked) + .toggle-track .sun {
  opacity: 0.15;
  transform: scale(0.9);
}

/* ======= SEGMENTED TOGGLE (Civile / Service) ======= */
.seg-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.seg-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg-wrap {
  position: relative;
  width: 140px;
  height: 36px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, black 0%);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  place-items: center;
  overflow: hidden;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.seg-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  z-index: 2;
  padding: 0 8px;
}
.seg-label.left::before,
.seg-label.right::before {
  content: "";
}

/* Knob qui glisse */
.seg-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 6px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: transform 0.25s ease;
}

/* État: SERVICE (checked) → knob à droite, label Service mis en avant */
.seg-toggle input:checked + .seg-wrap {
  border-color: #3a475b;
  background: color-mix(in srgb, var(--card) 88%, white 0%);
}
.seg-toggle input:checked + .seg-wrap .seg-knob {
  transform: translateX(100%);
}
.seg-toggle input:checked + .seg-wrap .left {
  color: var(--muted);
}
.seg-toggle input:checked + .seg-wrap .right {
  color: var(--text);
}

/* État: CIVILE (unchecked) → knob à gauche, label Civile mis en avant */
.seg-toggle input:not(:checked) + .seg-wrap .left {
  color: var(--text);
}
.seg-toggle input:not(:checked) + .seg-wrap .right {
  color: var(--muted);
}

/* Petite variante pour écrans étroits */
@media (max-width: 420px) {
  .seg-wrap {
    width: 120px;
  }
  .seg-label {
    font-size: 0.85rem;
  }
}

/* ===== Indicateur d’auto-sauvegarde ===== */
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 86%, black 0%);
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.25s ease,
    border-color 0.25s ease;
  pointer-events: none;
}
.save-indicator.show {
  opacity: 1;
  transform: translateY(0);
}
.save-indicator.saving {
  background: color-mix(in srgb, var(--bg) 80%, black 0%);
}
.save-indicator.saved {
  background: color-mix(in srgb, var(--bg) 88%, black 0%);
}

/* petit point animé quand “saving” */
.save-indicator.saving::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 0 rgba(25, 118, 210, 0.6);
  animation: pulseDot 1.2s ease-out infinite;
}
@keyframes pulseDot {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(25, 118, 210, 0.55);
  }
  70% {
    transform: scale(1.15);
    box-shadow: 0 0 0 8px rgba(25, 118, 210, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(25, 118, 210, 0);
  }
}

/* ===== Erreurs champ & toast ===== */
.field-error {
  margin-top: 6px;
  font-size: 0.85rem;
  color: #ffb4b4;
  min-height: 1.1em; /* réserve l’espace même sans message */
}
.input-error {
  border-color: #c62828 !important;
  box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.25);
}
@keyframes shakeX {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(2px);
  }
}
.shake {
  animation: shakeX 0.25s ease;
}

/* Variante “erreur” pour le toast */
.toast.toast-error {
  background: linear-gradient(180deg, #e24d4d, #c62828);
  border-color: #692020;
}
.toast.toast-error .toast-action {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(0, 0, 0, 0.25);
  color: #fff;
}

/* micro anim d’erreur + secousse discrète */
.btn-error-pulse {
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.25) !important;
  filter: saturate(110%) brightness(1.02);
}

@keyframes btn-shake-kf {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px);
  }
  50% {
    transform: translateX(2px);
  }
  75% {
    transform: translateX(-1px);
  }
  100% {
    transform: translateX(0);
  }
}
.btn-shake {
  animation: btn-shake-kf 0.22s ease;
}

/* garde un style correct pendant le lock court */
button:disabled {
  opacity: 0.8;
  cursor: not-allowed;
  filter: grayscale(0.08);
}

/* ===== Splash (overlay) ===== */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.splash-inner {
  text-align: center;
}
.splash-logo {
  width: 108px;
  height: 108px;
  border-radius: 18px;
  display: block;
  margin: 0 auto 12px auto;
}
.splash-title {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.2px;
}
.splash-sub {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.95rem;
}
.splash.hide {
  opacity: 0;
  visibility: hidden;
}

/* === Bouton icône (toggle thème) === */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 87%, black 0%);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease,
    filter 0.2s ease;
}
.btn-icon:hover {
  filter: brightness(1.03);
}
.btn-icon:active {
  transform: translateY(1px) scale(0.98);
}
.btn-icon .ico {
  font-size: 1rem;
  line-height: 1;
}
.btn-icon[aria-pressed="true"] {
  /* état "actif" (thème clair sélectionné) */
  border-color: #3a475b;
}

.muted {
  color: var(--text-muted, #888);
}

.small {
  font-size: 0.85em;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.tag-muted {
  color: var(--muted);
  border-color: var(--border);
  background: color-mix(in srgb, var(--bg) 88%, black 0%);
  font-weight: 600;
}

#statsYearMain,
#statsMonthMain {
  margin-bottom: 10px;
}

/* =========================
  KPI — pastille + halo pulse
  ========================= */
/* Base label */
.kpi .label {
  position: relative;
  display: inline-block;
  padding-left: 18px; /* place pour la pastille à gauche */
  line-height: 1.2;
}

/* Pastille (point) */
.kpi .label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666; /* neutre par défaut */
  z-index: 1;
}

/* Halo animé derrière la pastille */
.kpi .label::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scale(1);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666; /* même couleur que le point */
  opacity: 0.6;
  z-index: 0;
  animation: kpiPulseHalo 2.2s ease-out infinite;
}

/* Couleurs fixes pour les types (Objectif / % / Écart) */
.kpi.goal .label::before,
.kpi.goal .label::after {
  background: #3b82f6;
}

.kpi.pct .label::before,
.kpi.pct .label::after {
  background: #3b82f6;
}

/* =========================
   KPI — "Écart" (couleur dynamique)
   ========================= */

/* défaut : rouge */
.kpi.gap .label::before,
.kpi.gap .label::after {
  background: #ef4444; /* rouge */
}

/* écart en cours (≈ moitié) */
.kpi.gap.mid .label::before,
.kpi.gap.mid .label::after {
  background: #f59e0b; /* orange */
}

/* écart comblé ou objectif atteint */
.kpi.gap.done .label::before,
.kpi.gap.done .label::after {
  background: #22c55e; /* vert */
}

/* =========================
   KPI — "Réalisé" (pastille dynamique)
   ========================= */

/* Pastille par défaut (0%) */
.kpi.real.start .label::before,
.kpi.real.start .label::after {
  background: #6666;
}

/* 1–24% */
.kpi.real.low .label::before,
.kpi.real.low .label::after {
  background: #ef4444;
}

/* 25–49% */
.kpi.real.mid .label::before,
.kpi.real.mid .label::after {
  background: #f97316;
}

/* 50–74% */
.kpi.real.high .label::before,
.kpi.real.high .label::after {
  background: #eab308;
}

/* 75–99%  (⚠️ orthographe uniforme: veryHigh) */
.kpi.real.veryHigh .label::before,
.kpi.real.veryHigh .label::after {
  background: #e5ff00;
}

/* 100% pile */
.kpi.real.exact .label::before,
.kpi.real.exact .label::after {
  background: #15803d;
}

/* >100% */
.kpi.real.over .label::before,
.kpi.real.over .label::after {
  background: #a855f7;
}

/* Halo/pulse de la pastille (sur le ::after) */
.kpi.real .label::after {
  animation: kpiPulseHalo 2.6s ease-out infinite;
  opacity: 0.6;
}

/* Pulse doux du halo */
@keyframes kpiPulseHalo {
  0% {
    transform: translateY(-50%) scale(1);
    opacity: 0.6;
  }
  70% {
    transform: translateY(-50%) scale(2.2);
    opacity: 0;
  }
  100% {
    transform: translateY(-50%) scale(2.2);
    opacity: 0;
  }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
  .kpi .label::after {
    animation: none !important;
  }
}

/* =========================
   KPI — "Réalisé" (glow de carte)
   ========================= */

.kpi.real {
  position: relative;
}

/* Définition de la couleur du glow par état */
.kpi.real.start {
  --real-glow: #666;
} /* défaut gris */
.kpi.real.low {
  --real-glow: rgba(255, 0, 0, 0.275);
} /* rouge */
.kpi.real.mid {
  --real-glow: rgba(245, 159, 11, 0.288);
} /* orange */
.kpi.real.high {
  --real-glow: #e5f50b4a;
} /* jaune */
.kpi.real.veryHigh {
  --real-glow: #e5ff0064;
} /* vert (ton choix) */
.kpi.real.exact {
  --real-glow: #15803d;
} /* vert foncé */
.kpi.real.over {
  --real-glow: #6622c54a;
} /* violet */

/* Applique l’animation de glow à la carte quand un état est présent */
.kpi.real.start,
.kpi.real.low,
.kpi.real.mid,
.kpi.real.high,
.kpi.real.veryHigh,
.kpi.real.exact,
.kpi.real.over {
  animation: realGlow 2s ease-out infinite;
  box-shadow: 0 0 0 0 var(--real-glow);
}

@keyframes realGlow {
  0% {
    box-shadow: 0 0 0 0 var(--real-glow);
  }
  70% {
    box-shadow: 0 0 35px 5px rgba(0, 0, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kpi.real.start,
  .kpi.real.low,
  .kpi.real.mid,
  .kpi.real.high,
  .kpi.real.veryHigh,
  .kpi.real.exact,
  .kpi.real.over {
    animation: none !important;
    box-shadow: none !important;
  }
}

/* Cas spécial >100% : fond violet légèrement animé */
.kpi.real.over {
  background: linear-gradient(
    135deg,
    rgba(91, 34, 197, 0.25),
    rgba(179, 16, 185, 0.15)
  );
  border-color: #ff00d062;
  animation: overGlow 2s ease-out infinite;
}
@keyframes overGlow {
  0% {
    box-shadow: 0 0 0 0 #6622c550;
  }
  50% {
    box-shadow: 0 0 25px 6px #9422c549;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(154, 34, 197, 0.373);
  }
}

/* =========================
   Badges (inchangé, juste nettoyé)
   ========================= */
.badge.earned {
  animation: badgePop 0.9s ease-out;
  border-color: #3a475b;
  box-shadow: 0 0 0 1px #3a475b inset, 0 0 18px rgba(59, 131, 246, 0.115);
}
@keyframes badgePop {
  0% {
    transform: scale(0.85);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Les KPI gardent leur clipping */
.kpi {
  overflow: hidden; /* déjà présent dans ton thème : on confirme */
  isolation: isolate; /* utile pour gérer z-index internes */
}

/* Réalisé : NE PAS laisser déborder le contenu */
.kpi.real {
  overflow: hidden; /* <- au lieu de overflow:visible */
}

/* Le badge emoji reste discret en haut-droite, à l'intérieur du bloc */
.kpi.real .emoji-badge {
  position: absolute;
  top: -4px; /* reste très proche du bord */
  right: -2px; /* léger débord interne (encore visible) */
  font-size: 52px; /* ajuste si besoin (48–56px) */
  line-height: 1;
  opacity: 0.16;
  transform: rotate(-8deg);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
  pointer-events: none;
  z-index: 0; /* sous le contenu, au-dessus du fond */
}

/* Assure que ton contenu reste au-dessus de l'emoji */
.kpi.real > * {
  position: relative;
  z-index: 1;
}

/* Mets les halos derrière tout (emoji + contenu) */
.kpi::before,
.kpi::after {
  z-index: -1; /* halos passent sous l’emoji et le contenu */
}

/* Animation pour >100% (inchangée) */
.kpi.real.over .emoji-badge {
  opacity: 0.22;
  animation: emojiFloat 2.6s ease-in-out infinite;
}
@keyframes emojiFloat {
  0% {
    transform: rotate(-8deg) translateY(0);
  }
  50% {
    transform: rotate(-8deg) translateY(-3px);
  }
  100% {
    transform: rotate(-8deg) translateY(0);
  }
}

@media (max-width: 480px) {
  .kpi.real .emoji-badge {
    font-size: 46px;
    top: -3px;
    right: -2px;
  }
}

/* ===== Historique mensuel ===== */
.history-grid {
  display: grid;
  gap: 10px;
}
@media (min-width: 720px) {
  .history-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 980px) {
  .history-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.month-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.04),
    rgba(0, 0, 0, 0.15)
  );
  overflow: hidden;
}

/* halos discrets comme tes KPI */
.month-card::after,
.month-card::before {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  border: 12px solid rgba(255, 255, 255, 0.06);
}
.month-card::after {
  width: 180px;
  height: 180px;
  right: -70px;
  top: -60px;
}
.month-card::before {
  width: 120px;
  height: 120px;
  left: -60px;
  bottom: -50px;
  border-width: 10px;
  opacity: 0.7;
}

/* header */
.month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.month-title {
  font-weight: 700;
}

/* petit tableau compact */
.month-meta {
  display: grid;
  gap: 6px;
}
.month-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 90%, black 0%);
  font-size: 0.95rem;
}
.month-row b {
  font-weight: 700;
}

/* pastille statut à gauche du titre */
.month-title .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

/* emoji badge en haut à droite */
.month-emoji {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 34px;
  opacity: 0.9;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.35));
}
@media (prefers-reduced-motion: reduce) {
  .month-emoji {
    animation: none !important;
  }
}

/* couleurs de statut (selon % atteint) */
.stat-low {
  --stat-color: #ef4444;
}
.stat-mid {
  --stat-color: #f59e0b;
}
.stat-high {
  --stat-color: #22c55e;
}
.stat-exact {
  --stat-color: #15803d;
}
.stat-over {
  --stat-color: #a855f7;
}

.month-card .dot {
  background: var(--stat-color);
}

/* liseré léger selon statut */
.month-card.stat-low {
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.716) inset;
}
.month-card.stat-mid {
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.716) inset;
}
.month-card.stat-high {
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.716) inset;
}
.month-card.stat-exact {
  box-shadow: 0 0 0 1px rgba(21, 128, 61, 0.716) inset;
}
.month-card.stat-over {
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.716) inset;
}

/* Case "Réalisé" par défaut */
.month-card .realized {
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05); /* neutre si rien */
}

/* Si en dessous de l’objectif */
.month-card .realized.under {
  background: linear-gradient(
    135deg,
    rgba(255, 166, 0, 0.25),
    rgba(255, 115, 0, 0.15)
  );
  border: 1px solid rgba(255, 166, 0, 0.3);
}

/* Si objectif atteint pile */
.month-card .realized.equal {
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.25),
    rgba(16, 185, 129, 0.15)
  );
  border: 1px solid rgba(34, 197, 94, 0.743);
}

/* Si objectif dépassé */
.month-card .realized.over {
  background: linear-gradient(
    135deg,
    rgba(91, 34, 197, 0.25),
    rgba(179, 16, 185, 0.15)
  );
  border: 1px solid rgba(179, 16, 185, 0.4);
}

/* chip valeurs (option, pour la cohérence visuelle) */
.month-chip {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, black 0%);
  font-weight: 700;
}

/* === A2HS banner === */
#a2hs-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 84px;
  z-index: 9999;
  background: #171b22;
  color: #e8eef6;
  border: 1px solid #263040;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  padding: 10px;
  animation: a2hsIn 0.25s ease both;
}
.a2hs-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.a2hs-left {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.a2hs-title {
  font-weight: 800;
}
.a2hs-hint {
  color: #9fb0c3;
  font-size: 0.95rem;
}
.a2hs-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.a2hs-btn {
  border: 1px solid #263040;
  background: #1a222f;
  color: #e8eef6;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}
.a2hs-btn.ghost {
  background: transparent;
}
@keyframes a2hsIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (display-mode: standalone) {
  #a2hs-banner {
    display: none !important;
  }
}

/* Backdrop */
.ob-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in oklab, #000 60%, transparent);
  z-index: 9999;
}

/* Sheet */
.ob-sheet {
  width: min(720px, calc(100vw - 24px));
  max-height: min(85dvh, 680px);
  overflow: clip;
  border-radius: 18px;
  background: #0b0e14;
  color: #eef3ff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
}

/* Glow dynamique bordures */
.ob-sheet::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: conic-gradient(
    from var(--ob-angle, 0deg),
    #9f73ff,
    #00e1ff,
    #7eff8b,
    #ff8b6e,
    #9f73ff
  );
  filter: blur(14px);
  opacity: 0.35;
  z-index: -1;
  border-radius: 20px;
  animation: ob-rotate 9s linear infinite;
}
@keyframes ob-rotate {
  to {
    --ob-angle: 360deg;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ob-sheet::before {
    animation: none;
  }
}

/* Header */
.ob-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
}
.ob-header h2 {
  font-size: 1.25rem;
  margin: 0;
}
.ob-close {
  background: transparent;
  border: 0;
  color: #b8c1ff;
  font-size: 18px;
  cursor: pointer;
}

.ob-body {
  padding: 8px 18px 4px 18px;
  overflow: auto;
}
.ob-body .ob-step {
  display: grid;
  gap: 10px;
}
.ob-body h3 {
  margin: 8px 0 0 0;
  font-size: 1.05rem;
}
.ob-body p {
  margin: 0;
  opacity: 0.95;
}
.ob-tip {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0f1320;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Footer */
.ob-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 14px;
}
.ob-actions {
  display: flex;
  gap: 8px;
}
.ob-primary,
.ob-secondary {
  border-radius: 12px;
  padding: 10px 14px;
  border: 0;
  cursor: pointer;
  font-weight: 600;
}
.ob-primary {
  background: #6b8cff;
  color: #0b0e14;
}
.ob-secondary {
  background: #1a2030;
  color: #dfe6ff;
}

/* Progress bar animée */
.ob-progress {
  height: 3px;
  background: linear-gradient(90deg, #9f73ff, #00e1ff, #7eff8b, #ff8b6e);
  background-size: 300% 100%;
  animation: ob-gradient 6s linear infinite;
}
@keyframes ob-gradient {
  0% {
    background-position: 0%;
  }
  100% {
    background-position: 300%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ob-progress {
    animation: none;
  }
}

/* Dots */
.ob-steps-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.ob-steps-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2a3146;
  position: relative;
}
.ob-steps-dots .dot.active {
  background: #6b8cff;
  box-shadow: 0 0 0 6px #6b8cff20;
}
.ob-steps-dots .dot.active::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 1px dashed #6b8cff66;
  animation: ob-pulse 1.7s ease-out infinite;
}
@keyframes ob-pulse {
  0% {
    transform: scale(0.85);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ob-steps-dots .dot.active::after {
    display: none;
  }
}

/* Coachmarks (petites pastilles sur l’UI) — optionnel */
.ob-coach {
  position: absolute;
  z-index: 10000;
  pointer-events: none;
  padding: 8px 10px;
  border-radius: 12px;
  background: #0f1320;
  color: #eaf0ff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* Bouton relance tuto */
.ob-replay {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 50;
  border: 0;
  border-radius: 999px;
  padding: 10px 12px;
  background: #101728;
  color: #dfe6ff;
  opacity: 0.8;
}
.ob-replay:hover {
  opacity: 1;
}

/* === Nudge inline (Accueil) === */
.alert-nudge {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 94%, transparent 0%);
  margin: 10px 0 0;
}
.alert-nudge .meta {
  color: var(--muted);
  font-size: 0.95rem;
}
.alert-nudge .actions {
  display: flex;
  gap: 8px;
}
.alert-nudge .btn-mini {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 87%, black 0%);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

/* === Dot rouge onglet Stats avec pulse === */
.tab[data-badge] {
  position: relative;
}

.tab[data-badge]::after {
  content: "";
  position: absolute;
  top: 6px; /* ajuste selon la hauteur de ta tabbar */
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff0000;
  z-index: 2;
}

/* Halo animé derrière */
.tab[data-badge]::before {
  content: "";
  position: absolute;
  top: 6px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff0000;
  opacity: 0.6;
  animation: pulseDot 1.6s ease-out infinite;
  z-index: 1;
}

/* Même keyframes que pour les titres */
@keyframes pulseDot {
  0% {
    transform: scale(1);
    opacity: 0.6;
    box-shadow: 0 0 0 0 rgb(255, 0, 0);
  }
  70% {
    transform: scale(2.2);
    opacity: 0;
    box-shadow: 0 0 0 12px rgba(255, 0, 0, 0);
  }
  100% {
    transform: scale(1);
    opacity: 0;
    box-shadow: none;
  }
}

/* === Dot rouge collé au texte avec effet pulse === */
.badge-dot {
  display: inline-flex; /* réduit le box au texte */
  align-items: center;
  position: relative;
}
.badge-dot::after {
  content: "";
  position: absolute;
  top: 0; /* ajuste verticalement */
  right: -12px; /* ajuste horizontalement */
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff0000;
}

/* Ajout du halo animé */
.badge-dot::before {
  content: "";
  position: absolute;
  top: 0;
  right: -12px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff0000;
  opacity: 0.6;
  animation: pulseDot 1.6s ease-out infinite;
}

/* Keyframes du pulse */
@keyframes pulseDot {
  0% {
    transform: scale(1);
    opacity: 0.6;
    box-shadow: 0 0 0 0 rgb(255, 0, 0);
  }
  70% {
    transform: scale(2.2);
    opacity: 0;
    box-shadow: 0 0 0 12px rgba(255, 0, 0, 0);
  }
  100% {
    transform: scale(1);
    opacity: 0;
    box-shadow: none;
  }
}

/* Bandeau explicatif point rouge */
.stats-hint {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--card) 95%, transparent);
  border: 1px dashed var(--border);
  font-size: 0.95rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-hint .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--red);
  animation: pulseDot 1.6s ease-out infinite;
}

.help-btn {
  margin-left: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, black 0%);
  color: var(--muted);
  cursor: pointer;
  font-weight: bold;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1; /* supprime le décalage vertical */
  padding: 0; /* aucun padding parasite */
}
.help-btn:hover {
  background: var(--card);
  color: var(--text);
}

/* Popover explicatif */
.help-pop {
  position: absolute;
  z-index: 9999;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
  color: var(--text);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  max-width: 260px;
}
.help-pop .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--red);
  margin-right: 4px;
  animation: pulseDot 1.6s ease-out infinite;
}
