/**
 * Boussole — Design System v2 (ADR-2026-046)
 * Fond #FAFAF9, cards blanches, Nunito/Jura/DM Mono
 */

/* === VARIABLES === */
:root {
  /* Couleurs primaires — alignées sur vitrine */
  --color-primary: #2d6a4f;        /* vert forêt (couleur primaire unique) */
  --color-primary-dark: #1b4332;   /* vert forêt foncé (hover) */
  --color-primary-light: #d4e0da;  /* sage clair (backgrounds légers) */

  /* Curseurs (inchangés — sémantiques) */
  --color-low: #ef4444;
  --color-mid: #f97316;
  --color-high: #2d6a4f;

  /* Neutrals — Design System v2 */
  --color-bg: #FAFAF9;             /* fond principal DS v2 */
  --color-card: #ffffff;
  --color-border: rgba(6,23,45,.12);  /* border vitrine */
  --color-text: #06172D;           /* ink vitrine (navy) */
  --color-text-muted: rgba(6,23,45,.58); /* muted2 vitrine */

  /* Typographie — Design System v2 (ADR-2026-046) */
  --font-heading: 'Nunito', ui-sans-serif, system-ui, sans-serif;
  --font-ui: 'Nunito', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, monospace;
  --font-micro: 'Jura', ui-sans-serif, sans-serif;
  --font-family: 'Nunito', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-size-base: 13px;
  --font-size-small: 12px;
  --font-size-large: 15px;

  /* Échelle typographique harmonisée */
  --fs-section: 11px;   /* titres section (uppercase, bold, letter-spacing) */
  --fs-body: 13px;      /* texte corps, boutons, descriptions */
  --fs-label: 12px;     /* labels secondaires, dates, metadata */
  --fs-help: 11px;      /* aide, footnotes, disclaimers */
  --fs-tiny: 9px;       /* légendes, axes, calendrier */

  /* Espacements */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Radius — Design System v2 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* Ombres — Design System v2 (subtiles) */
  --shadow-card: 0 1px 3px rgba(6,23,45,0.06);
  --shadow-soft: 0 1px 2px rgba(6,23,45,0.04);

  /* === DESIGN TOKENS v2 (audit 04/04/2026) === */

  /* Texte — 3 niveaux sémantiques (remplace les grays Tailwind/legacy) */
  --color-text-secondary: rgba(6,23,45,.65);
  --color-text-hint: rgba(6,23,45,.45);

  /* Vert score (harmonisé sur forest #2d6a4f) */
  --color-score: #2d6a4f;

  /* Bordures interactives */
  --color-border-input: rgba(110,135,125,.35);
  --color-border-dashed: rgba(45,106,79,.4);

  /* Fonds neutres (remplace Tailwind gray-50/200) */
  --color-bg-field: rgba(6,23,45,.03);
  --color-border-field: rgba(6,23,45,.12);

  /* Typographie — échelle stricte 5 tailles (audit) */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 16px;
  --text-lg: 18px;

  /* Radius — 3 valeurs strictes (audit : remplace 11 valeurs) */
  /* --radius-sm: 8px  (déjà 6px, on le passe à 8px) */
  /* --radius-md: 12px (déjà) */
  /* --radius-lg: 18px (déjà) */
  --radius-pill: 20px;
}

/* === RESET === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text);
  /* Fond neutre Design System v2 (ADR-2026-046) */
  background: #FAFAF9;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* === LAYOUT === */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--spacing-md);
}

/* === HEADER — Design System v2 (ADR-2026-046 Sprint 4) === */
.header {
  padding: 16px 0 8px;
  position: relative;
}

.header h1 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  color: var(--color-text);
  line-height: 1.2;
}

.header p {
  font-size: 12px;
  color: rgba(6,23,45,0.45);
  margin: 2px 0 0;
}

/* === BOTTOM TAB BAR (ADR-2026-043) === */
.bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: stretch;
  background: #fff;
  border-top: 1px solid rgba(6,23,45,.1);
  box-shadow: 0 -2px 8px rgba(6,23,45,.06);
  z-index: 999;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: rgba(6,23,45,.45);
  font-size: 10px;
  font-family: var(--font-ui);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-btn:hover {
  color: rgba(6,23,45,.65);
}

.tab-btn.active {
  color: #2d6a4f;
  font-weight: 600;
}

.tab-btn.active svg {
  stroke-width: 1.8;
}

/* === DASHBOARD NAV CARDS (ADR-2026-046 Sprint 3) === */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.dash-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-ui);
  transition: transform 0.1s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  background: #fff;
  box-shadow: 0 1px 3px rgba(6,23,45,0.06);
}

.dash-tile:active {
  transform: scale(0.97);
}

.dash-tile-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-tile-icon-wrap svg {
  width: 20px;
  height: 20px;
}

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

.dash-tile-label {
  font-size: 13px;
  font-weight: 700;
  color: #06172D;
  line-height: 1.2;
}

.dash-tile-sub {
  font-size: 11px;
  color: rgba(6,23,45,.45);
  margin-top: 2px;
  line-height: 1.3;
  font-weight: 400;
}

.dash-tile-chevron {
  color: rgba(6,23,45,.2);
  flex-shrink: 0;
}

.dash-tile--forest .dash-tile-icon-wrap { background: rgba(45,106,79,0.07); }
.dash-tile--forest .dash-tile-icon-wrap svg { stroke: #2d6a4f; }
.dash-tile--navy .dash-tile-icon-wrap { background: rgba(6,23,45,0.06); }
.dash-tile--navy .dash-tile-icon-wrap svg { stroke: #06172D; }
.dash-tile--info .dash-tile-icon-wrap { background: rgba(59,130,246,0.07); }
.dash-tile--info .dash-tile-icon-wrap svg { stroke: #3B82F6; }
.dash-tile--warning .dash-tile-icon-wrap { background: rgba(217,119,6,0.07); }
.dash-tile--warning .dash-tile-icon-wrap svg { stroke: #D97706; }

/* === PANELS === */
.panel {
  display: none;
}

.panel.active {
  display: block;
}

/* === CARD — Design System v2 === */
.card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--spacing-md);
  border: none;
  font-family: var(--font-ui);
}

/* Card groups — sections fusionnées dans une seule card */
.card-group {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--spacing-md);
  border: none;
  font-family: var(--font-ui);
}
.card-group > .card {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border: none;
  margin-bottom: 0;
  padding: var(--spacing-md) 0 0 0;
  border-top: 1px solid rgba(6,23,45,.08);
}
.card-group > .card:first-child {
  border-top: none;
  padding-top: 0;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: #06172D;
  margin-bottom: var(--spacing-md);
}

.card-hint {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-md);
}

/* === FIELD === */
.field {
  margin-bottom: var(--spacing-lg);
}

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
}

.field-value {
  display: inline-block;
  min-width: 32px;
  text-align: center;
  font-weight: 600;
  color: var(--color-primary);
}

/* === RANGE INPUT (CURSEUR) === */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    var(--color-low) 0%,
    var(--color-mid) 50%,
    var(--color-high) 100%
  );
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--color-primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(6,23,45,.18);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--color-primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(6,23,45,.18);
}

input[type="range"]:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--spacing-xs);
  font-size: 12px;
  color: var(--color-text-muted);
}

/* === TEXTAREA === */
textarea {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  resize: vertical;
  min-height: 80px;
  transition: border-color .2s, box-shadow .2s;
}

textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(110,135,125,.15);
}

textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.textarea-count {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: right;
  margin-top: var(--spacing-xs);
}

/* === RMSSD === */
.rmssd-block {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

.rmssd-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

.rmssd-optional {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-muted);
  background: rgba(6,23,45,.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

.rmssd-hint {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
}

.rmssd-block input[type="number"] {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  transition: border-color .2s, box-shadow .2s;
}

.rmssd-block input[type="number"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(110,135,125,.15);
}

.rmssd-block input[type="number"]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
/* === BUTTONS — Design System v2 === */
.btn {
  display: inline-block;
  padding: 10px 14px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: white;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.btn-row {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.btn-row .btn {
  flex: 1;
}

/* === STATUS === */
.status {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  font-size: var(--font-size-small);
}

.status-success {
  background: rgba(45,106,79,.1);
  color: #1e4d38;
  border: 1px solid #2d6a4f;
}

.status-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #3b82f6;
}

.status-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.status-muted {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  margin-top: var(--spacing-md);
}

/* === SUMMARY SECTIONS === */
.summary-section {
  margin-bottom: var(--spacing-xl);
}

h2.summary-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #06172D;
  margin: 0 0 12px;
}

/* Sous-titres de section dans les cards (remplace les inline SECTION_TITLE) */
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  color: #06172D;
}

/* Conteneur de section dans les cards Résumé/Présentation (remplace SECTION_STYLE inline) */
.section-card {
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.summary-item {
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-md);
  background: rgba(6,23,45,.03);
  border-radius: var(--radius-md);
}

.summary-item strong {
  color: var(--color-primary);
  font-weight: 600;
}

.summary-trend {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  margin-top: var(--spacing-xs);
}

.summary-list {
  list-style: none;
  padding: 0;
}

.summary-list li {
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.summary-list li:last-child {
  border-bottom: none;
}

/* === MODAL === */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(6, 23, 45, 0.4);
  z-index: 1000;
  padding: var(--spacing-md);
  overflow-y: auto;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 22px 60px rgba(6,23,45,.22);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

.modal-title {
  font-size: var(--font-size-large);
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .15s;
}

.modal-close:hover {
  background: rgba(6,23,45,.06);
}

.modal-body {
  margin-bottom: var(--spacing-md);
}

.modal-footer {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
}

/* === PREVIEW === */
.preview {
  background: rgba(6,23,45,.03);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  font-family: monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 500px;
  overflow-y: auto;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .container {
    padding: var(--spacing-sm);
  }

  .card {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
  }
}

/* === ACCESSIBILITY === */
:focus-visible {
  outline: 3px solid rgba(110,135,125,.40);
  outline-offset: 3px;
}

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

/* === Questions journalières sous curseurs === */
.range-question {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 4px;
}

.range-hint {
  display: block;
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: right;
  margin-top: 2px;
}

/* === Footer version — Design System v2 === */
.app-footer {
  text-align: center;
  padding: 20px 16px 72px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(6,23,45,0.35);
}

.app-footer a {
  color: var(--color-primary);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* === INDICATOR CARDS === */
.indicator-card {
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 6px;
  box-shadow: 0 1px 5px rgba(6,23,45,.06);
}

.indicator-card .field {
  margin-bottom: 0;
}

.indicator-card--energie  { background: #e8f5f0; --indicator-color: #2e9e6e; }
.indicator-card--sommeil  { background: #fdf0eb; --indicator-color: #c0714a; }
.indicator-card--confort  { background: #f3eef8; --indicator-color: #8b5cb5; }
.indicator-card--mental   { background: #eaf2f8; --indicator-color: #3b82b6; }

.indicator-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
}

.indicator-score {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--indicator-color);
  line-height: 1;
  min-width: auto;
}

.range-wrapper {
  position: relative;
}

.smiley-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
  cursor: pointer;
  opacity: 0;
  transition: left 0.05s ease, opacity 0.3s ease;
  white-space: nowrap;
  z-index: 2;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.2));
}

/* Masquer le thumb natif uniquement quand le smiley est actif */
.range-wrapper.has-smiley input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  background: transparent;
  cursor: pointer;
  border: none;
  box-shadow: none;
  margin-top: -12px;
}

.range-wrapper.has-smiley input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  background: transparent;
  cursor: pointer;
  border: none;
  box-shadow: none;
}

/* === Section Mes mesures (ADR-2026-021) === */
.mesures-section {
  margin-top: 8px;
  padding: 0;
}

.mesures-header {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 12px;
  user-select: none;
  border-radius: 10px;
  transition: background .15s ease;
}
.mesures-header:hover {
  background: rgba(45,106,79,.05);
}

.mesures-chevron {
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.2s ease;
  color: #2d6a4f;
  line-height: 1;
}

.mesures-chevron.open {
  transform: rotate(90deg);
}

.mesures-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mesures-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-navy, #06172D);
}

.mesures-header-sub {
  font-size: 11px;
  color: #6E877D;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.mesures-subtitle {
  font-size: 13px;
  color: #888;
  margin: 0 0 12px 0;
  padding-left: 20px;
}

.mesures-body {
  background: rgba(45,106,79,.03);
  border-radius: 12px;
  padding: 14px;
  margin-top: 6px;
  border: 1px solid rgba(45,106,79,.12);
}

.mesures-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mesures-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #444;
  margin-bottom: 4px;
}

.mesures-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  box-sizing: border-box;
  -moz-appearance: textfield;
}

.mesures-field input::-webkit-outer-spin-button,
.mesures-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mesures-field-ta {
  grid-column: 1 / -1;
}

.ta-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ta-inputs input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  box-sizing: border-box;
  -moz-appearance: textfield;
}

.ta-inputs input::-webkit-outer-spin-button,
.ta-inputs input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ta-separator {
  font-size: 18px;
  font-weight: 600;
  color: #666;
}

.btn-save-mesures {
  margin-top: 14px;
  width: 100%;
  padding: 10px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-save-mesures:hover {
  background: var(--color-primary-dark);
}

.btn-save-mesures:active {
  opacity: 0.85;
}

.mesures-status {
  text-align: center;
  font-size: 13px;
  color: #6E877D;
  margin-top: 8px;
}

.mesures-cycle { grid-column: 1 / -1; }
.cycle-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cycle-chips .chip {
  padding: 6px 12px; border-radius: 20px; border: 1px solid #ddd;
  background: white; font-size: 13px; cursor: pointer; transition: all 0.2s;
  font-family: inherit; color: #333;
}
.cycle-chips .chip:hover { border-color: #8b5cb5; }
.cycle-chips .chip.active {
  background: #f3eef8; border-color: #8b5cb5; color: #6b3fa0; font-weight: 600;
}
.mesures-help { font-size: 12px; color: #999; margin-top: 4px; }

/* === PEM Detector — Episodes de crash === */

.pem-section {
  margin-top: 16px;
}

.pem-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text);
  margin: 0 0 6px;
}

.pem-count {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0 0 12px;
}

.pem-card {
  border-left: 4px solid #D32F2F;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(6,23,45,.08);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.pem-dates {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.pem-scores {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.pem-crash-score {
  color: #D32F2F;
  font-weight: 600;
}

.pem-delta {
  color: #D32F2F;
  font-weight: 700;
}

.pem-level {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.pem-fc {
  font-size: 12px;
  color: var(--color-text-muted);
}

.pem-message {
  font-size: 13px;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 10px 0 0;
  line-height: 1.5;
}

/* === Bouton outline sage (lien Articles accueil) === */
.btn-outline-sage {
  border: 2px solid #2d6a4f;
  background: transparent;
  color: #2d6a4f;
  padding: 14px;
  border-radius: 12px;
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: block;
  text-align: center;
  transition: background 0.2s, color 0.2s;
  box-sizing: border-box;
}

.btn-outline-sage:hover {
  background: #2d6a4f;
  color: white;
}

/* === Alerte pacing === */

.pacing-alert {
  position: relative;
  background: #e8f5f0;
  color: #355E4D;
  border-radius: 12px;
  padding: 12px 40px 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  margin-top: 12px;
}

.pacing-icon {
  font-weight: 700;
}

.pacing-dismiss {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #2d6a4f;
  line-height: 1;
  padding: 0 4px;
}

/* === Section Cycle & bien-être === */

.cycle-section { background: #f8f4ff; border-left: 4px solid #8b5cb5; border-radius: 12px; padding: 16px; margin-top: 12px; }
.cycle-section h3 { margin: 0 0 12px 0; font-size: 16px; color: #06172D; }
.cycle-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cycle-table td { padding: 6px 8px; border-bottom: 1px solid #eee; }
.cycle-table .cycle-bar { height: 8px; border-radius: 4px; display: inline-block; }
.cycle-message { font-size: 13px; color: #666; margin-top: 12px; font-style: italic; }

/* === DARK MODE TOGGLE BUTTON === */
.theme-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
  position: absolute;
  top: 16px;
  right: 16px;
}
.theme-toggle:hover { background: rgba(0,0,0,.06); }

/* === DARK MODE — palette === */
html.dark body {
  --color-bg: #0d1b2a;
  --color-card: #1b2838;
  --color-border: rgba(255,255,255,.1);
  --color-text: #e8e4de;
  --color-text-muted: rgba(232,228,222,.58);
  --color-primary: #8aab9e;
  --color-primary-dark: #1b4332;
  --color-primary-light: #2a3d35;
  --shadow-card: 0 1px 3px rgba(0,0,0,.3);
  --shadow-soft: 0 1px 2px rgba(0,0,0,.2);
  background: #0d1b2a;
}

/* Indicator cards */
html.dark .indicator-card--energie  { background: #1a2e24; }
html.dark .indicator-card--sommeil  { background: #2a1f1a; }
html.dark .indicator-card--confort  { background: #231e2e; }
html.dark .indicator-card--mental   { background: #1a2230; }

/* Generic cards */
html.dark .card { background: #1a2332; border: none; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
html.dark .card-group { background: #1a2332; border: none; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
html.dark .card-title { color: #e4e0de; }

/* Section titles & cards */
html.dark .section-title { color: #e8e4de; }
html.dark h2.summary-section { color: #e8e4de; }
html.dark .section-card { border-color: rgba(255,255,255,.08); }

/* Inputs */
html.dark input[type="number"],
html.dark textarea,
html.dark select {
  background: #162230;
  color: #e8e4de;
  border-color: rgba(255,255,255,.15);
}

/* Toggle hover in dark */
html.dark .theme-toggle:hover { background: rgba(255,255,255,.1); }

/* Mes mesures section */
html.dark .mesures-section { background: transparent; }
html.dark .mesures-body { background: rgba(45,106,79,.08); border-color: rgba(45,106,79,.2); }
html.dark .mesures-field input { background: #1b2838; color: #e8e4de; border-color: rgba(255,255,255,.12); }
html.dark .btn-save-mesures { background: #8aab9e; color: #0d1b2a; }

/* Cycle chips */
html.dark .cycle-chips .chip { background: #1b2838; color: #e8e4de; border-color: rgba(255,255,255,.15); }
html.dark .cycle-chips .chip.active { background: #2d1f3d; border-color: #8b5cb5; color: #c9b0e0; }

/* Cycle résumé section */
html.dark .cycle-section { background: #1e1530; border-left-color: #8b5cb5; }

/* PEM section */
html.dark .pem-section { background: #2a1515; }
html.dark .pem-card { border-left-color: #D32F2F; background: #1b2838; }

/* Modal */
html.dark .modal-overlay .modal-content,
html.dark .modal-content { background: #1b2838; color: #e8e4de; }

/* Status messages */
html.dark .status { background: #162230; }

/* Nav */
html.dark .bottom-tab-bar { background: #0d1b2a; border-top-color: rgba(255,255,255,.08); box-shadow: 0 -2px 8px rgba(0,0,0,.3); }
html.dark .tab-btn { color: rgba(232,228,222,.45); }
html.dark .tab-btn.active { color: #8aab9e; }
html.dark .dash-tile { background: #1a2332; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
html.dark .dash-tile-label { color: #e4e0de; }
html.dark .dash-tile-sub { color: rgba(232,228,222,.45); }
html.dark .dash-tile-chevron { color: rgba(232,228,222,.2); }

/* Header dark (ADR-2026-046) */
html.dark .header h1 { color: #e4e0de; }
html.dark .header p { color: rgba(232,228,222,.45); }

/* Score Hero card dark */
html.dark #accueil-score-cta { background: #1a2332; }
html.dark #accueil-score-display p,
html.dark #accueil-score-display div { color: #e4e0de; }
html.dark #accueil-score-trend { color: rgba(232,228,222,.55) !important; }
html.dark #score-ring-container circle:first-child { stroke: rgba(255,255,255,.08); }

/* Quick metrics pills dark */
html.dark .metric-pill,
html.dark #accueil-quick-metrics > div > div { background: #1a2332 !important; box-shadow: 0 1px 3px rgba(0,0,0,.2) !important; }
html.dark #accueil-quick-metrics [id^="metric-"] { color: #e4e0de !important; }

/* Agenda peek dark */
html.dark #accueil-agenda-peek { background: #1a2332 !important; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
html.dark #agenda-peek-title { color: #e4e0de !important; }
html.dark #agenda-peek-time { color: rgba(232,228,222,.45) !important; }
html.dark #agenda-peek-date div:first-child { color: #e4e0de !important; }
html.dark #agenda-peek-date div:last-child { color: rgba(232,228,222,.45) !important; }

/* CTA buttons dark */
html.dark #accueil-cta-saisie p { color: #e4e0de; }
html.dark #accueil-welcome-name { color: #e4e0de !important; }

/* Panel Paramètres dark */
html.dark #panel-params .card { background: #1a2332; }

/* Panel Paramètres light */
#panel-params .card { background: #fff; }

/* Padding bas pour que le gradient reste visible sous la carte */
#panel-params {
  padding-bottom: 48px;
}

.settings-group {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(6,23,45,.07);
}

.settings-group:first-of-type {
  border-top: none;
  padding-top: 0;
}

.settings-label {
  font-size: 14px;
  font-weight: 600;
  color: #06172D;
  margin: 0 0 4px;
}

.settings-desc {
  font-size: 13px;
  color: rgba(6,23,45,.55);
  margin: 0 0 14px;
}

.settings-radios {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
  color: #06172D;
}

.settings-radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: #2d6a4f;
  cursor: pointer;
}

html.dark .settings-label { color: #e8e4de; }
html.dark .settings-desc { color: rgba(232,228,222,.55); }
html.dark .settings-radio-label { color: #e8e4de; }
html.dark .mesures-header-sub { color: #8aab9e; }

/* Skip link accessibilite (WCAG 2.4.1) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 9999;
  background: #06172D;
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 8px;
}

/* === MODAL ÉVÉNEMENT (Feature T) === */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(6,23,45,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 24px;
  width: min(400px, 92vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #06172D;
  margin: 0;
}

.modal-card .modal-hint {
  font-size: 14px;
  color: #6B7280;
  margin: 0;
}

.modal-card select,
.modal-card textarea {
  width: 100%;
  border: 1px solid rgba(6,23,45,0.15);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  color: #06172D;
  background: #fafaf8;
}

.modal-card textarea { resize: vertical; }

#event-desc-count {
  font-size: 12px;
  color: #9CA3AF;
  text-align: right;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* Bouton "Signaler un événement" — outline vert cohérent avec l'app */
#btn-mark-event {
  background: none;
  border: 2px solid #2d6a4f;
  color: #2d6a4f;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 14px;
  border-radius: var(--radius-md);
  transition: background 0.15s, color 0.15s;
}

#btn-mark-event:hover {
  background: #2d6a4f;
  color: #fff;
}

html.dark .modal-card {
  background: #1b2838;
  color: #e8e4de;
}

html.dark .modal-card select,
html.dark .modal-card textarea {
  background: #162230;
  color: #e8e4de;
  border-color: rgba(255,255,255,.12);
}

/* === Feature M — Journal essais/intolérances === */

.essai-badge-type {
  background: #f0fdf4;
  color: #166534;
  border-radius: var(--radius-md);
  font-size: 11px;
  padding: 2px 8px;
  font-weight: 500;
}

.essai-badge-effet {
  border-radius: var(--radius-md);
  font-size: 11px;
  padding: 2px 8px;
  font-weight: 500;
}

.essai-duree {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

html.dark #card-essais .essai-badge-type {
  background: #14532d;
  color: #86efac;
}

html.dark #card-essais > div[style*="border-left"] {
  background: #162230;
}

/* === JOURNAL TABS (TB Santé) === */
.journal-accord {
  border: 1px solid rgba(6,23,45,0.08);
  border-radius: 12px;
  margin-bottom: 10px;
  background: #fff;
  overflow: hidden;
}

.journal-accord[open] {
  border-color: rgba(45,106,79,0.25);
}

.journal-accord-title {
  font-size: 14px;
  font-weight: 600;
  color: #06172D;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.journal-accord-title::-webkit-details-marker { display: none; }

.journal-accord[open] .journal-accord-title {
  color: #2d6a4f;
  border-bottom: 1px solid rgba(45,106,79,0.12);
}

.journal-accord-body {
  padding: 14px 16px;
}

/* === Journal notes (Feature V) === */
.journal-note-entry {
  background: #fff;
  border: 1px solid rgba(6,23,45,0.1);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.journal-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.journal-note-date {
  font-size: 12px;
  font-weight: 700;
  color: #2d6a4f;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.journal-note-actions {
  display: flex;
  gap: 6px;
}
.journal-note-btn-edit,
.journal-note-btn-del {
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
}
.journal-note-btn-edit {
  background: rgba(45,106,79,.1);
  color: #2d6a4f;
}
.journal-note-btn-del {
  background: rgba(220,38,38,.08);
  color: #dc2626;
}
.journal-note-text {
  font-size: 13px;
  color: #06172D;
  line-height: 1.6;
  white-space: pre-wrap;
}
.journal-note-empty {
  background: #fafaf8;
  border-color: rgba(6,23,45,0.06);
}
.journal-note-empty .journal-note-date {
  color: #9ca3af;
}
html.dark .journal-note-entry {
  background: #1b2838;
  border-color: rgba(255,255,255,0.08);
}
html.dark .journal-note-text { color: #e8e4de; }

html.dark .journal-accord {
  background: #1b2838;
  border-color: rgba(255,255,255,0.08);
}
/* === CLASSES UTILITAIRES (audit design system 04/04/2026) === */

/* Label de section uppercase — pattern unifié */
.section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-hint);
  margin: 0 0 8px;
}

/* Label de section uppercase — variante visible */
.section-label--visible {
  color: var(--color-text);
}

/* Bouton action principal (filled vert) */
.btn-action {
  width: 100%;
  padding: 12px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-action:hover { background: var(--color-primary-dark); }

/* Bouton outline vert */
.btn-outline {
  width: 100%;
  padding: 12px;
  background: #fff;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-outline:hover { background: rgba(45,106,79,.06); }

/* Bouton ajout dashed */
.btn-add {
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: 1.5px dashed var(--color-border-dashed);
  color: var(--color-primary);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-add:hover { background: rgba(45,106,79,.04); }

/* Bouton supprimer (unique style) */
.btn-delete {
  background: none;
  border: 1px solid #dc2626;
  color: #dc2626;
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.btn-delete:hover { background: rgba(220,38,38,.06); }

/* Champ input unifié */
.input-field {
  padding: 10px 12px;
  border: 1.5px solid var(--color-border-input);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
  box-sizing: border-box;
  width: 100%;
}
.input-field:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Chip/pill (cycle, filtres) */
.chip-btn {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-field);
  background: var(--color-bg-field);
  font-size: 13px;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-family: inherit;
}
.chip-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.chip-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* Score vert unifié */
.score-value {
  color: var(--color-score);
  font-weight: 700;
}

/* Compteur caractères (toujours à droite) */
.char-counter {
  font-size: var(--text-xs);
  color: var(--color-text-hint);
  text-align: right;
}

/* Note/hint sous un champ */
.field-hint {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin: 4px 0 0;
}

/* Section Mes mesures — harmonisation */
.mesures-grid label {
  font-size: var(--text-sm) !important;
  color: var(--color-text-secondary) !important;
  font-weight: 500;
}

.mesures-grid input {
  border: 1.5px solid var(--color-border-input) !important;
  border-radius: var(--radius-md) !important;
  font-size: var(--text-base) !important;
  color: var(--color-text) !important;
  font-family: inherit !important;
}

.mesures-grid input:focus {
  border-color: var(--color-primary) !important;
  outline: none;
}

/* Chips cycle — harmonisation */
.cycle-chips .chip {
  border-radius: var(--radius-pill) !important;
  border: 1px solid var(--color-border-field) !important;
  background: var(--color-bg-field) !important;
  color: var(--color-text-secondary) !important;
  font-size: var(--text-sm) !important;
}

.cycle-chips .chip:hover,
.cycle-chips .chip.active {
  border-color: var(--color-primary) !important;
  color: var(--color-primary) !important;
}

/* Accordéon — séparateur en-tête/corps */
.journal-accord-body {
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}

/* Bouton microphone — style unifié */
button[aria-label="Dicter la note"],
button[aria-label="Dicter"] {
  background: none !important;
  border: none !important;
  padding: 4px !important;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  border-radius: var(--radius-sm) !important;
}

button[aria-label="Dicter la note"]:hover,
button[aria-label="Dicter"]:hover {
  background: rgba(45,106,79,.08) !important;
}

/* === Résumé : normalisation cartes (audit P3) === */
#summary-content > div {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-card);
  background: var(--color-card);
}

/* Score vert unifié — forcer partout */
#summary-content .score-value,
#summary-content [style*="color:var(--color-score)"] {
  color: var(--color-score) !important;
}

/* Accessibilité : emoji sémantiques dans Points marquants */
#summary-content [role="img"] {
  font-style: normal;
}

/* === COMPLETION INDICATOR (ADR-044 Sprint 4) === */
.completion-bar{height:6px;border-radius:3px;background:rgba(6,23,45,.1);overflow:hidden;margin:0 0 6px}
.completion-bar-fill{height:100%;border-radius:3px;transition:width .3s ease}
.completion-dots{display:flex;gap:6px;justify-content:center;align-items:center}
.completion-dot{width:8px;height:8px;border-radius:50%;transition:background .2s}
.completion-dot--done{background:#2d6a4f}
.completion-dot--empty{background:rgba(6,23,45,.15)}
.completion-text{font-size:11px;color:rgba(6,23,45,.55);text-align:center;margin:4px 0 0}
.completion-text--done{color:#2d6a4f;font-weight:600}
.btn-compact{padding:10px 12px;font-size:12px}
