/* Énergie — tableau de bord. Inspiré des apps Apple (Santé, Maison, Météo). Mobile d'abord, large sur ordinateur. */
:root {
  color-scheme: dark light;
  --bg: #000;
  --bg-2: #0b0b0d;
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --card-3: #3a3a3c;
  --fill: rgba(120, 120, 128, .24);
  --fill-2: rgba(120, 120, 128, .16);
  --sep: rgba(84, 84, 88, .55);
  --label: #fff;
  --label-2: rgba(235, 235, 245, .64);
  --label-3: rgba(235, 235, 245, .34);
  --label-4: rgba(235, 235, 245, .16);
  --accent: #0a84ff;
  --elec: #ffd60a;
  --elec-2: rgba(255, 214, 10, .42);
  --elec-ink: #1c1600;
  --gas: #ff9f0a;
  --gas-2: rgba(255, 159, 10, .42);
  --money: #30d158;
  --temp: #64d2ff;
  --up: #ff6961;
  --down: #30d158;
  --ghost: rgba(235, 235, 245, .13);
  --blue: #0a84ff; --white: #f2f2f7; --red: #ff453a;
  --blue-soft: rgba(10, 132, 255, .2); --white-soft: rgba(242, 242, 247, .16); --red-soft: rgba(255, 69, 58, .22);
  --white-ink: #111; --white-line: transparent;
  --radius: 22px;
  --radius-s: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabbar-h: 58px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f2f7; --bg-2: #e9e9ee; --card: #fff; --card-2: #f2f2f7; --card-3: #e5e5ea;
    --fill: rgba(120, 120, 128, .2); --fill-2: rgba(120, 120, 128, .12);
    --sep: rgba(60, 60, 67, .2);
    --label: #000; --label-2: rgba(60, 60, 67, .62); --label-3: rgba(60, 60, 67, .32); --label-4: rgba(60, 60, 67, .14);
    --accent: #007aff;
    --elec: #ffc400; --elec-2: rgba(255, 196, 0, .42); --elec-ink: #3a2c00;
    --gas: #ff9500; --gas-2: rgba(255, 149, 0, .4);
    --money: #28b14c; --temp: #1fa4dc;
    --up: #e5443a; --down: #23a846;
    --ghost: rgba(60, 60, 67, .12);
    --blue: #007aff; --white: #fff; --red: #ff3b30;
    --blue-soft: rgba(0, 122, 255, .14); --white-soft: rgba(60, 60, 67, .08); --red-soft: rgba(255, 59, 48, .14);
    --white-line: rgba(60, 60, 67, .3);
  }
}
:root[data-theme="light"] {
  --bg: #f2f2f7; --bg-2: #e9e9ee; --card: #fff; --card-2: #f2f2f7; --card-3: #e5e5ea;
  --fill: rgba(120, 120, 128, .2); --fill-2: rgba(120, 120, 128, .12); --sep: rgba(60, 60, 67, .2);
  --label: #000; --label-2: rgba(60, 60, 67, .62); --label-3: rgba(60, 60, 67, .32); --label-4: rgba(60, 60, 67, .14);
  --accent: #007aff; --elec: #ffc400; --elec-2: rgba(255, 196, 0, .42); --elec-ink: #3a2c00; --gas: #ff9500; --gas-2: rgba(255, 149, 0, .4);
  --money: #28b14c; --temp: #1fa4dc; --up: #e5443a; --down: #23a846; --ghost: rgba(60, 60, 67, .12);
  --blue: #007aff; --white: #fff; --red: #ff3b30; --blue-soft: rgba(0, 122, 255, .14); --white-soft: rgba(60, 60, 67, .08); --red-soft: rgba(255, 59, 48, .14); --white-line: rgba(60, 60, 67, .3);
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--label);
  font-family: var(--font); font-size: 17px; line-height: 1.35; letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.tab-num { font-variant-numeric: tabular-nums; }

/* ——— Structure ——— */
.shell { min-height: 100dvh; }
.main { padding: calc(var(--safe-t) + 8px) 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); max-width: 1320px; margin: 0 auto; }
.sidebar { display: none; }
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 264px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100dvh; padding: 22px 12px;
    background: var(--bg-2); border-right: 1px solid var(--sep);
  }
  .main { padding: 26px 36px 48px; width: 100%; }
  .tabbar { display: none !important; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(160deg, #ffd60a, #ff9f0a); color: #2a1a00; }
.brand .logo svg { width: 19px; height: 19px; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--label); font-size: 16px; font-weight: 500; }
.side-link svg { width: 22px; height: 22px; stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-link:hover { background: var(--fill-2); }
.side-link[aria-current="page"] { background: var(--accent); color: #fff; }
.side-link[aria-current="page"] svg { stroke: #fff; }
.side-sep { height: 1px; background: var(--sep); margin: 12px 10px; }
.side-foot { margin-top: auto; padding: 10px 12px; font-size: 13px; color: var(--label-3); }

/* Barre d'onglets (mobile, tablette) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(var(--safe-b) + 4px); background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px); border-top: .5px solid var(--sep);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--label-3); font-size: 10.5px; font-weight: 500; padding: 2px 0; }
.tabbar svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--accent); }

/* ——— En-têtes ——— */
.large-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 10px 4px 14px; }
.large-title h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.025em; }
.large-title .sub { color: var(--label-2); font-size: 15px; margin-top: 4px; font-weight: 500; }
.large-title .eyebrow { color: var(--label-2); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.hdr-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 4px 10px; }
.section-h h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.section-h .aside { font-size: 15px; }

/* ——— Grilles ——— */
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid.g2, .grid.g3 { grid-template-columns: 1fr 1fr; } .span2 { grid-column: span 2; } }
@media (min-width: 1180px) { .grid.g3 { grid-template-columns: repeat(3, 1fr); } .span3 { grid-column: span 3; } }
@media (min-width: 700px) and (max-width: 1179px) { .span3 { grid-column: span 2; } }

/* ——— Cartes ——— */
.card { background: var(--card); border-radius: var(--radius); padding: 16px 16px 14px; position: relative; min-width: 0; }
.card.tight { padding: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-t { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.card-t .ic { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; }
.card-t .ic svg { width: 14px; height: 14px; fill: currentColor; }
.ic.elec { background: var(--elec); color: var(--elec-ink); }
.ic.gas { background: var(--gas); color: #2a1300; }
.ic.money { background: var(--money); color: #062b10; }
.ic.temp { background: var(--temp); color: #00202e; }
.ic.tempo { background: linear-gradient(120deg, var(--blue) 0 33%, #e5e5ea 33% 66%, var(--red) 66%); }
.card-t.elec { color: var(--elec); } .card-t.gas { color: var(--gas); } .card-t.money { color: var(--money); } .card-t.temp { color: var(--temp); }
.card-h .when { color: var(--label-2); font-size: 14px; white-space: nowrap; }
a.card { color: inherit; display: block; }
a.card .chev, .chev { color: var(--label-3); font-size: 18px; margin-left: 2px; }
.card .foot { color: var(--label-2); font-size: 13px; margin-top: 8px; }
.card p { margin: 6px 0; color: var(--label-2); font-size: 15px; }

/* Grand chiffre */
.metric { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-family: var(--font-round); }
.metric .v { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.metric .u { font-size: 17px; font-weight: 600; color: var(--label-2); }
.metric.lg .v { font-size: 44px; }
.metric.sm .v { font-size: 24px; }
.metric .alt { font-size: 17px; font-weight: 600; color: var(--label-2); margin-left: 8px; font-family: var(--font); }
.subline { color: var(--label-2); font-size: 14px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px 16px; margin-top: 12px; }
.stat .l { color: var(--label-2); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat .v { font-size: 20px; font-weight: 650; font-family: var(--font-round); font-variant-numeric: tabular-nums; margin-top: 1px; }
.stat .v small { font-size: 13px; color: var(--label-2); font-weight: 600; }
.stat .d { font-size: 13px; margin-top: 1px; }

/* Puces d'écart */
.chip { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--fill-2); color: var(--label-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.up { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.chip.down { color: var(--down); background: color-mix(in srgb, var(--down) 14%, transparent); }
.chip svg { width: 10px; height: 10px; fill: currentColor; }

/* Pastilles Tempo */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; padding: 4px 10px 4px 8px; border-radius: 999px; background: var(--fill-2); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; box-shadow: inset 0 0 0 1px var(--white-line); }
.dot.BLUE, .s-BLUE { background: var(--blue); fill: var(--blue); }
.dot.WHITE, .s-WHITE { background: var(--white); fill: var(--white); }
.dot.RED, .s-RED { background: var(--red); fill: var(--red); }
.dot.none { background: var(--label-4); }
.pill.BLUE { background: var(--blue-soft); } .pill.WHITE { background: var(--white-soft); } .pill.RED { background: var(--red-soft); }

/* Bandeau aperçu */
.banner { display: flex; gap: 12px; align-items: flex-start; background: color-mix(in srgb, var(--accent) 14%, var(--card)); border-radius: var(--radius-s); padding: 12px 14px; margin: 0 0 14px; font-size: 15px; }
.banner b { display: block; }
.banner .t { flex: 1; color: var(--label-2); }
.banner .t b { color: var(--label); }
.banner .btn-s { white-space: nowrap; }

/* ——— Contrôles ——— */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill-2); border-radius: 9px; padding: 2px; gap: 2px; margin: 0 0 12px; }
.seg button { padding: 6px 8px; border-radius: 7px; font-size: 14px; font-weight: 600; color: var(--label); }
.seg button[aria-pressed="true"] { background: var(--card-3); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .seg button[aria-pressed="true"] { background: #fff; } }
.seg.inline { display: inline-grid; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.toolbar .seg { flex: 1 1 320px; max-width: 520px; margin: 0; }
.pnav { display: flex; align-items: center; gap: 4px; margin: 4px 0 10px; }
.pnav h3 { margin: 0; flex: 1; text-align: center; font-size: 17px; font-weight: 650; }
.pnav .sub { display: block; font-size: 13px; font-weight: 500; color: var(--label-2); }
.pnav button { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); font-size: 22px; }
.pnav button:disabled { color: var(--label-4); cursor: default; }
.pnav button:not(:disabled):hover { background: var(--fill-2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--label-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend i.line { height: 3px; border-radius: 2px; width: 14px; vertical-align: 2px; }

.btn { display: block; width: 100%; padding: 14px; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 600; font-size: 17px; text-align: center; }
.btn.secondary { background: var(--fill-2); color: var(--accent); }
.btn.danger { background: var(--fill-2); color: var(--red); }
.btn-s { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; }
.btn-s.ghost { background: var(--fill-2); color: var(--accent); }
.btn-s:disabled { opacity: .5; }

/* Listes réglages (style iOS) */
.group { background: var(--card); border-radius: 12px; overflow: hidden; }
.cell { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 10px 16px; position: relative; width: 100%; text-align: left; color: var(--label); }
.cell + .cell::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.cell .grow { flex: 1; min-width: 0; }
.cell .sub { color: var(--label-2); font-size: 13px; margin-top: 1px; overflow-wrap: anywhere; }
.cell .val { color: var(--label-2); font-size: 15px; text-align: right; }
.cell .ok { color: var(--down); } .cell .ko { color: var(--orange, #ff9f0a); }
.cell input[type="text"], .cell input[type="email"], .cell input[type="number"], .cell input[type="date"], .cell input[type="password"], .cell select, .cell textarea {
  width: 100%; font: inherit; color: var(--label); background: transparent; border: 0; outline: none; padding: 2px 0;
}
.cell textarea { resize: vertical; min-height: 64px; font-size: 13px; font-family: ui-monospace, Menlo, monospace; }
.cell input.num { text-align: right; width: 90px; }
.cell select { text-align: right; width: auto; appearance: none; color: var(--label-2); }
.caption { color: var(--label-2); font-size: 13px; margin: 8px 16px 0; line-height: 1.4; }
.caption code, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.spacer { height: 10px; }
.settings { max-width: 720px; }
.settings .section-h h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--label-2); }
.settings .section-h { margin: 22px 16px 6px; }
.gas-period { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px 12px; align-items: end; }
.gas-period label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gas-period label span { font-size: 12px; color: var(--label-2); }
.gas-period .gp-from { grid-column: 1 / 3; }
.gas-period .x { color: var(--red); font-size: 22px; padding: 0 2px; grid-row: 1 / 3; grid-column: 3; align-self: center; }
@media (min-width: 560px) { .gas-period { grid-template-columns: 1.3fr 1fr 1.2fr auto; } .gas-period .gp-from { grid-column: auto; } .gas-period .x { grid-row: auto; grid-column: auto; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--label-2); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ——— Graphiques ——— */
.chart { position: relative; height: var(--h, 180px); margin: 6px -2px 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart svg { display: block; overflow: visible; }
.chart .grid line { stroke: var(--label-4); stroke-width: 1; shape-rendering: crispEdges; }
.chart .grid line.zero { stroke: var(--label-3); }
.chart text { fill: var(--label-2); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .xl text { fill: var(--label-2); }
.chart .y2l text { fill: var(--temp); }
.chart .b { fill: var(--elec); }
.chart.gas .b { fill: var(--gas); }
.chart.money .b { fill: var(--money); }
.chart .b.hl { opacity: 1; }
.chart.scrub .b { opacity: .55; }
.chart .ghost { fill: var(--ghost); }
.chart .ghostline { fill: none; stroke: var(--label-3); stroke-width: 1.6; stroke-dasharray: 3 3; }
.chart .line { fill: none; stroke: var(--elec); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.y2 { stroke: var(--temp); stroke-dasharray: none; opacity: .9; }
.chart .area { opacity: .16; }
.chart .band { fill: var(--fill-2); }
.chart .band.BLUE { fill: var(--blue-soft); } .chart .band.WHITE { fill: var(--white-soft); } .chart .band.RED { fill: var(--red-soft); }
.chart .ref { stroke: var(--label-2); stroke-dasharray: 4 4; stroke-width: 1.2; }
.chart .reft { font-size: 11px; fill: var(--label-2); font-weight: 600; }
.chart .fit { stroke-width: 2.2; stroke-linecap: round; }
.chart .pt { opacity: .7; }
.chart .strip { opacity: .95; }
.chart .strip.s-WHITE { stroke: var(--white-line); stroke-width: .5; }
.chart .rule { position: absolute; width: 1px; background: var(--label-2); pointer-events: none; }
.chart .callout {
  position: absolute; top: -6px; transform: translateY(-100%); background: var(--card-2); border-radius: 10px; padding: 7px 10px; font-size: 13px; line-height: 1.3;
  pointer-events: none; white-space: nowrap; z-index: 5; box-shadow: 0 8px 26px rgba(0, 0, 0, .3); min-width: 90px;
}
.callout b { font-size: 17px; font-family: var(--font-round); display: block; font-variant-numeric: tabular-nums; }
.callout .c-sub { color: var(--label-2); font-size: 12px; }
.callout .dot { width: 8px; height: 8px; margin-right: 4px; }
.chart-wrap { padding-top: 34px; }

.hbars { display: grid; gap: 8px; margin-top: 8px; }
.hbar { display: grid; grid-template-columns: minmax(70px, auto) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.hbar .hl { color: var(--label-2); white-space: nowrap; }
.hbar.cur .hl { color: var(--label); font-weight: 600; }
.hbar .ht { height: 12px; background: var(--fill-2); border-radius: 6px; overflow: hidden; }
.hbar .ht i { display: block; height: 100%; border-radius: 6px; background: var(--label-3); }
.hbar.cur .ht i { background: var(--accent); }
.hbar .hv { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; min-width: 64px; }

/* Petites lignes de comparaison */
.rows { display: grid; gap: 10px; margin-top: 6px; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; }
.row .k { color: var(--label-2); font-size: 14px; }
.row .x { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.row .y { grid-column: 1 / -1; }
.bar-pair { display: grid; gap: 4px; margin-top: 4px; }
.bar-pair .bp { height: 8px; border-radius: 4px; background: var(--fill-2); overflow: hidden; }
.bar-pair .bp i { display: block; height: 100%; border-radius: 4px; }

/* Tableaux */
.table-wrap { overflow-x: auto; margin: 4px -4px 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.t th { text-align: right; color: var(--label-2); font-weight: 600; font-size: 12.5px; padding: 6px 8px; white-space: nowrap; }
table.t th:first-child, table.t td:first-child { text-align: left; }
table.t td { padding: 7px 8px; text-align: right; border-top: .5px solid var(--sep); white-space: nowrap; }
table.t td.cur { font-weight: 650; }
table.t .neg { color: var(--down); } table.t .pos { color: var(--up); }

/* Feuille, toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); transform: translateX(-50%); background: var(--card-3); color: var(--label); padding: 10px 16px; border-radius: 999px; font-size: 15px; font-weight: 500; z-index: 50; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
@media (min-width: 1024px) { .toast { bottom: 28px; } }
.empty { text-align: center; color: var(--label-2); padding: 28px 12px; font-size: 15px; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 50%, var(--card) 100%); background-size: 200% 100%; animation: sk 1.4s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.fade-in { animation: fi .35s var(--ease); }
@keyframes fi { from { opacity: 0; transform: translateY(6px); } }

/* ——— Mode écran (16:9, iPad, écrans muraux) ——— */
body.screen { overflow: hidden; background: #000; color: #fff; }
body.screen .sidebar, body.screen .tabbar { display: none !important; }
body.screen .shell { display: block; }
body.screen .main { max-width: none; padding: 0; }
.ecran {
  --g: clamp(8px, 1.2vmin, 16px);
  height: 100dvh; width: 100vw; padding: calc(var(--g) * 1.4); display: grid; gap: var(--g);
  grid-template-columns: repeat(12, 1fr); grid-template-rows: auto 1.25fr 1fr auto;
  background: #000; color: #fff; font-size: clamp(12px, 1.75vmin, 26px);
}
.ecran .tile { background: #141416; border-radius: clamp(14px, 2vmin, 26px); padding: clamp(10px, 1.6vmin, 22px); min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.ecran .tile .tt { font-size: .95em; font-weight: 600; color: rgba(235, 235, 245, .64); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.ecran .tile .tt .elec { color: var(--elec); } .ecran .tile .tt .gas { color: var(--gas); } .ecran .tile .tt .money { color: var(--money); }
.ecran .big { font-family: var(--font-round); font-weight: 700; font-size: 3.1em; letter-spacing: -.02em; line-height: 1.02; font-variant-numeric: tabular-nums; }
.ecran .big small { font-size: .42em; color: rgba(235, 235, 245, .64); font-weight: 600; margin-left: .15em; }
.ecran .mid { font-family: var(--font-round); font-weight: 700; font-size: 1.9em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.ecran .mid small { font-size: .5em; color: rgba(235, 235, 245, .64); font-weight: 600; }
.ecran .note { color: rgba(235, 235, 245, .64); font-size: .95em; margin-top: .25em; display: flex; flex-wrap: wrap; gap: .2em .8em; align-items: center; }
.ecran .chart { flex: 1; height: auto; min-height: 0; margin-top: .4em; }
.ecran .chart text { font-size: max(10px, .72em); }
.ecran .head { grid-column: 1 / -1; display: flex; align-items: center; gap: calc(var(--g) * 1.2); }
.ecran .clock { font-family: var(--font-round); font-size: 3.3em; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.ecran .date { font-size: 1.15em; color: rgba(235, 235, 245, .64); font-weight: 500; }
.ecran .tempo-days { margin-left: auto; display: flex; gap: var(--g); }
.ecran .tday { display: flex; align-items: center; gap: .6em; padding: .55em 1em .55em .7em; border-radius: 999px; background: #1c1c1e; font-weight: 600; font-size: 1.15em; }
.ecran .tday .dot { width: 1.1em; height: 1.1em; }
.ecran .tday .lbl { color: rgba(235, 235, 245, .64); font-weight: 500; }
.ecran .tday.RED { background: var(--red-soft); } .ecran .tday.BLUE { background: var(--blue-soft); } .ecran .tday.WHITE { background: rgba(242, 242, 247, .14); }
.ecran .price { font-family: var(--font-round); font-weight: 700; }
.ecran .r1a { grid-column: span 6; } .ecran .r1b { grid-column: span 6; }
.ecran .r2a { grid-column: span 6; } .ecran .r2b { grid-column: span 6; }
.ecran .r3 { grid-column: span 3; }
.ecran .r3.w4 { grid-column: span 4; }
.ecran .split { display: flex; gap: 1.2em; align-items: flex-end; flex-wrap: wrap; }
.ecran .chip { font-size: .85em; }
.ecran .exit { position: fixed; top: 14px; right: 14px; z-index: 30; background: rgba(44, 44, 46, .9); color: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 15px; }
.ecran .stamp { font-size: .8em; color: rgba(235, 235, 245, .34); }
@media (max-aspect-ratio: 1/1) {
  /* écran en portrait : on empile */
  .ecran { grid-template-rows: auto 1fr 1fr 1fr 1fr auto; }
  .ecran .r1a, .ecran .r1b, .ecran .r2a, .ecran .r2b { grid-column: 1 / -1; }
  .ecran .r3, .ecran .r3.w4 { grid-column: span 6; }
}
