/**
 * UTOGRID — Shared Design System
 * ================================
 * Edit this file to retheme the entire app.
 *
 * Sections:
 *   1. Fonts
 *   2. Design tokens (CSS variables)
 *   3. Reset & base
 *   4. Layout shell (sidebar, main, pages)
 *   5. Navigation
 *   6. Cards & containers
 *   7. Typography helpers
 *   8. Data components (KPIs, charts, tables, bars)
 *   9. Badges & chips
 *  10. Buttons
 *  11. Forms & inputs
 *  12. Toast
 *  13. Modal
 *  14. Prototype toolbar
 *  15. Responsive
 */

/* ── 1. Fonts ──────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;500;600;700&family=Rubik:wght@400;500;600;700;800&display=swap');
@import url('https://cdn.jsdelivr.net/npm/@phosphor-icons/web@2.1.2/src/bold/style.css');

/* Digit-only tabular face: maps ONLY 0–9 to Rubik (which has tabular figures),
   so numbers never render in Comfortaa. Letters and letter-grades fall through
   to Comfortaa via the font stack. Pair with font-variant-numeric: tabular-nums. */
@font-face {
  font-family: 'UtoNum';
  src: url('https://fonts.gstatic.com/s/rubik/v31/iJWZBXyIfDnIV5PNhY1KTN7Z-Yh-4I-1UA.ttf') format('truetype');
  unicode-range: U+0030-0039;
  font-display: swap;
}

/* ── 2. Design tokens ──────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:      #FFFFFF;
  --bg2:     #F1F2F8;
  --card:    #FFFFFF;

  /* Brand */
  --mint:    #20C28E;
  --mint2:   #1AA37B;
  --teal:    #233CB8;
  --teal2:   #1F36A6;

  /* Text */
  --dark:    #1A2332;
  --white:   #FFFFFF;
  --muted:   #6B7280;
  --mutedlt: #94A3B8;
  --muteddk: #4B5563;

  /* Borders */
  --border:    #E6E7ED;
  --border2:   #D5D6DF;
  --borderint: rgba(0,0,0,0.07);

  /* Semantic colours */
  --amber: #FF8D28;
  --red:   #FF383C;
  --green: #20C28E;
  --blue:  #0088FF;

  /* Energy mix colours */
  --nuclear: #29B989;
  --hydro:   #2884F4;
  --wind:    #28BADF;
  --solar:   #FBC141;
  --bio:     #106349;
  --gas:     #A07258;

  /* Typography */
  --font-body:    'Rubik', system-ui, sans-serif;
  --font-display: 'Comfortaa', system-ui, sans-serif;

  /* Spacing scale: 4px for compact internals, 8px for layout and controls. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;

  /* PDL controls */
  --pdl-control-height: var(--space-8);
  --pdl-segmented-content-height: calc(var(--pdl-control-height) - var(--space-2));
  --pdl-period-nav-width: var(--space-7);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 14px;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(35,60,184,0.10);
  --shadow-card: 0 1px 2px rgba(15,23,42,.04), 0 16px 36px rgba(15,23,42,.06);

  /* PDL redesign palette */
  --pdl-text: var(--dark); /* aliased to the single canonical dark (collapsed) */
  --pdl-text-soft: #536175;
  --pdl-text-muted: #647086;
  /* Segmented tracks share the app's subdued surface with the page shell. */
  --pdl-segmented-track: var(--bg2);
  --pdl-energy: #233CB8;
  --pdl-energy-soft: color-mix(in srgb, var(--mint) 72%, transparent);
  --pdl-positive: var(--green);
  --pdl-trend-positive: var(--green);
  --pdl-trend-negative: var(--red);
  --pdl-cost: var(--amber);
  --pdl-warning: var(--amber);

  /* Energy score / Uto-score grade colors (canonical) + 4 transitional shades (recommended 9-step scale for smooth gradients in segments, bars, fills, etc.) */
  --score-grade-e: #E63E11;
  --score-grade-e-d: #EA6400;
  --score-grade-d: #EE8100;
  --score-grade-d-c: #F8A600;
  --score-grade-c: #FECB02;
  --score-grade-c-b: #C5C400;
  --score-grade-b: #85BB2F;
  --score-grade-b-a: #4D9F3D;
  --score-grade-a: #038141;
  --score-grade-a-top: #239432;
  --score-grade-b-top: #9DCC00;
  --score-grade-c-top: #FFEE50;
  --score-grade-d-top: #FE9600;
  --score-grade-e-top: #F16000;
  --score-grade-e-d-top: #F77D00;
  --score-grade-d-c-top: #FFBE4F;
  --score-grade-c-b-top: #DAD500;
  --score-grade-b-a-top: #63B121;
}

/* ── 3. Reset & base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* E: remove tap flash on iOS/Android for all interactive elements */
* { -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg2);
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
}

/* ── 4. Layout shell ───────────────────────────────────────────────── */
/* 100dvh (dynamic viewport height) shrinks when the mobile browser's address
   bar is visible, preventing content from being hidden behind browser chrome.
   100vh is kept as a fallback for browsers that don't support dvh yet.      */
.app  { display: flex; height: 100vh; height: 100dvh; overflow: hidden; cursor: default; font-variant-numeric: tabular-nums; }
/* Arrow cursor over text instead of the I-beam (cursor inherits; interactive
   elements keep their own pointer/text cursor). Inputs still get a text caret. */
.app input, .app textarea, .app [contenteditable="true"] { cursor: text; }

/* Single scroll container — all vertical scrolling happens here.
   -webkit-overflow-scrolling enables momentum (inertia) scroll on iOS.      */
.main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  position: relative;
  padding: 0 var(--space-4) var(--space-4);
  background: var(--bg2);
}

/* Pages must NOT create a second scroll container — removing overflow/max-height
   lets .main be the sole scroller and ensures touch events propagate correctly. */
.page {
  display: none;
  max-width: 1560px;
  margin: 0 auto;
  padding: var(--space-6);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}
.page.active { display: block; }

.page-carte-layout { height: calc(100dvh - 96px); }
.page-carte-layout.active { display: flex; flex-direction: column; padding: 0; }

/* ── 5. Navigation ─────────────────────────────────────────────────── */
.sidebar {
  width: 224px;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo { padding: 20px 20px 16px 16px; }

.logo {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--dark);
  text-transform: lowercase;
}
.logo span { color: var(--teal); }
.logo-sub  { font-size: .68rem; color: var(--muted); margin-top: 2px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 8px 8px 16px; }
.sidebar-account { display: flex; flex-direction: column; gap: 4px; padding: 8px; margin-top: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  font-size: .82rem;
  text-align: left;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  user-select: none;
}
.nav-item:hover  { background: rgba(255,255,255,.65); color: var(--dark); }
.nav-item.active { background: var(--white); border-color: var(--border); color: var(--dark); }
.nav-item.active span { font-weight: 500; }
.nav-item:focus-visible { outline: 2px solid rgba(31,54,166,.38); outline-offset: 2px; }
.nav-item i { width: 18px; font-size: 18px; line-height: 1; flex: 0 0 18px; transform: translateY(-1px); }
.nav-icon { display: inline-flex; }
@media (min-width: 769px) { .nav-item-mobile-only { display: none; } }
@media (max-width: 768px) { .nav-item-desktop-only { display: none; } }

/* Journey progress (sidebar bottom) */
.progress-section {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  background: var(--bg);
}
.progress-title   { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.progress-bar-wrap { background: var(--border); border-radius: 4px; height: 5px; margin-bottom: 6px; }
.progress-bar-fill { height: 5px; border-radius: 4px; background: linear-gradient(90deg, var(--teal), var(--mint)); }
.progress-label   { font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; }
.progress-steps   { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }

.pstep { display: flex; align-items: center; gap: 7px; font-size: .75rem; cursor: pointer; padding: 4px 0; }
.pstep:hover { color: var(--dark); }
.pstep.done   { color: var(--mint2); }
.pstep.active { color: var(--dark); font-weight: 600; }
.pstep.todo   { color: var(--muted); }
.pstep-dot    { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pstep.done   .pstep-dot { background: var(--mint); }
.pstep.active .pstep-dot { background: var(--teal); }
.pstep.todo   .pstep-dot { background: var(--border2); }

/* Mobile burger */
.burger {
  display: none;
  position: fixed; top: 8px; right: 8px; z-index: 200;
  width: 40px; height: 40px;
  background: var(--white);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.burger span { display: block; width: 20px; height: 2px; background: var(--dark); border-radius: 2px; transition: transform .25s, opacity .25s; }

/* Burger → ✕ when sidebar is open (class toggled by layout.js) */
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.burger:focus-visible { outline: 2px solid rgba(31,54,166,.38); outline-offset: 2px; }
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 149;
  opacity: 0;
  transition: opacity .25s;
}
.overlay.visible { opacity: 1; }

/* ── 6. Cards & containers ─────────────────────────────────────────── */
.card {
  /* Legacy card (pre-.card-panel). Prefer .card-panel for new/touched product UI.
     See design.md "App Cards and Containers" + "App Elevation & Depth". */
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.csm {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

/* Grid layouts */
.g2 { display: grid; grid-template-columns: 1fr 1fr;           gap: 12px; margin-bottom: 12px; }
.g3 { display: grid; grid-template-columns: repeat(3,1fr);     gap: 10px; margin-bottom: 12px; }
.g4 { display: grid; grid-template-columns: repeat(4,1fr);     gap: 10px; margin-bottom: 12px; }

/* Page header */
.ph { margin-bottom: 14px; }
.ph h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 3px; color: var(--dark); }
.ph p  { font-size: .78rem; color: var(--muted); }

/* Section title */
.stitle {
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dark);
}

/* Tag (inline label in stitle) */
.tag {
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .08em;
  background: rgba(35,60,184,.10);
  color: var(--teal);
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
}

/* Feature cards */
.fi-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.fi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px;
  cursor: pointer;
  transition: .2s;
  box-shadow: var(--shadow-sm);
}
.fi-card:hover   { border-color: var(--teal); box-shadow: var(--shadow-md); }
.fi-emoji { font-size: 1.3rem; margin-bottom: 6px; }
.fi-title { font-size: .8rem; font-weight: 600; margin-bottom: 4px; color: var(--dark); }
.fi-val   { font-size: 1.4rem; font-weight: 800; color: var(--teal); margin-bottom: 4px; letter-spacing: -.02em; }
.fi-desc  { font-size: .74rem; color: var(--muted); line-height: 1.5; }

/* PDL info strip */
.pdl-strip {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.linky-badge {
  background: rgba(202,138,4,.1);
  border: 1px solid rgba(202,138,4,.25);
  color: var(--amber);
  font-size: .7rem; font-weight: 700;
  padding: 3px 9px; border-radius: 4px; flex-shrink: 0;
}
.pdl-info { display: flex; gap: 16px; flex-wrap: wrap; }
.pi       { display: flex; flex-direction: column; gap: 2px; }
.pi-l     { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pi-v     { font-size: .84rem; font-weight: 600; color: var(--dark); }

/* Insight callout */
.insight {
  background: rgba(202,138,4,.05);
  border: 1px solid rgba(202,138,4,.2);
  border-radius: 11px;
  padding: 14px;
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 12px;
}
.insight h4 { font-size: .83rem; font-weight: 700; color: var(--amber); margin-bottom: 4px; }
.insight p  { font-size: .77rem; color: var(--muted); line-height: 1.6; }

/* Savings box */
.savings-box {
  background: linear-gradient(135deg,rgba(32,194,142,.07),rgba(35,60,184,.04));
  border: 1px solid rgba(35,60,184,.2);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.sav-num  { font-family: var(--font-display); font-size: 2.2rem; font-weight: 900; color: var(--mint2); line-height: 1; }
.sav-div  { width: 1px; height: 44px; background: var(--border); flex-shrink: 0; }
.sav-text h3 { font-size: .88rem; font-weight: 600; margin-bottom: 4px; color: var(--dark); }
.sav-text p  { font-size: .77rem; color: var(--muted); line-height: 1.5; }
.sav-btn {
  background: var(--teal); color: #fff;
  font-weight: 600; font-size: .77rem;
  padding: 7px 14px; border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,.26); cursor: pointer; white-space: nowrap; flex-shrink: 0;
  box-shadow:
    0 0 0 1px var(--teal),
    0 2px 4px rgba(0,0,0,.08),
    0 4px 8px rgba(0,0,0,.16),
    inset 0 2px 42px rgba(255,255,255,.16),
    inset 0 1px 0 rgba(255,255,255,.26);
  transition-property: background, transform, box-shadow;
  transition-duration: .2s, .15s, .2s;
}
.sav-btn:hover { background: var(--teal2); }
.sav-btn:active { transform: scale(.96); }

/* ── 7. Typography helpers ──────────────────────────────────────────── */
.kl  { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.kv  { font-size: 1.45rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--dark); }
.ks  { font-size: .71rem; color: var(--muted); margin-top: 3px; }
.kv.mint  { color: var(--mint2); }
.kv.amber { color: var(--amber); }
.kv.red   { color: var(--red); }
.kv.blue  { color: var(--blue); }
.kv.green { color: var(--green); }

.ms      { color: var(--muted); }
.ms span { color: var(--dark); font-weight: 700; }

/* ── 8. Data components ─────────────────────────────────────────────── */

/* Chart wrappers */
/* Cohérence horizontale : les cartes-graph legacy (.card du simulateur/PV) adoptent
   le même padding latéral (24px) que .card-panel et .pdl-chart-panel, pour que la
   distance canvas→bord soit identique sur toutes les pages. */
.card:has(canvas) { padding-left: var(--space-5); padding-right: var(--space-5); }
.cw    { position: relative; width: 100%; height: 185px; margin-top: 8px; }
.cw-lg { position: relative; width: 100%; height: 220px; margin-top: 8px; }
.cw-sm { position: relative; height: 140px; margin-top: 6px; }
/* Vertical touch gestures pass through chart canvases so the page can scroll.
   Chart.js is configured with events:['click','mousemove','mouseout'] to avoid
   registering touchstart/touchmove listeners that would call preventDefault(). */
.cw canvas, .cw-lg canvas, .cw-sm canvas { touch-action: pan-y; width: 100%; }

/* Progress rows (horizontal bar rows) */
.prow { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.plbl { font-size: .73rem; color: var(--muted); width: 80px; flex-shrink: 0; text-align: right; }
.ptrk { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.pfil { height: 100%; border-radius: 3px; }
.pval { font-size: .71rem; color: var(--dark); font-weight: 600; width: 36px; text-align: right; }

/* Legend */
.leg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.li  { display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); }
.ld  { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }

/* Réseau mix legend: semantic swatches keep the visible legend aligned with
   the energy-source palette even if items are reordered. */
#page-reseau .reseau-mix-swatch--conso { width: 14px; background: none; border-top: 2px dashed var(--dark); height: 0; border-radius: 0; }
#page-reseau .reseau-mix-swatch--nuclear { background: var(--nuclear); }
#page-reseau .reseau-mix-swatch--hydro { background: var(--hydro); }
#page-reseau .reseau-mix-swatch--wind { background: var(--wind); }
#page-reseau .reseau-mix-swatch--solar { background: var(--solar); }
#page-reseau .reseau-mix-swatch--bio { background: var(--bio); }
#page-reseau .reseau-mix-swatch--gas { background: var(--gas); }

#spotReseauEmpty,
#page-reseau .reseau-chart-empty {
  display: none;
  min-height: 220px;
  padding: 24px 8px;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
}

#co2Body {
  display: none;
  margin-top: var(--space-3);
}

#co2Toggle {
  margin-left: 8px;
  font-size: .8rem;
  width: 24px;
  height: 24px;
}

#reseauLoading {
  margin: 0 !important;
}
.pdl-note {
  margin: 8px 0 10px;
  font-size: .78rem;
  line-height: 1.45;
  font-weight: 400;
  color: var(--muted);
}
.pdl-note-inline {
  font-size: .78rem;
  line-height: 1.45;
  font-weight: 400;
  color: var(--muted);
}
/* Tables */
.pm-table { width: 100%; border-collapse: collapse; font-size: .77rem; }
.pm-table th { color: var(--muted); font-weight: 500; padding: 5px 9px; text-align: left; border-bottom: 1px solid var(--border); }
.pm-table td { padding: 7px 9px; border-bottom: 1px solid var(--border); color: var(--dark); }
.pm-table tr:last-child td { border-bottom: none; }
.pbar2  { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.pfil2  { height: 100%; border-radius: 2px; }

/* Mode / range toggles */
.mode-toggle {
  display: flex; gap: 4px; margin-bottom: 14px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 3px; width: fit-content;
}
.mode-btn {
  padding: 5px 14px; border-radius: 5px;
  font-size: .77rem; font-weight: 600;
  cursor: pointer; border: none; background: none;
  color: var(--muted); transition: .15s;
}
.mode-btn.active { background: var(--teal); color: #fff; }

.range-btn {
  padding: 4px 12px; border-radius: 5px;
  font-size: .74rem; font-weight: 600;
  cursor: pointer; border: none; background: none;
  color: var(--muted); transition: .15s;
}
.range-btn.active      { background: var(--teal); color: #fff; }
.range-btn:hover:not(.active) { background: rgba(31,54,166,.08); color: var(--teal); }
.range-btn-nodata      { opacity: .38; cursor: not-allowed !important; text-decoration: line-through; }



#page-reseau .pdl-period-controls { display: inline-flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
#page-reseau .pdl-period-tabs { width: auto; }
#page-reseau .pdl-period-tabs .range-btn { min-width: 56px; }
#page-reseau .reseau-loading { font-size: .78rem; color: var(--muted); margin: 0 0 var(--space-3); }
#page-reseau .reseau-loading:empty { display: none; margin: 0; }
#page-reseau .reseau-empty {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
  text-align: center;
}
#page-reseau .reseau-empty[hidden] { display: none; }
/* .reseau-main a display:flex, qui l'emporte sur l'attribut [hidden] : on rétablit
   le masquage pour que l'état vide global cache bien KPIs + graphes. */
#page-reseau .reseau-main[hidden] { display: none; }
#page-reseau .reseau-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: 0;
}

/* Consistent section rhythm for Réseau using design tokens, matching PDL main-layout gaps */
#page-reseau .reseau-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
#page-reseau .reseau-kpi-card { min-width: 0; margin: 0; }
#page-reseau .summary-metric__value > span { white-space: nowrap; }
#page-reseau .reseau-chart-card { margin-bottom: 0; }
#page-reseau .reseau-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
#page-reseau .reseau-mix-legend { margin-top: var(--space-4); gap: var(--space-2); }
#page-reseau .reseau-mix-legend .li { gap: var(--space-2); }
/* Hauteur uniforme des cartes graphiques : on réserve la place d'une légende sur les
   cartes qui n'en ont pas, pour égaliser les hauteurs sans réduire la zone de tracé. */
#page-reseau .reseau-chart-card:not(:has(.reseau-mix-legend)) .cw-lg { margin-bottom: calc(var(--space-4) + 19px); }

#page-reseau .dash-icon-btn { display: inline-grid; place-items: center; }
#page-reseau .dash-icon-btn i { font-size: .82rem; }

.cdc-tab { padding:5px 14px; border-radius:6px; font-size:.75rem; font-weight:600; cursor:pointer; border:none; background:none; color:var(--muted); transition:.15s; line-height:1.3; text-align:center; }
.cdc-tab.active { background:var(--teal); color:#fff; }
.cdc-tab:hover:not(.active) { background: rgba(31,54,166,.08); color: var(--teal); }
.cdc-tab span { display: block; font-size: .66rem; opacity: .78; margin-top: 2px; }

/* Radical PDL page direction: explain first, graph second */
#page-pdl {
  font-family: var(--font-body);
  color: var(--pdl-text);
  font-variant-numeric: tabular-nums;
}
.pdl-redesign {
  max-width: 1560px;
  margin: 0 auto;
}
.pdl-redesign .tag {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 6px;
  background: rgba(31,54,166,.08);
  color: var(--pdl-energy);
}
.pdl-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin: 0 0 24px;
}
.pdl-period-heading {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}
.pdl-hero h2 {
  /* Rubik (body font) for the whole title. The tabular-digit face (UtoNum) is
     only on the display stack, so digits here render in plain Rubik and don't
     come out heavier than the letters. */
  font-family: var(--font-body);
  max-width: 820px;
  font-size: 1.9rem;
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--pdl-text);
  margin: 0;
  white-space: nowrap;
}
.pdl-period-nav {
  display: inline-grid;
  width: var(--pdl-period-nav-width);
  height: var(--pdl-control-height);
  flex: 0 0 var(--pdl-period-nav-width);
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,1), 0 1px 1px rgba(0,0,0,.04);
  color: var(--pdl-text);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
/* ── Outlined control buttons — one coherent rest/hover/press/disabled ──
   design.md "Interactive Controls". The role classes (.btn--secondary,
   .btn--icon) and the existing structural controls share identical behaviour;
   focus-ring + press come from the unified states layer below. */
.btn--secondary, .btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--pdl-text);
  box-shadow: inset 0 0 0 1px #fff, 0 1px 1px rgba(0,0,0,.04);
}
.btn--icon { place-items: center; padding: 0; }
.btn--secondary:hover:not(:disabled), .btn--icon:hover:not(:disabled),
.pdl-period-nav:hover:not(:disabled), .pdl-period-toggle:hover:not(:disabled),
.rc-nav:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal);
}
.btn--secondary:disabled, .btn--icon:disabled,
.pdl-period-toggle:disabled, .rc-nav:disabled {
  background: var(--pdl-segmented-track);
  border-color: var(--border);
  box-shadow: none;
  color: var(--pdl-text-muted);
  cursor: not-allowed;
  opacity: 1;
}

/* Role: primary (teal fill) */
.btn--primary {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--space-8); padding: 0 16px;
  font-family: var(--font-body); font-weight: 600; cursor: pointer;
  background: var(--teal); color: #fff;
  border: 1px solid rgba(255,255,255,.26); border-radius: var(--radius-md);
  box-shadow: 0 0 0 1px var(--teal), 0 2px 4px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.16),
    inset 0 2px 42px rgba(255,255,255,.16), inset 0 1px 0 rgba(255,255,255,.26);
}
.btn--primary:hover:not(:disabled) { background: var(--teal2); }

/* Role: ghost (text only) */
.btn--ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0 8px; font-family: var(--font-body); font-weight: 600; cursor: pointer;
  background: transparent; border: none; color: var(--teal);
}
.btn--ghost:hover:not(:disabled) { color: var(--teal2); background: rgba(31,54,166,.08); }

/* Shared states for all role classes (transition / focus / press / disabled) */
.btn--primary, .btn--secondary, .btn--ghost, .btn--icon {
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
  transition-timing-function: cubic-bezier(.2, 0, 0, 1);
}
.btn--primary:focus-visible, .btn--secondary:focus-visible,
.btn--ghost:focus-visible, .btn--icon:focus-visible {
  outline: 2px solid rgba(31,54,166,.45); outline-offset: 2px;
}
.btn--primary:active:not(:disabled), .btn--secondary:active:not(:disabled),
.btn--ghost:active:not(:disabled), .btn--icon:active:not(:disabled) {
  transform: scale(.96);
}
.btn--primary:disabled, .btn--ghost:disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}
.pdl-period-nav.is-unavailable {
  opacity: .4;
}
.pdl-period-nav:disabled { cursor: default; }
.pdl-hero p {
  max-width: 680px;
  font-size: .95rem;
  line-height: 1.55;
  color: var(--pdl-text-soft);
  text-wrap: pretty;
}
#pdlRangeDaily,
#pdlRangeCdc {
  display: none;
}
.pdl-period-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
/* Desktop: show "Période précise" before the Jour/Semaine/Mois/Année tabs.
   Mobile keeps source order (tabs first, then the full-width toggle). */
@media (min-width: 769px) {
  .pdl-period-controls .pdl-custom-period { order: -1; }
}
.pdl-period-tabs,
.pdl-metric-tabs {
  display: flex;
  gap: 0;
  height: var(--pdl-control-height);
  background: var(--pdl-segmented-track);
  border: 0;
  border-radius: 16px;
  padding: 4px;
}
.pdl-period-tabs .range-btn,
.pdl-metric-tabs .cdc-tab {
  min-height: var(--pdl-segmented-content-height);
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--pdl-text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  transition-property: background, color, transform, box-shadow, border-color;
  transition-duration: .16s;
  transition-timing-function: cubic-bezier(.2,0,0,1);
}
.pdl-period-tabs .range-btn:hover:not(.active),
.pdl-metric-tabs .cdc-tab:hover:not(.active) {
  background: transparent;
  color: var(--pdl-text);
}
.pdl-period-tabs .range-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.pdl-period-tabs .range-btn:active,
.pdl-metric-tabs .cdc-tab:active {
  transform: scale(.96);
}
#page-pdl .range-btn:focus-visible,
#page-pdl .cdc-tab:focus-visible,
#page-pdl .pdl-period-toggle:focus-visible,
.pdl-help:focus-visible,
#page-pdl .pdl-unified-tab:focus-visible {
  outline: 2px solid #233CB8;
  outline-offset: 2px;
}
.pdl-custom-period {
  position: relative;
}
.pdl-custom-period .pdl-period-toggle {
  min-height: var(--pdl-control-height);
  display: flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
  color: var(--pdl-text);
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 0 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,1), 0 1px 1px rgba(0,0,0,.04);
  user-select: none;
}
.pdl-custom-period .pdl-period-toggle .pdl-toggle-cal {
  margin-right: var(--space-2);
  width: 18px;
  height: 18px;
  color: var(--pdl-text);
  flex: none;
  transform: translateY(-1px); /* alignement optique : remonte l'icône au niveau du label */
}
.pdl-date-fields {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.pdl-date-fields input {
  min-height: 40px;
  padding: 4px 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--dark);
  font-size: .78rem;
  outline: none;
  font-family: inherit;
}
.pdl-loading,
.pdl-date-fields span {
  font-size: .78rem;
  color: var(--muted);
}
/* When idle/empty the loading span shouldn't occupy a flex slot, otherwise its
   trailing gap pushes the period controls ~10px in from the container edge. */
.pdl-loading:empty { display: none; }

/* Spinning loader — used inline next to labels and inside empty-state areas */
@keyframes utogrid-spin { to { transform: rotate(360deg); } }
.spin-loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: utogrid-spin .7s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
.spin-loader-lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

/* Période précise — anchored range-calendar popover (no layout shift) */
.pdl-rangecal {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 336px;
  background: #fff;
  border: 1px solid rgba(148,163,184,.3);
  border-radius: 16px;
  box-shadow: 0 18px 46px rgba(26,35,50,.18);
  padding: 16px;
  text-align: left;
}
.pdl-rangecal[hidden] { display: none; }
.pdl-rangecal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 290; }
.pdl-rangecal-overlay[hidden] { display: none; }
/* Overlay is a mobile-only affordance; desktop keeps the plain dropdown. */
@media (min-width: 769px) { .pdl-rangecal-overlay { display: none !important; } }
.rc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.rc-title { font-weight: 700; font-size: .95rem; color: var(--pdl-text, #1A2332); }
.rc-nav { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; color: var(--muted); }
.rc-nav i { font-size: 20px; line-height: 1; transform: translateY(-1px); }
.rc-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
}
.rc-fields label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 600;
}
.rc-fields input {
  min-width: 0;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--pdl-text);
  font-family: var(--font-body);
  font-size: .78rem;
}
.rc-fields input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
}
.rc-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.rc-dow span { text-align: center; font-size: .66rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rc-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.rc-day { height: 32px; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-size: .82rem; color: var(--pdl-text, #1A2332); font-family: var(--font-body); }
.rc-day.rc-empty { visibility: hidden; }
.rc-day:hover:not(.rc-disabled):not(.rc-start):not(.rc-end) { background: rgba(35,60,184,.08); }
.rc-day.rc-disabled { color: var(--mutedlt); opacity: .4; cursor: default; }
.rc-inrange { background: rgba(35,60,184,.10); border-radius: 0; }
.rc-start, .rc-end { background: var(--teal); color: #fff; font-weight: 700; }
.rc-start { border-radius: 8px 0 0 8px; }
.rc-end { border-radius: 0 8px 8px 0; }
.rc-single { border-radius: 8px; }
.rc-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.rc-reset { border: none; background: none; color: var(--teal); font-size: .74rem; font-weight: 600; cursor: pointer; font-family: var(--font-body); }
.rc-reset:hover { color: var(--teal2); }
.pdl-main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* Section-level rhythm: distinct card sections sit 32px apart; related cards
     within a section use 16px (see .pdl-inline-insight). 8pt grid + proximity. */
  gap: 32px;
}
.pdl-intro-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
}
.pdl-story-card {
  /* Taille fixe, identique quelle que soit la période sélectionnée */
  --pdl-story-stat-w: 300px;
  --pdl-story-text-w: 360px;
  display: grid;
  grid-template-columns: var(--pdl-story-stat-w) var(--pdl-story-text-w);
  gap: 12px;
  align-items: stretch;
  width: min(100%, calc(var(--pdl-story-stat-w) + var(--pdl-story-text-w) + 12px));
  padding: 0;
}
.pdl-story-card .summary-metric { height: 104px; }
/* Shared compact metric card. Use this for a labelled value plus one concise
   supporting line; the PDL story pair and Réseau KPI grid share the same shell. */
.summary-metric {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: center;
  gap: var(--space-2);
  min-width: 0;
  min-height: 104px;
  padding: var(--space-3) 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
}
.summary-metric__value {
  display: flex;
  align-items: baseline;
  gap: .34em;
  min-width: 0;
  white-space: nowrap;
  color: var(--dark);
  font-family: var(--font-body);
  font-size: 1.7rem;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.summary-metric__value .pdl-help {
  align-self: center;
  margin-left: 8px;
}
.summary-metric__eyebrow {
  font-size: .75rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
}
.summary-metric__helper {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 400;
  line-height: 1.35;
}
.summary-metric--energy .summary-metric__value { color: var(--mint); }
.summary-metric--consumption .summary-metric__value { color: var(--blue); }
.summary-metric--renewable .summary-metric__value { color: var(--green); }
.summary-metric--fossil .summary-metric__value { color: #946652; }
.summary-metric--nuclear .summary-metric__value { color: var(--nuclear); }
.summary-metric__change {
  display: inline-flex;
  align-items: baseline;
  gap: .62em;
  font-variant-numeric: tabular-nums;
}
.summary-metric__change-value { font-weight: 700; }
.summary-metric__change-value.is-lower { color: var(--pdl-trend-positive); }
.summary-metric__change-value.is-higher { color: var(--pdl-trend-negative); }
.summary-metric__change-value.is-stable { color: var(--muted); }
.summary-metric__change-label { color: var(--muted); }
.pdl-story-card.is-year .summary-metric p {
  max-width: 590px;
}
.pdl-eyebrow {
  font-size: .66rem;
  color: var(--teal);
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.pdl-chart-panel,
.pdl-detail-card,
.pdl-secondary-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}
.pdl-secondary-card .cw-lg { flex: none; height: 240px; }
.pdl-pmax-card .cw-lg { height: 300px; }
/* Vue Jour : la Pmax (journalière) n'a pas de profil horaire → message à la place du graphe. */
.pdl-pmax-day-note { display: flex; align-items: center; justify-content: center; min-height: 220px; padding: 24px; }
.pdl-pmax-day-note p { margin: 0; max-width: 460px; text-align: center; color: var(--muted); font-size: .9rem; line-height: 1.6; text-wrap: pretty; }
.pdl-pmax-day-note strong { color: var(--dark); font-weight: 600; }
.pdl-chart-panel {
  padding-top: 24px;
}
.pdl-unified-comparison {
  padding-top: 8px;
}
.pdl-unified-comparison .pdl-card-head .stitle {
  margin-bottom: 0;
}
.pdl-unified-comparison .pdl-card-actions {
  transform: translateY(16px);
}
.pdl-unified-comparison #pdlUnifiedChartWrap {
  margin-top: var(--space-4);
}
.pdl-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
.pdl-card-head .stitle {
  margin-bottom: 4px;
}
.pdl-redesign .stitle,
#page-reseau .reseau-chart-card .stitle {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0;
  margin-bottom: 4px;
}
.pdl-redesign .pdl-card-head p {
  font-size: .95rem;
  line-height: 1.5;
  color: var(--pdl-text-muted);
}
.pdl-main-chart {
  width: 100%;
  margin: 0;
  height: auto !important;
  min-height: 0;
  aspect-ratio: 9 / 2;
}
.pdl-metric-tabs {
  margin: 0;
  width: fit-content;
}
.pdl-unified-tabs {
  display: flex;
  gap: 0;
  width: fit-content;
  min-height: var(--pdl-control-height);
  padding: 4px;
  border-radius: 16px;
  background: var(--pdl-segmented-track);
  box-shadow: inset 0 1px 1px rgba(26,35,50,.03);
}
.pdl-unified-tab {
  flex: 1 1 0;
  min-height: var(--pdl-segmented-content-height);
  padding: 4px 28px 4px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--pdl-text-muted);
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
}
.pdl-unified-tab span {
  display: block;
  font-size: .75rem;
  font-weight: 500;
  opacity: .78;
  white-space: nowrap;
}
.pdl-unified-tab:hover:not(.active) {
  color: var(--pdl-text);
}
.pdl-unified-tab.active {
  background: #fff;
  color: var(--pdl-text);
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
.pdl-unified-empty {
  padding: 48px 8px;
  color: var(--pdl-text-muted);
  font-size: .9rem;
  text-align: center;
}
.pdl-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
  min-width: 0;
}
/* Toggle iOS-like "Prix spot" — couleur On = primaire de marque (--teal). */
.utg-toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.utg-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.utg-toggle__track { position: relative; flex: 0 0 auto; width: 46px; height: 26px; border-radius: 999px; background: #EBEBEB; box-shadow: 0 0 0 2px rgba(18,18,18,.02), inset 0 1px 2px rgba(18,18,18,.05); transition: background .2s ease; }
.utg-toggle__knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(18,18,18,.10), 0 1px 1px rgba(18,18,18,.04); transition: transform .2s ease; }
.utg-toggle input:checked + .utg-toggle__track { background: var(--mint); }
.utg-toggle input:checked + .utg-toggle__track .utg-toggle__knob { transform: translateX(20px); }
.utg-toggle input:focus-visible + .utg-toggle__track { outline: 2px solid var(--teal); outline-offset: 2px; }
.utg-toggle__label { font-size: .86rem; font-weight: 600; color: var(--pdl-text); white-space: nowrap; }

/* Appliance toggle list — Mes données page */
.utg-appliance-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.utg-appliance-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg2); }
.utg-appliance-item:hover { border-color: var(--teal); }
.utg-appliance-item__label { display: flex; align-items: center; gap: 9px; font-size: .82rem; color: var(--dark); }
.utg-appliance-item__emoji { font-size: 1.2rem; flex-shrink: 0; }
.utg-appliance-item--on .utg-toggle__track { background: var(--mint); }
.utg-appliance-item--on .utg-toggle__knob { transform: translateX(20px); }
.pdl-detail-card {
  background: var(--card);
  border-color: rgba(148,163,184,.20);
  padding-top: 20px;
}
.pdl-detail-card .cw-lg {
  height: 285px;
}
.pdl-trend-section {
  /* Section spacing is handled by .pdl-main-layout gap (32px) — no extra offset. */
  margin-top: 0;
}
.pdl-soft-insight {
  background: rgba(35,60,184,.055);
  border: 0;
  border-radius: 12px;
  padding: 20px 24px;
}
.pdl-soft-insight h4 {
  color: var(--pdl-text, #1A2332);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px;
}
.pdl-soft-insight p {
  color: var(--pdl-text-muted);
  font-size: .95rem;
  line-height: 1.45;
  margin: 0;
  text-wrap: pretty;
}
.pdl-insight-meta {
  margin: 4px 0 12px;
  font-size: .78rem;
  line-height: 1.4;
  color: var(--pdl-text-muted);
}
.pdl-insight-list {
  display: grid;
  gap: 8px;
}
.pdl-insight-row {
  color: var(--pdl-text-soft);
  font-size: .9rem;
  line-height: 1.45;
}
.pdl-insight-label {
  color: var(--pdl-text-soft);
  font-weight: 400;
}
.pdl-insight-value {
  color: var(--pdl-text);
  font-weight: 600;
  white-space: nowrap;
}
.pdl-insight-rec {
  color: var(--teal);
  font-weight: 600;
  white-space: nowrap;
}
/* Calmer emphasis: semibold instead of heavy Comfortaa bold.
   nowrap keeps value phrases ("10,47 kVA", "14:54 à 16:54") from splitting. */
.pdl-soft-insight strong { font-weight: 600; white-space: nowrap; }
.pdl-inline-insight {
  width: min(100%, 680px);
  max-width: 100%;
  margin-bottom: 16px;
}
#page-pdl .pdl-period-tabs .range-btn,
#page-pdl .pdl-metric-tabs .cdc-tab,
#page-pdl .pdl-unified-tab {
  min-height: var(--pdl-segmented-content-height);
  font-size: .86rem;
  font-weight: 600;
}
#page-pdl .pdl-period-tabs {
  border-radius: 16px;
}
#page-pdl .pdl-period-tabs .range-btn {
  padding: 0 24px;
}
#page-pdl .pdl-period-toggle {
  min-height: var(--pdl-control-height);
  border-radius: 16px;
  padding: 0 24px;
}
#page-pdl .pdl-period-tabs .range-btn.active {
  background: #fff;
  color: var(--pdl-text);
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
#page-reseau .pdl-period-tabs .range-btn.active,
#page-sim-tarif .pdl-period-tabs .range-btn.active {
  background: #fff;
  color: var(--pdl-text);
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
#page-reseau .pdl-period-tabs,
#page-sim-tarif .pdl-period-tabs {
  height: var(--pdl-control-height);
  background: var(--pdl-segmented-track);
  border: 0;
  border-radius: 16px;
  padding: 4px;
}
#page-reseau .pdl-period-tabs .range-btn,
#page-sim-tarif .pdl-period-tabs .range-btn {
  min-height: var(--pdl-segmented-content-height);
  padding: 0 24px;
  border-radius: 12px;
  font-size: .86rem;
  font-weight: 600;
}
#page-pdl .pdl-metric-tabs .cdc-tab.active {
  background: #fff;
  color: var(--pdl-text);
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
.pdl-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 1px solid rgba(148,163,184,.36);
  border-radius: 999px;
  background: #fff;
  color: var(--pdl-text-muted);
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.pdl-help:hover,
.pdl-help.open {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(31,54,166,.08);
}
.pmax-title-help {
  margin-left: 6px;
  vertical-align: middle;
}
.pdl-help-pop {
  position: fixed;
  z-index: 80;
  width: min(280px, calc(100vw - 32px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(15,23,42,.92);
  box-shadow: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: .78rem;
  line-height: 1.45;
  text-wrap: pretty;
}
.pdl-help-pop::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: rgba(15,23,42,.92);
  transform: translateX(-50%) rotate(45deg);
}
.pdl-help-pop.is-below::after {
  top: -6px;
  bottom: auto;
}

/* On smaller laptops the two-column hero gets cramped; stack it so the
   headline and the insight card each get the full width. */
@media (max-width: 1180px) {
  .pdl-story-card {
    grid-template-columns: minmax(240px, var(--pdl-story-stat-w)) minmax(280px, var(--pdl-story-text-w));
    width: min(100%, calc(var(--pdl-story-stat-w) + var(--pdl-story-text-w) + 12px));
  }
}

@media (max-width: 980px) {
  .pdl-intro-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .pdl-redesign {
    max-width: none;
  }
  .pdl-hero {
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 8px 0 20px;
  }
  .pdl-hero h2 {
    font-size: 1.55rem;
    white-space: normal;
    text-align: center;
  }
  .pdl-hero-copy { text-align: center; }
  .pdl-period-heading { justify-content: center; gap: 12px; }
  .pdl-unified-comparison .pdl-card-actions { transform: none; }
  .pdl-hero p {
    font-size: .9rem;
  }
  .pdl-period-controls {
    justify-content: center;
    align-items: center;
  }
  .pdl-period-tabs {
    width: 100%;
  }
  #page-pdl .pdl-period-tabs .range-btn {
    flex: 1;
    padding: 0 8px;
  }
  .pdl-custom-period,
  .pdl-custom-period .pdl-period-toggle {
    width: 100%;
  }
  .pdl-custom-period .pdl-period-toggle {
    justify-content: center;
  }
  #page-pdl .pdl-metric-tabs .cdc-tab {
    min-height: var(--pdl-segmented-content-height);
  }
  #page-pdl .pdl-unified-tab {
    min-height: var(--pdl-segmented-content-height);
    flex: 1;
    padding-right: 8px;
    padding-left: 8px;
  }
  .pdl-unified-tabs { width: 100%; }
  .pdl-help {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }
  .pdl-story-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }
  .pdl-story-card .summary-metric {
    height: auto;
    min-height: 96px;
    padding: 12px 14px;
    gap: 6px;
  }
  .pdl-intro-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .pdl-inline-insight {
    justify-self: stretch;
    width: 100%;
    max-width: none;
  }
  .pdl-story-card .summary-metric__value {
    font-size: 1.5rem;
  }
  .pdl-story-card .summary-metric__helper { font-size: .8rem; line-height: 1.35; }
  .summary-metric__change { gap: .35em; white-space: nowrap; }
  .pdl-chart-panel,
  .pdl-detail-card,
  .pdl-secondary-card {
    padding: 16px;
    border-radius: 16px;
  }
  .pdl-main-chart,
  .pdl-main-chart.is-day-view {
    height: auto !important;
    min-height: 0;
    aspect-ratio: 4 / 3;
  }
  .pdl-secondary-card .cw-lg {
    width: calc(100% + 24px);
    margin-right: -12px;
    margin-left: -12px;
  }
  .pdl-pmax-card .cw-lg {
    height: 270px;
  }
  .pdl-card-head {
    align-items: flex-start;
  }
  .pdl-card-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  /* On phones the calendar stays anchored just under the full-width button,
     above a dim overlay, and scrolls internally if it exceeds the viewport. */
  .pdl-rangecal {
    z-index: 300;
    left: 0;
    right: 0;
    width: auto;
    max-height: calc(100dvh - 200px);
    overflow-y: auto;
  }
}

/* Connections list */
.conn-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.conn-row:last-child { border-bottom: none; }
.conn-l  { display: flex; align-items: center; gap: 9px; }
.conn-ic { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.conn-nm { font-size: .82rem; font-weight: 600; margin-bottom: 1px; color: var(--dark); }
.conn-sb { font-size: .7rem; color: var(--muted); }
.cs      { font-size: .67rem; font-weight: 600; padding: 2px 7px; border-radius: 3px; white-space: nowrap; }
.cs-on   { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); }
.cs-pub  { background: color-mix(in srgb, var(--blue) 12%, transparent);  color: var(--blue); }
.cs-warn { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.cs-err  { background: color-mix(in srgb, var(--red) 12%, transparent);   color: var(--red); }

/* Resource grid (RGPD rights) */
.rg  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.rb  { background: var(--bg2); border: 1px solid var(--border); border-radius: 7px; padding: 10px; font-size: .77rem; color: var(--muted); cursor: pointer; transition: .2s; text-align: left; }
.rb:hover       { border-color: var(--teal); color: var(--dark); }
.rb .ri         { font-size: .95rem; margin-bottom: 3px; display: block; }
.rb.danger      { color: var(--red); border-color: rgba(220,38,38,.15); }

/* Score page */
.score-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 14px; }
.score-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 18px 14px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  position: relative; overflow: hidden; transition: .2s; box-shadow: var(--shadow-sm);
}
.score-card:hover { border-color: rgba(35,60,184,.3); box-shadow: var(--shadow-md); }
.score-icon      { font-size: 2rem; line-height: 1; margin-bottom: 2px; }
.score-name      { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: center; }
.score-val       { font-size: 2rem; font-weight: 900; line-height: 1; letter-spacing: -.03em; color: var(--dark); }
.score-bar-wrap  { width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.score-bar       { height: 6px; border-radius: 3px; transition: width 1s ease; }
.score-desc      { font-size: .68rem; color: var(--muted); text-align: center; line-height: 1.4; }

.utoscore-main {
  background: linear-gradient(135deg,rgba(32,194,142,.07),rgba(35,60,184,.04));
  border: 1px solid rgba(35,60,184,.2);
  border-radius: 16px; padding: 24px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 24px;
}
.utoscore-dial   { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.utoscore-dial svg { width: 110px; height: 110px; }
.utoscore-label  { font-size: .72rem; font-weight: 700; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.utoscore-number { font-family: var(--font-display); font-size: 3.2rem; font-weight: 900; color: var(--teal); line-height: 1; letter-spacing: -.04em; }
.utoscore-sub    { font-size: .77rem; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.score-breakdown { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.breakdown-row   { display: flex; align-items: center; gap: 8px; }
.breakdown-name  { font-size: .75rem; color: var(--muted); width: 110px; flex-shrink: 0; }
.breakdown-bar   { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.breakdown-fill  { height: 5px; border-radius: 3px; }
.breakdown-val   { font-size: .73rem; font-weight: 700; width: 36px; text-align: right; }

/* Method table */
.method-table { width: 100%; border-collapse: collapse; font-size: .75rem; }
.method-table th { color: var(--muted); font-weight: 500; padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.method-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); line-height: 1.5; color: var(--dark); }
.method-table tr:last-child td { border-bottom: none; }
.method-table td:first-child { font-weight: 700; color: var(--teal); white-space: nowrap; }

/* Journey steps */
.journey { display: flex; flex-direction: column; }
.jstep   { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--border); }
.jstep:last-child { border-bottom: none; }
.jstep-num {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
.jstep.done   .jstep-num { background: var(--mint); color: #fff; }
.jstep.active .jstep-num { background: var(--teal); color: #fff; }
.jstep.todo   .jstep-num { background: var(--bg2); color: var(--muted); border: 1px solid var(--border); }
.jstep-body h4 { font-size: .88rem; font-weight: 600; margin-bottom: 4px; color: var(--dark); }
.jstep-body p  { font-size: .77rem; color: var(--muted); line-height: 1.5; }
.jstep-action  { margin-top: 8px; background: none; border: 1px solid var(--teal); color: var(--teal); font-size: .74rem; padding: 5px 12px; border-radius: 5px; cursor: pointer; }

/* Chips */
.chip { background: var(--bg2); border: 1px solid var(--border); color: var(--muted); font-size: .71rem; padding: 3px 9px; border-radius: 5px; cursor: pointer; transition: .15s; }
.chip:hover        { border-color: var(--teal); color: var(--dark); }
.chip.active       { border-color: var(--teal); color: var(--teal); background: rgba(35,60,184,.07); }

/* Popup rows */
.popup-title { font-size: .83rem; font-weight: 600; margin-bottom: 5px; color: var(--dark); }
.popup-row   { display: flex; justify-content: space-between; gap: 10px; font-size: .73rem; margin-bottom: 2px; }
.popup-lbl   { color: var(--muted); }
.popup-val   { font-weight: 600; color: var(--dark); }
.popup-fil   { font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 3px; margin-bottom: 7px; display: inline-block; }

/* ── 9. Badges ──────────────────────────────────────────────────────── */
.badges { display: flex; gap: 7px; margin-bottom: 12px; flex-wrap: wrap; }
.badge  { display: flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: var(--radius-sm); font-size: .76rem; font-weight: 600; border: 1px solid transparent; }
.bdot   { width: 7px; height: 7px; border-radius: 50%; }

/* ── 10. Buttons ────────────────────────────────────────────────────── */
.btn {
  min-height: 36px;
  padding: 7px 16px;
  border-radius: 7px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition-property: background, border-color, color, opacity, transform, box-shadow;
  transition-duration: .15s;
  font-family: var(--font-body);
}
.btn-primary,
.btn-mint {
  border: 1px solid rgba(255,255,255,.26);
  border-radius: var(--radius-md);
  box-shadow:
    0 0 0 1px var(--btn-edge),
    0 2px 4px rgba(0,0,0,.08),
    0 4px 8px rgba(0,0,0,.16),
    inset 0 2px 42px rgba(255,255,255,.16),
    inset 0 1px 0 rgba(255,255,255,.26);
}
.btn-primary { --btn-edge: var(--teal); background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal2); }
.btn-mint    { --btn-edge: var(--mint); background: var(--mint); color: var(--dark); }
.btn-mint:hover { background: var(--mint2); }
.btn-primary:active,
.btn-mint:active { transform: scale(.96); }

/* ── Unified control states — see design.md "Interactive Controls" contract ──
   One focus ring, one press feel, one transition across existing controls.
   Role-class migration (.btn--*) is documented in design.md, pending. */
.btn, .btn-primary, .btn-mint, .btn-ghost, .btn-danger, .sav-btn,
.pdl-period-toggle, .pdl-period-nav, .pdl-help, .rc-nav, .rc-reset, .burger,
.nav-item, .range-btn, .cdc-tab, .pdl-unified-tab {
  transition-property: background, border-color, color, box-shadow, transform;
  transition-duration: .15s;
  transition-timing-function: cubic-bezier(.2, 0, 0, 1);
}
.btn:focus-visible, .btn-primary:focus-visible, .btn-mint:focus-visible,
.btn-ghost:focus-visible, .btn-danger:focus-visible, .sav-btn:focus-visible,
.pdl-period-toggle:focus-visible, .pdl-period-nav:focus-visible,
.pdl-help:focus-visible, .rc-nav:focus-visible, .rc-reset:focus-visible,
.burger:focus-visible, .nav-item:focus-visible, .range-btn:focus-visible,
.cdc-tab:focus-visible, .pdl-unified-tab:focus-visible {
  outline: 2px solid rgba(31,54,166,.45);
  outline-offset: 2px;
}
.btn:active, .btn-ghost:active, .btn-danger:active, .sav-btn:active,
.pdl-period-toggle:active, .pdl-period-nav:active:not(:disabled),
.pdl-help:active, .rc-nav:active, .rc-reset:active, .burger:active {
  transform: scale(.96);
}
.btn:disabled, .btn-primary:disabled, .btn-mint:disabled, .btn-ghost:disabled,
.btn-danger:disabled, .sav-btn:disabled, .pdl-help:disabled,
.pdl-period-toggle:disabled {
  opacity: .45; cursor: not-allowed; pointer-events: none;
}
button[style*="background:var(--teal)"],
button[style*="background: var(--teal)"],
a[style*="background:var(--teal)"],
a[style*="background: var(--teal)"],
button[style*="background:var(--mint)"],
button[style*="background: var(--mint)"] {
  border: 1px solid rgba(255,255,255,.26) !important;
  border-radius: var(--radius-md) !important;
  box-shadow:
    0 0 0 1px var(--teal),
    0 2px 4px rgba(0,0,0,.08),
    0 4px 8px rgba(0,0,0,.16),
    inset 0 2px 42px rgba(255,255,255,.16),
    inset 0 1px 0 rgba(255,255,255,.26);
  transition-property: background, transform, box-shadow;
  transition-duration: .2s, .15s, .2s;
}
button[style*="background:var(--mint)"],
button[style*="background: var(--mint)"] {
  box-shadow:
    0 0 0 1px var(--mint),
    0 2px 4px rgba(0,0,0,.08),
    0 4px 8px rgba(0,0,0,.16),
    inset 0 2px 42px rgba(255,255,255,.16),
    inset 0 1px 0 rgba(255,255,255,.26);
}
button[style*="background:var(--teal)"]:active,
button[style*="background: var(--teal)"]:active,
a[style*="background:var(--teal)"]:active,
a[style*="background: var(--teal)"]:active,
button[style*="background:var(--mint)"]:active,
button[style*="background: var(--mint)"]:active {
  transform: scale(.96);
}
.btn-ghost   { background: none; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { border-color: var(--teal); color: var(--dark); }
.btn-danger  { background: rgba(220,38,38,.08); border: 1px solid rgba(220,38,38,.2); color: var(--red); }
.btn-danger:hover { background: rgba(220,38,38,.15); }
.btn-sm      { padding: 4px 10px; font-size: .72rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── 11. Forms & inputs ─────────────────────────────────────────────── */
.field       { margin-bottom: 14px; }
.field label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 5px; }
.input {
  width: 100%; padding: 9px 12px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--dark); font-family: var(--font-body); font-size: .84rem; outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--teal); }
.inline-input {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 5px;
  color: var(--dark); font-size: .8rem; padding: 3px 7px; width: 100%;
  font-family: monospace; outline: none; transition: border-color .15s;
}
.inline-input:focus { border-color: var(--teal); }

/* ── 12. Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--dark); border: 1px solid rgba(32,194,142,.25);
  color: var(--white); padding: 12px 18px; border-radius: 9px;
  font-size: .8rem; z-index: 200; display: none;
  max-width: 360px; line-height: 1.6; white-space: pre-line;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.toast.show { display: block; }

/* ── 13. Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(26,35,50,.7); z-index: 100;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 32px;
  width: 380px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal h3 { font-size: .95rem; font-weight: 700; margin-bottom: 16px; color: var(--dark); }
.modal-err { font-size: .78rem; color: var(--red); margin-top: 6px; min-height: 1.2em; }

/* ── 14. Prototype toolbar ─────────────────────────────────────────── */
.edit-bar-global {
  display: flex; align-items: center; gap: 8px;
  max-width: 1560px;
  margin: 0 auto;
  padding: var(--space-3) 0;
  background: var(--bg2);
  flex-shrink: 0;
}
.edit-bar-spacer { flex: 1; }
/* Global top-bar context chips: PDL · Puissance · Heures creuses */
/* Contract metadata: inline label/value separated by hairline dividers — no
   pill capsule, no uppercase micro-labels (those read as generated UI). The
   pill radius (999px) was also off the app's 6–14px radius scale.
   See docs/dataviz "credible, not AI-generated". */
.topbar-chips { display: flex; align-items: center; gap: 0; min-width: 0; flex-wrap: wrap; }
.tb-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: .8rem;
  color: var(--dark);
  white-space: nowrap;
}
.tb-chip + .tb-chip { margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--border); }
.tb-chip > span:not(.tb-chip-l) { font-weight: 600; font-variant-numeric: tabular-nums; }
.tb-chip-l { font-size: .8rem; color: var(--muted); font-weight: 400; }
@media (max-width: 768px) { .topbar-chips { display: none; } }
.data-context-control { display: flex; min-width: 0; }
.toolbar-select {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--dark);
  transition: background .15s, border-color .15s, color .15s;
}
.toolbar-select:hover { border-color: rgba(35,60,184,.42); }
.toolbar-select:has(.toolbar-select-input:focus-visible) {
  outline: 2px solid rgba(31,54,166,.45);
  outline-offset: 2px;
}
.toolbar-select-context { width: 300px; }
.toolbar-select-language { width: 136px; }
.toolbar-select-icon { flex: 0 0 16px; font-size: 16px; color: var(--muted); }
.toolbar-select-input {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0 20px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--dark);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.toolbar-select-caret {
  position: absolute;
  right: 12px;
  top: 50%;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
}
.toolbar-select:has(.data-context-select.is-simulated) {
  background: rgba(35,60,184,.06);
  border-color: rgba(35,60,184,.32);
}
.toolbar-select:has(.data-context-select.is-simulated) .toolbar-select-icon,
.toolbar-select:has(.data-context-select.is-simulated) .toolbar-select-input { color: var(--teal); }

/* Pointer users receive no persistent focus ring after a click. Keyboard users
   keep every :focus-visible ring through the shared input-modality marker. */
:root[data-input-modality="pointer"] button:focus-visible,
:root[data-input-modality="pointer"] select:focus-visible { outline: none !important; }
:root[data-input-modality="pointer"] .toolbar-select:has(.toolbar-select-input:focus-visible) { outline: none !important; }
.app-page-footer {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.4;
}
.app-page-footer a { display: inline-flex; align-items: center; min-height: 32px; color: inherit; text-decoration: none; }
.app-page-footer a:hover { color: var(--teal); text-decoration: underline; }
.app-page-footer a:focus-visible { outline: 2px solid rgba(31,54,166,.38); outline-offset: 2px; }
@media (max-width: 420px) {
  .edit-bar-global { gap: 6px; padding-inline: 0; }
}
/* ── 15. Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .burger { display: flex; }

  /* Fix 3: wider sidebar (280px) so it's usable on modern phones */
  .sidebar {
    width: 280px;
    position: fixed; left: -280px; top: 0; height: 100vh; height: 100dvh;
    z-index: 150; transition: left .25s ease;
    overflow: hidden;
    box-shadow: none;
    will-change: left;       /* D: GPU-composited slide animation */
    touch-action: pan-y;     /* F: allow vertical scroll inside sidebar, no tap delay */
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,.15); }
  .sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .sidebar-account { flex: 0 0 auto; margin-top: 0; border-top: 1px solid var(--border); }
  /* display:block so opacity transition works, but pointer-events:none keeps
     the invisible overlay from swallowing touch events when sidebar is closed */
  .overlay { display: block; pointer-events: none; }
  .overlay.visible { pointer-events: auto; }
  .main { padding: 0 var(--space-2) var(--space-2); }
  .page { padding: var(--space-4) 0 var(--space-5); border: 0; border-radius: 0; background: transparent; }
  .toolbar-select-icon { display: none; }
  .page-carte-layout { height: calc(100dvh - 80px); padding: 0; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  #page-reseau .dash-page-heading,
  #page-sim-tarif .dash-page-heading {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  #page-reseau .dash-page-heading > div .dash-source {
    display: block;
    width: 100%;
  }
  #page-reseau .pdl-period-controls,
  #page-sim-tarif .pdl-period-controls { width: 100%; flex-wrap: wrap; }
  #page-reseau .pdl-period-controls .pdl-period-tabs,
  #page-sim-tarif .pdl-period-controls .pdl-period-tabs { width: 100%; }
  #page-reseau .pdl-period-controls .range-btn,
  #page-sim-tarif .pdl-period-controls .range-btn { flex: 1; }
  #page-reseau .reseau-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  #page-reseau .reseau-kpi-card { min-height: 96px; padding-inline: var(--space-3); }
  #page-reseau .summary-metric__value { font-size: 1.15rem; }
  #page-reseau .reseau-chart-card { padding-inline: var(--space-3); }
  #page-reseau .reseau-main { gap: var(--space-5); }
  .fi-grid { grid-template-columns: 1fr 1fr; }
  .score-grid { grid-template-columns: 1fr 1fr; }
  .cw-lg { height: 288px; }
  .cw    { height: 252px; }
  .cw-sm { height: 180px; }
  .savings-box { flex-direction: column; gap: 12px; }
  .sav-div { display: none; }
  .pdl-strip { flex-direction: column; gap: 10px; }
  .pdl-info  { flex-wrap: wrap; gap: 10px; }
  .pdl-period-tabs,
  .pdl-metric-tabs { width: 100%; overflow-x: auto; }
  .pdl-period-tabs .range-btn,
  .pdl-metric-tabs .cdc-tab { flex: 1; min-width: max-content; }
  .pdl-card-head { flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .pdl-card-head .stitle { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: .96rem; }
  .pdl-card-actions { width: 100%; justify-content: flex-start; }

  .pdl-main-chart { height: auto !important; min-height: 0; aspect-ratio: 4 / 3; }
  .utoscore-main { flex-direction: column; align-items: flex-start; gap: 14px; }
  .utoscore-dial { width: 80px; height: 80px; }
  .utoscore-dial svg { width: 80px; height: 80px; }

  .edit-bar-global { padding: 8px 48px 8px 0; }
  .edit-bar-spacer { display: none; }
  .data-context-control { flex: 2 1 0; min-width: 0; }
  .toolbar-select-language { flex: 1 1 0; min-width: 0; }
  .toolbar-select-context,
  .toolbar-select-language { width: 100%; }
  .app-page-footer { flex-wrap: wrap; gap: 4px 18px; margin-top: var(--space-5); }

  .mode-toggle { flex-wrap: wrap; }
  table { font-size: .7rem; }
  .pm-table th, .pm-table td { padding: 5px 6px; }

  /* Fix 6: tables scroll horizontally rather than overflowing the card */
  .pm-table, .method-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}
@media (max-width: 420px) {
  .fi-grid, .score-grid { grid-template-columns: 1fr; }
  .g2 { grid-template-columns: 1fr; }
  .range-btn { padding: 3px 8px; font-size: .68rem; }
}

/* ── Forecast 3-day tabs ──────────────────────────────────────── */
.ftab {
  font-size: .72rem; font-weight: 600; padding: 5px 12px;
  border-radius: 7px; border: 1px solid rgba(148,163,184,.3);
  background: transparent; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
  font-family: inherit;
}
.ftab-active {
  background: rgba(32,194,142,.15); color: var(--mint);
  border-color: rgba(32,194,142,.45);
}
.forecast-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
}
/* Forecast card internals */
.fc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; flex-wrap: wrap; }
.fc-date   { font-weight: 700; font-size: .85rem; text-transform: capitalize; }
.fc-badge  { font-size: .68rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; letter-spacing: .02em; }
.fc-meteo  { font-size: .8rem; color: var(--muted); margin-bottom: 12px; }
.fc-rows   { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.fc-row    { display: flex; align-items: center; gap: 8px; }
.fc-time   { font-size: .7rem; color: var(--muted); min-width: 66px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.fc-pills  { display: flex; gap: 5px; flex-wrap: wrap; }
.fc-pill   { font-size: .7rem; padding: 4px 11px; border-radius: 20px; font-weight: 600; letter-spacing: .01em; }
.fc-pill-bas    { background: #d1fae5; color: #065f46; }
.fc-pill-modere { background: #fef3c7; color: #92400e; }
.fc-pill-eleve  { background: #fee2e2; color: #991b1b; }
.fc-range  { font-size: .72rem; color: var(--muted); margin-bottom: 4px; }
.fc-resume { font-size: .75rem; color: var(--muted); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); line-height: 1.5; }
/* Card border accent per confiance */
.forecast-card[data-conf="reel"]         { border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.forecast-card[data-conf="estime"]       { border-color: rgba(251,191,36,.6); }
.forecast-card[data-conf="approximatif"] { border-color: color-mix(in srgb, var(--red) 40%, transparent); }
@media (max-width: 380px) {
  .ftab { padding: 4px 8px; font-size: .68rem; }
}

/* ── Dashboard mobile dédié (#page-mobile) ─────────────────────────── */
#page-mobile { max-width: 560px; margin: 0 auto; padding-bottom: var(--space-6); }
.m-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.m-greet  { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; color: var(--dark); line-height: 1.1; }
.m-date   { font-size: .72rem; color: var(--muted); margin-top: 3px; text-transform: capitalize; }
.m-grade  { display: flex; align-items: baseline; gap: 6px; flex-shrink: 0; }
.m-grade-badge { padding: 4px 12px; border-radius: 8px; font-weight: 800; font-size: 1.1rem; line-height: 1; }
.m-grade-pct   { font-size: .72rem; font-weight: 700; color: var(--muted); }

.m-sec-label { font-size: .68rem; font-weight: 700; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; margin: 18px 0 8px; }

.m-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.m-score-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.m-score-val { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--dark); font-variant-numeric: tabular-nums; }
.m-score-val small { font-size: .65em; font-weight: 600; color: var(--muted); }

/* Maintenant hero */
.m-now { border-width: 2px; }
.m-now-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.m-now-emoji { font-size: 1.5rem; line-height: 1; }
.m-now-title { font-size: .9rem; font-weight: 700; color: var(--dark); }
.m-now-sub   { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.m-now-price { margin-left: auto; text-align: right; flex-shrink: 0; }
.m-now-price b { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.m-now-price span { display: block; font-size: .6rem; color: var(--muted); font-weight: 600; }
.m-now-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.m-chip { font-size: .68rem; font-weight: 600; padding: 4px 10px; border-radius: 20px; background: var(--bg2); color: var(--muteddk); display: inline-flex; align-items: center; gap: 5px; }
.m-chip-green { background: #d1fae5; color: #065f46; }
.m-now-synth { font-size: .73rem; color: var(--muteddk); margin-top: 10px; line-height: 1.5; }

/* Appliance rows */
.m-appliances { display: flex; flex-direction: column; gap: 8px; }
.m-appl { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 11px 14px; box-shadow: var(--shadow-sm); }
.m-appl-best { border-color: rgba(32,194,142,.55); background: linear-gradient(135deg,rgba(32,194,142,.10),rgba(35,60,184,.05)); }
.m-appl-icon { font-size: 1.35rem; line-height: 1; flex-shrink: 0; }
.m-appl-body { flex: 1; min-width: 0; }
.m-appl-name { font-size: .82rem; font-weight: 700; color: var(--dark); }
.m-appl-slot { font-size: .72rem; color: var(--muted); margin-top: 1px; }
.m-appl-price { text-align: right; flex-shrink: 0; }
.m-appl-price b { font-size: .95rem; font-weight: 800; color: var(--teal); }
.m-appl-price span { display: block; font-size: .58rem; color: var(--muted); }
.m-appl-badge { font-size: .56rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mint2); }

/* 3-day forecast (mobile) */
.m-ftabs { display: flex; gap: 4px; margin-bottom: 10px; }
.m-today-bar { display: flex; gap: 1px; height: 26px; border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.m-today-seg { flex: 1; }
.m-today-cap { display: flex; justify-content: space-between; font-size: .58rem; color: var(--muted); margin: -6px 2px 12px; }

/* Confort thermique */
.m-thermal { display: flex; flex-direction: column; gap: 8px; }
.m-therm { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 11px 14px; box-shadow: var(--shadow-sm); }
.m-therm-icon { font-size: 1.3rem; line-height: 1; flex-shrink: 0; }
.m-therm-body { flex: 1; min-width: 0; }
.m-therm-day  { font-size: .72rem; color: var(--muted); }
.m-therm-rec  { font-size: .82rem; font-weight: 700; color: var(--dark); margin-top: 1px; }
.m-therm-hrs  { font-size: .72rem; color: var(--teal); flex-shrink: 0; text-align: right; font-weight: 600; }

/* Energy source */
.m-source-head { font-size: 1.05rem; font-weight: 800; color: var(--green); margin-bottom: 8px; letter-spacing: -0.01em; }
.m-source-rows { display: flex; flex-direction: column; gap: 6px; }
.m-source-row { display: flex; align-items: center; gap: 8px; font-size: .74rem; color: var(--muteddk); }
.m-source-row .lbl { min-width: 92px; }
.m-source-bar { flex: 1; height: 7px; border-radius: 4px; background: var(--bg2); overflow: hidden; }
.m-source-fill { height: 100%; border-radius: 4px; }
.m-source-val { min-width: 38px; text-align: right; font-weight: 700; color: var(--dark); }

/* Footer */
.m-footer { margin-top: 20px; }
.m-footlink { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: .78rem; color: var(--muted); text-decoration: none; }
.m-footlink-main { font-weight: 700; color: var(--teal); margin-bottom: 12px; }
.m-footrow { display: flex; gap: 10px; }
.m-footrow .m-footlink { flex: 1; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; background: var(--card); }

/* Mobile dashboard recent polish (aligned with PDL story / card treatment) */
.m-recent-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.m-stat-val { font-size: 1.35rem; font-weight: 700; line-height: 1; color: var(--dark); font-variant-numeric: tabular-nums; }
.m-stat-val small { font-size: .6em; font-weight: 600; color: var(--muted); }
.m-stat-lbl { display: block; font-size: .68rem; color: var(--muted); margin-top: 2px; }

.m-empty { font-size: .8rem; color: var(--muted); padding: 6px 2px; }

/* ══ Tableau de bord (#page-accueil) ════════════════════════════════════ */
/* Hiérarchie : Énergie-score + Conseil du jour co-primaires, puis conso     */
/* récente / demain, puis détail du score.                                   */

.dash-primary,
.dash-secondary {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.dash-page-heading { margin: 0 0 var(--space-5); }
#page-reseau .dash-page-heading,
#page-sim-tarif .dash-page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: var(--space-5);
}
#page-reseau .dash-page-heading > div,
#page-sim-tarif .dash-page-heading > div {
  min-width: 0;
}
#page-reseau .dash-page-heading > div .dash-source {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}
#page-reseau .reseau-title-row { display: inline-flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
#page-reseau .reseau-stale-badge {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: default;
}
#page-reseau .reseau-stale-badge[hidden] { display: none; }
#page-reseau .pdl-card-head .pdl-help {
  margin-left: 6px;
}
/* Même style que le titre de la page Consommation (.pdl-hero h2). */
.dash-page-heading h1 { margin: 0; font-family: var(--font-body); color: var(--pdl-text); font-size: 1.9rem; line-height: 1.08; font-weight: 500; letter-spacing: 0; }

/* Composant carte partagé — calé sur les panneaux Consommation (bordure,
   pas d'ombre, 16px radius, 24px padding). Réutiliser pour toute carte
   produit afin de garder un style cohérent (cf. design.md). */
.card-panel {
  background: var(--card);
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 16px;
  padding: var(--space-4) var(--space-5) var(--space-5);
}
.dash-card { display: flex; flex-direction: column; }

/* En-tête de carte : hauteur constante pour que l'icône+titre et l'élément de
   droite (bouton 32px OU texte) partagent le même axe vertical dans toutes
   les cartes. */
.dash-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2); min-height: 32px; margin-bottom: var(--space-4);
}
.dash-eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 600; color: var(--dark); }
.dash-eyebrow i { font-size: 1rem; color: var(--muted); }
.dash-source { font-size: 12px; color: var(--muted); text-align: right; }
#page-reseau .dash-page-heading .dash-source { text-align: left; }
.dash-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: var(--space-2); }
.dash-note a { color: var(--teal); text-decoration: none; }
.dash-note a:hover { text-decoration: underline; }
.dash-note-empty { display: inline-flex; align-items: center; gap: 6px; color: var(--amber); }

/* Échange d'icône contextuel (opacité + échelle + flou) au re-render du conseil. */
@keyframes dashIconIn { from { opacity: 0; transform: scale(.7); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }

.dash-icon-btn {
  width: 32px; height: 32px; flex-shrink: 0; display: inline-flex;
  align-items: center; justify-content: center; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.dash-icon-btn:hover { border-color: var(--teal); color: var(--teal); background: rgba(31,54,166,.06); }
.dash-icon-btn:active { transform: scale(.96); }
.dash-icon-btn:focus-visible { outline: 2px solid rgba(31,54,166,.45); outline-offset: 2px; }

.dash-grade-scale { display: flex; justify-content: space-between; gap: var(--space-3); }
.dash-grade {
  flex: 1 1 0; max-width: 64px; aspect-ratio: 1 / 1; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 16px; font-weight: 800; font-size: 1.15rem; color: #fff;
  text-shadow: 0 1px 6px rgba(15,23,42,.18);
  transition: transform .25s cubic-bezier(.2,0,0,1);
}
.dash-grade-a { background: linear-gradient(0deg, var(--score-grade-a-top), var(--score-grade-a)); }
.dash-grade-b { background: linear-gradient(0deg, var(--score-grade-b-top), var(--score-grade-b)); }
.dash-grade-c { background: linear-gradient(0deg, var(--score-grade-c-top), var(--score-grade-c)); }
.dash-grade-d { background: linear-gradient(0deg, var(--score-grade-d-top), var(--score-grade-d)); }
.dash-grade-e { background: linear-gradient(0deg, var(--score-grade-e-top), var(--score-grade-e)); }
.dash-grade.is-active { transform: scale(1.14); }
.dash-grade:not(.is-active) { font-size: 0.95rem; }

/* — Énergie-score : lecture + leviers dans un même bloc — */
.dash-score-content { display: flex; flex: 1; flex-direction: column; gap: var(--space-4); }
.dash-score-reading { display: flex; align-items: center; gap: var(--space-3); }
.dash-score-reading .dash-grade-scale { width: 100%; flex: 1; align-items: center; gap: var(--space-3); }
.dash-score-reading .dash-grade { flex: 1 1 0; max-width: none; height: var(--space-7); aspect-ratio: auto; border-radius: var(--radius-lg); font-size: 1.5rem; transition: flex .25s cubic-bezier(.2,0,0,1), height .25s cubic-bezier(.2,0,0,1); }
.dash-score-reading .dash-grade.is-active { flex: 1.4 1 0; height: calc(var(--space-8) + var(--space-5)); transform: none; }
.dash-score-reading .dash-grade:not(.is-active) { font-size: 1.05rem; }
.dash-score-status { margin: 0; color: var(--dark); font-size: 1.15rem; font-weight: 600; line-height: 1.2; }
.dash-score-explainer { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.dash-score-explainer:empty { display: none; }
.dash-score-lever-callout { margin-top: var(--space-4); background: rgba(35,60,184,.055); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); }
.dash-score-lever { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; color: var(--pdl-text-soft); font-size: .9rem; line-height: 1.45; text-wrap: pretty; }
.dash-score-lever strong { color: var(--dark); font-weight: 600; }
.dash-score-factors { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.dash-score-factor-head { color: var(--muteddk); font-size: 13px; font-weight: 500; margin-bottom: var(--space-2); }
.dash-score-segments { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: var(--space-1); margin-bottom: var(--space-2); }
/* 20-segment bars for both factors ("Consommer au bon prix" and "Électricité plus propre").
   Use the 9-step scale (via --e, --e-d ... --a classes generated per index) for smooth left-to-right color transition.
   Each active segment uses the same vertical gradient style as the Énergie-score tiles:
   slightly darker top (for subtle contrast/visibility) over the canonical bright at bottom.
   Unfilled: neutral gray gradient. */
.dash-score-segment { height: var(--space-6); border-radius: var(--space-1); background: linear-gradient(180deg, var(--mutedlt), var(--border2)); }
.dash-score-segment.is-active.dash-score-segment--e { background: linear-gradient(0deg, var(--score-grade-e-top), var(--score-grade-e)); }
.dash-score-segment.is-active.dash-score-segment--e-d { background: linear-gradient(0deg, var(--score-grade-e-d-top), var(--score-grade-e-d)); }
.dash-score-segment.is-active.dash-score-segment--d { background: linear-gradient(0deg, var(--score-grade-d-top), var(--score-grade-d)); }
.dash-score-segment.is-active.dash-score-segment--d-c { background: linear-gradient(0deg, var(--score-grade-d-c-top), var(--score-grade-d-c)); }
.dash-score-segment.is-active.dash-score-segment--c { background: linear-gradient(0deg, var(--score-grade-c-top), var(--score-grade-c)); }
.dash-score-segment.is-active.dash-score-segment--c-b { background: linear-gradient(0deg, var(--score-grade-c-b-top), var(--score-grade-c-b)); }
.dash-score-segment.is-active.dash-score-segment--b { background: linear-gradient(0deg, var(--score-grade-b-top), var(--score-grade-b)); }
.dash-score-segment.is-active.dash-score-segment--b-a { background: linear-gradient(0deg, var(--score-grade-b-a-top), var(--score-grade-b-a)); }
.dash-score-segment.is-active.dash-score-segment--a { background: linear-gradient(0deg, var(--score-grade-a-top), var(--score-grade-a)); }
.dash-score-factor-desc { margin-top: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.dash-score-factor-scale { display: flex; flex-wrap: wrap; margin-top: var(--space-2); }

/* — Conseil du jour : timeline de prix (réf. Sobry / Tibber) — */
/* Onglets Aujourd'hui / Demain */
.dash-tabs { display: inline-flex; background: var(--bg2); border-radius: 9px; padding: 3px; }
.dash-tab { font-size: .76rem; font-weight: 500; padding: 5px 12px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-family: inherit; transition: background .15s, color .15s; }
.dash-tab.is-active { background: var(--card); color: var(--dark); box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.dash-tab:focus-visible { outline: 2px solid rgba(31,54,166,.45); outline-offset: 2px; }
/* Verdict (action) : icône colorée par niveau (modéré = gris). */
.dash-adv-verdict { display: flex; align-items: center; gap: var(--space-2); font-size: 1.3rem; font-weight: 600; color: var(--dark); margin-bottom: var(--space-3); }
.dash-adv-verdict i { font-size: 1.3rem; color: var(--muted); animation: dashIconIn .25s cubic-bezier(.2,0,0,1) both; }
.dash-adv-verdict.is-bas i    { color: var(--green); }
.dash-adv-verdict.is-modere i { color: var(--muted); }
.dash-adv-verdict.is-eleve i  { color: var(--red); }
.dash-adv-sub { font-size: .78rem; color: var(--muted); margin: 0 0 var(--space-3); }
/* Résumé quotidien, puis tuiles de prévision pour Demain. */
/* Hauteur réservée (~6 lignes) pour que la carte Conseil ne saute pas entre
   Aujourd'hui (texte court) et Demain (texte plus long). */
.dash-adv-day-summary { margin: 0; max-width: 52ch; color: var(--muteddk); font-size: .9rem; line-height: 1.5; min-height: 8.1rem; }
.dash-adv-stats { display: flex; gap: var(--space-2); margin-bottom: var(--space-4); }
.dash-adv-tile { flex: 1; background: var(--bg2); border-radius: var(--radius-md); padding: var(--space-3) var(--space-3); }
.dash-adv-tile-lbl { font-size: 12px; color: var(--muted); margin-bottom: var(--space-1); }
.dash-adv-tile-val { font-size: 1.2rem; font-weight: 600; color: var(--dark); font-variant-numeric: tabular-nums; }
.dash-adv-tile-val small { font-size: .66rem; font-weight: 500; color: var(--muted); margin-left: 3px; }
.dash-adv-tile.is-bas { background: color-mix(in srgb, var(--green) 8%, transparent); }
.dash-adv-tile.is-eleve { background: color-mix(in srgb, var(--red) 8%, transparent); }
.dash-adv-tile.is-bas .dash-adv-tile-lbl,
.dash-adv-tile.is-bas .dash-adv-tile-val,
.dash-adv-tile.is-bas .dash-adv-tile-val small { color: var(--green); }
.dash-adv-tile.is-eleve .dash-adv-tile-lbl,
.dash-adv-tile.is-eleve .dash-adv-tile-val,
.dash-adv-tile.is-eleve .dash-adv-tile-val small { color: var(--red); }
/* Graphe prix horaire */
.dash-adv-chart { position: relative; }
.dash-adv-bars { display: flex; align-items: flex-end; gap: var(--space-1); height: 92px; }
.dash-adv-bar { flex: 1; min-height: 4px; border-radius: 3px 3px 0 0; }
/* Heure courante : pas de fond, la barre garde sa couleur de prix et pulse via un
   léger fondu d'opacité par-dessus. */
@keyframes dashBarPulse { 0%, 100% { opacity: 0; } 50% { opacity: .85; } }
.dash-adv-bar-now { position: relative; }
.dash-adv-bar-now::after { content: ''; position: absolute; inset: 0; border-radius: 3px 3px 0 0; background: var(--bg2); opacity: 0; animation: dashBarPulse 1.3s ease-in-out infinite; }
.dash-adv-hours { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: var(--space-1); }
/* Variante grossière (Demain : 4 créneaux) */
.dash-adv-blocks { display: flex; align-items: flex-end; gap: var(--space-2); height: 92px; }
.dash-adv-bblock { flex: 1; min-height: 6px; border-radius: 6px 6px 0 0; }
.dash-adv-blabels { display: flex; gap: var(--space-2); margin-top: var(--space-1); }
.dash-adv-blabels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
/* Légende sous le graphe (clé des couleurs), puis pied : astuce + CO2 discret. */
.dash-adv-legend-row { display: flex; justify-content: flex-end; margin-top: var(--space-2); }
.dash-adv-legend { display: inline-flex; gap: var(--space-2); }
.dash-adv-key { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 11px; color: var(--muted); }
.dash-adv-key i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.dash-adv-foot2 { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid rgba(148,163,184,.22); }

.dash-advice-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.dash-adv-tip-txt { font-size: .8rem; color: var(--muteddk); }
.dash-adv-actions { display: flex; align-items: center; flex: 1 1 auto; flex-wrap: wrap; gap: var(--space-2); min-width: 0; }
.dash-adv-actions-label { color: var(--muteddk); font-size: 12px; font-weight: 600; margin-right: 2px; }
.dash-adv-action { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-2); border: 1px solid rgba(32,194,142,.24); border-radius: var(--radius-sm); background: rgba(32,194,142,.08); color: var(--muteddk); font-size: 12px; line-height: 1.2; white-space: nowrap; }
.dash-adv-action i { color: var(--green); font-size: 14px; }
.dash-adv-action strong { color: var(--green); font-weight: 600; }
.dash-adv-fallback { color: var(--muteddk); font-size: .8rem; }

/* — Consommation récente (cliquable) — */
.dash-clickable { cursor: pointer; text-decoration: none; transition: border-color .15s; }
.dash-clickable:hover { border-color: var(--teal); }
.dash-clickable:focus-visible { outline: 2px solid rgba(31,54,166,.45); outline-offset: 2px; }
.dash-link-cue { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--teal); }
.dash-link-cue i { font-size: .9rem; transition: transform .15s; }
.dash-clickable:hover .dash-link-cue i,
.dash-drivers .dash-link-cue:hover i { transform: translateX(3px); }
.dash-recent-chart { position: relative; width: 100%; height: 304px; margin: var(--space-4) 0 0; }
.dash-recent-chart-state { display: flex; align-items: center; justify-content: center; }
.dash-recent-chart-state .dash-note { margin: 0; }
.dash-recent-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-3); color: var(--muted); font-size: 12px; }
.dash-recent-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dash-recent-key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.dash-recent-key--context { background: linear-gradient(180deg, #233CB8, #6D82FF); }
.dash-recent-key--latest { background: linear-gradient(180deg, #6D82FF, #233CB8); }
.dash-recent-key--hc { background: rgba(226,232,240,.85); }
.dash-recent-key--spot { width: 14px; height: 2px; border-radius: 0; background: linear-gradient(90deg, var(--score-grade-a), var(--score-grade-b), var(--score-grade-c), var(--score-grade-d), var(--score-grade-e)); }
.dash-recent-key--scale { width: 28px; height: 8px; border-radius: 2px; background: linear-gradient(90deg, var(--score-grade-a), var(--score-grade-b), var(--score-grade-c), var(--score-grade-d), var(--score-grade-e)); }
.dash-recent-key--none { background: linear-gradient(180deg, var(--mutedlt), var(--border2)); }
.dash-spark-row { display: flex; align-items: flex-end; gap: 4px; height: 40px; margin-top: var(--space-3); }
.dash-spark { flex: 1; min-height: 3px; background: linear-gradient(180deg, var(--mint), #5EE0C0); border-radius: 3px 3px 0 0; }
@media (max-width: 768px) {
  .dash-spark-row { height: 32px; gap: 3px; }
  .dash-spark { border-radius: 2px 2px 0 0; min-height: 2px; }
}
.dash-spark-days { display: flex; gap: 4px; margin-top: 6px; }
.dash-spark-days span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Demo-only reference. It intentionally does not share existing .btn styles. */
.components-reference {
  display: grid;
  gap: var(--space-4);
  max-width: 720px;
}
.components-reference-size {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
}
.components-reference-size-label { color: var(--muted); font-size: .82rem; line-height: 1.2; }
.components-reference-size-label span { display: block; margin-top: 2px; font-size: .72rem; }
.components-reference-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.components-reference-size--sm { --ref-height: var(--space-6); --ref-gap: var(--space-1); --ref-padding: 10px; --ref-radius: 8px; --ref-font-size: .875rem; --ref-eye-width: 18px; --ref-eye-height: 12px; --ref-check-size: 16px; --ref-eye-stroke: 1.75px; --ref-check-stroke: 2.25px; --ref-label-offset: -.25px; }
.components-reference-size--md { --ref-height: var(--space-7); --ref-gap: var(--space-1); --ref-padding: var(--space-3); --ref-radius: 10px; --ref-font-size: 1rem; --ref-eye-width: 22px; --ref-eye-height: 15px; --ref-check-size: 20px; --ref-eye-stroke: 2px; --ref-check-stroke: 2.5px; --ref-label-offset: -.5px; }
.components-reference-size--lg { --ref-height: var(--space-8); --ref-gap: var(--space-2); --ref-padding: var(--space-4); --ref-radius: 12px; --ref-font-size: 1.25rem; --ref-eye-width: 26px; --ref-eye-height: 18px; --ref-check-size: 24px; --ref-eye-stroke: 2.25px; --ref-check-stroke: 2.75px; --ref-label-offset: -.5px; }
.components-reference-button {
  height: var(--ref-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ref-gap);
  padding: 0 var(--ref-padding);
  border-radius: var(--ref-radius);
  font-family: var(--font-body);
  font-size: var(--ref-font-size);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.045em;
}
.components-reference-button--preview {
  background: var(--card);
  border: 1px solid var(--border2);
  box-shadow: var(--shadow-sm);
  color: var(--dark);
}
.components-reference-button--deploy {
  background: var(--teal);
  border: 1px solid rgba(255,255,255,.26);
  box-shadow: 0 0 0 1px var(--teal), 0 2px 4px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.16), inset 0 2px 42px rgba(255,255,255,.16), inset 0 1px 0 rgba(255,255,255,.26);
  color: var(--white);
}
.components-reference-eye {
  width: var(--ref-eye-width);
  height: var(--ref-eye-height);
  flex: 0 0 auto;
  color: var(--muted);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: var(--ref-eye-stroke);
}
.components-reference-check {
  width: var(--ref-check-size);
  height: var(--ref-check-size);
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: var(--ref-check-stroke);
}
.components-reference-button-label { display: inline-block; transform: translateY(var(--ref-label-offset)); }

@media (max-width: 580px) {
  .components-reference-size { grid-template-columns: 1fr; gap: var(--space-2); }
}

.dash-driver-track { height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.dash-driver-fill { height: 6px; background: var(--teal); border-radius: 3px; transition: width 1s ease; }

@media (max-width: 768px) {
  .dash-primary, .dash-secondary { grid-template-columns: 1fr; gap: var(--space-4); }
  .dash-page-heading h1 { font-size: 1.55rem; }
  .dash-card-head { min-height: 28px; margin-bottom: var(--space-3); }
  .dash-score-reading .dash-grade { height: 52px; font-size: 1.3rem; }
  .dash-score-factors { grid-template-columns: 1fr; gap: var(--space-2); }
  .dash-score-segment { height: 18px; }
  .dash-recent-chart { height: 208px; }
}
@media (max-width: 420px) {
  .dash-grade-scale { gap: 6px; }
  .dash-score-reading .dash-grade { height: 46px; font-size: 1.15rem; }
  .m-score-val { font-size: 1.7rem; }
  .m-greet { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .dash-adv-verdict i, .m-advice-status i, .m-window i, .m-co2 i, .dash-adv-bar-now::after { animation: none; }
  .dash-driver-fill, .dash-link-cue i, .dash-grade { transition: none; }
}

/* — Compléments tableau de bord mobile (#page-mobile) — */
.m-eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 600; color: var(--dark); }
.m-eyebrow i { color: var(--muted); font-size: 1rem; }
.m-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.m-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 8px; }

.m-score-row { display: flex; align-items: center; gap: 14px; }
.m-score-val { font-size: 2rem; font-weight: 700; color: var(--dark); line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.m-score-val small { font-size: .9rem; font-weight: 600; color: var(--muted); }

.m-advice-status { display: flex; align-items: center; gap: 8px; font-size: .92rem; font-weight: 600; color: var(--dark); }
.m-advice-status i, .m-window i, .m-co2 i { font-size: 1.1rem; animation: dashIconIn .25s cubic-bezier(.2,0,0,1) both; }
.m-advice-status.is-bas i    { color: var(--green); }
.m-advice-status.is-modere i { color: var(--muted); }
.m-advice-status.is-eleve i  { color: var(--red); }
.m-price-now { margin-left: auto; font-size: 1.15rem; font-weight: 700; color: var(--dark); font-variant-numeric: tabular-nums; }
.m-price-now small { font-size: .62rem; font-weight: 600; color: var(--muted); margin-left: 2px; }
.m-window { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: var(--radius-md); padding: 9px 11px; font-size: .82rem; color: var(--dark); margin-top: 10px; }
.m-window i { color: var(--teal); flex-shrink: 0; }
.m-window-price { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.m-advice-tip { font-size: .82rem; color: var(--muteddk); line-height: 1.45; margin-top: 10px; }
.m-co2 { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--green); font-weight: 500; margin-top: 10px; }

.m-recent { display: block; text-decoration: none; cursor: pointer; }
.m-recent:focus-visible { outline: 2px solid rgba(31,54,166,.45); outline-offset: 2px; }
.m-recent-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.m-stat { display: flex; flex-direction: column; gap: 2px; }
.m-stat-val { font-size: 1.3rem; font-weight: 600; color: var(--dark); line-height: 1; font-variant-numeric: tabular-nums; }
.m-stat-val small { font-size: .68rem; font-weight: 500; color: var(--muted); }
.m-stat-lbl { font-size: 12px; color: var(--muted); }

.m-drivers { display: flex; flex-direction: column; gap: 12px; }
.m-driver-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muteddk); }
.m-driver-val { font-weight: 700; color: var(--dark); font-variant-numeric: tabular-nums; }
.m-driver .dash-driver-track { margin-top: 6px; }
.m-driver-desc { font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 5px; }
