/* Aujourd'hui. The hero beats everything; the tanks carry the colour; nothing animates layout. */

/* ---------------------------------------------------------------- top row */
.td-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-right: -10px; }
.td-fresh {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 0 8px 0 0; border-radius: 22px;
  font-size: var(--t-sub); font-weight: 520; color: var(--ink-2); white-space: nowrap;
}
.td-date { color: var(--ink); font-weight: 650; }
.td-fresh { gap: 6px; }
.td-fresh__mark { display: inline-grid; place-items: center; min-width: 8px; color: var(--ink-2); font-weight: 700; flex: none; }
.td-fresh__mark .ico { width: 16px; height: 16px; color: var(--ink); }
.td-fresh__text { overflow: hidden; text-overflow: ellipsis; }
.td-fresh[data-state="stale"] .td-fresh__text, .td-fresh[data-state="offline"] .td-fresh__text { color: var(--ink); font-weight: 600; }
.td-gear { color: var(--ink-2); }
.td-gear .ico { width: 23px; height: 23px; }

.td-notices:not(:empty) { display: grid; gap: 8px; margin-top: var(--s4); }

/* ---------------------------------------------------------------- hero */
.td-hero { position: relative; z-index: 2; margin-top: 4px; } /* text above the falling droplet */
.td-hero__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.td-hero__label { font-size: 17px; font-weight: 560; color: var(--ink-2); }
.td-score {
  position: relative; display: flex; align-items: center; gap: 7px; height: 44px; margin: -6px -4px -6px 0; padding: 0 4px 0 8px; border-radius: 22px; /* 44 pt target, 32 pt of row */
}
.td-vial { width: 22px; height: 22px; }
.td-score__n { font-size: 22px; font-weight: 760; font-stretch: 110%; letter-spacing: -.015em; line-height: 1; min-width: 1.2em; }
.td-score__glint { position: absolute; left: 6px; top: 9px; width: 26px; height: 26px; border-radius: 50%; box-shadow: 0 0 0 2px var(--pace); opacity: 0; pointer-events: none; }

.td-hero__fig { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; --fit-max: var(--t-hero); --fit-rest: 62px; }
/* the figure fits the column, « AED » included, at any length and any text zoom (.fit-line in
   components.css, 92 px at most). It starts exactly on the gutter (no optical inset). */
.td-hero__odo {
  font-size: var(--t-hero); font-weight: 820; font-stretch: var(--w-display); letter-spacing: -.04em; line-height: .98;
  transition: color var(--d-smooth) var(--e-smooth);
}
/* AED whispers: smaller, lighter, on the baseline */
.td-hero__unit { font-size: 20px; font-weight: 560; font-stretch: 104%; color: var(--ink-2); letter-spacing: .02em; }

/* the hero rule: what is left today over what was available, in the pace colour */
.td-rule { position: relative; height: 6px; margin-top: 12px; border-radius: 3px; background: var(--sunk); box-shadow: inset 0 0 0 .5px var(--hair-2); overflow: hidden; }
/* a thin mark: --pace-mark (darker than the liquid) keeps 3:1 against the track in the sun.
   Its colour changes are driven by JS (OKLCH mix), never by a CSS transition. */
.td-rule__fill {
  position: absolute; inset: 0; border-radius: 3px; background: var(--pace-mark); box-shadow: inset 0 0 0 .75px var(--mark-edge);
  transform-origin: 0 50%; transform: scaleX(0);
}
.td-hero__sub { font-size: var(--t-sub); color: var(--ink-2); margin-top: 8px; min-height: 1.4em; text-wrap: pretty; } /* one sentence: no short word alone on its last line */

/* stale or offline: the figure is greyed, never hidden */
.view[data-stale] .td-hero__odo { color: var(--ink-2); }
.view[data-stale] .td-rule__fill { background: var(--dry) !important; box-shadow: none; }
.view[data-stale] .td-score__n, .view[data-stale] .td-tank__odo, .view[data-stale] .td-ruler__n { color: var(--ink-2); }
.view[data-stale] .td-ruler__ink { background: var(--dry) !important; }

/* ---------------------------------------------------------------- tanks */
.td-tanks { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: 26px; }
.td-tank { min-width: 0; }
.td-tank__head { position: relative; z-index: 2; }
.td-tank__title { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.td-tank__name { font-size: 16px; font-weight: 680; }
/* a sentence that carries a figure keeps its end (« depuis hier »): it wraps under its tank */
.td-tank__gain { font-size: var(--t-foot); color: var(--ink-2); margin-top: var(--s1); line-height: 1.3; text-wrap: pretty; }
.td-tank__fig { margin-top: 6px; line-height: 1; }
.td-tank__odo { font-size: var(--t-display); font-weight: 780; font-stretch: 112%; letter-spacing: -.03em; line-height: 1; }
.td-tank__of { font-size: var(--t-foot); color: var(--ink-2); margin-top: 6px; white-space: nowrap; }
.td-tank[data-empty] .td-tank__of, .td-tank[data-low] .td-tank__of { color: var(--ink); font-weight: 600; }
.td-glass {
  position: relative; display: block; width: 100%; height: 156px; margin-top: var(--s2); border-radius: var(--r-tank); -webkit-user-select: none; user-select: none;
  transition: transform var(--d-snappy) var(--e-snappy);
}
.td-glass:active { transform: scale(.985); transition-duration: var(--d-press); transition-timing-function: var(--e-press); }
.td-glass canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.td-tank__note {
  position: absolute; left: 16px; right: 16px; top: 50%; translate: 0 -50%; text-align: center; text-wrap: balance;
  font-size: var(--t-foot); line-height: 1.35; font-weight: 540; color: var(--ink-2);
  opacity: 0; transform: translateY(6px); transition: opacity var(--d-smooth) var(--e-smooth), transform var(--d-smooth) var(--e-smooth);
}
.td-tank[data-note] .td-tank__note { opacity: 1; transform: none; }
.td-tank__tag {
  position: absolute; left: 50%; top: 14px; translate: -50% 0; padding: 3px 9px; border-radius: 9px;
  font-size: var(--t-micro); font-weight: 640; background: var(--ink); color: var(--on-ink);
  opacity: 0; transform: translateY(-4px); transition: opacity var(--d-smooth) var(--e-smooth), transform var(--d-snappy) var(--e-snappy);
}
.td-tank[data-sim] .td-tank__tag { opacity: 1; transform: none; }
.td-tank__foot { font-size: var(--t-foot); color: var(--ink-2); margin-top: var(--s1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- pace ruler */
.td-pace { margin-top: 14px; }
.td-ruler { position: relative; height: 42px; }
.td-ruler__ticks { position: absolute; left: 0; right: 0; bottom: 6px; height: 14px; }
.td-ruler__ticks i { position: absolute; bottom: 0; width: 1px; height: 7px; background: var(--ink-3); opacity: .55; translate: -.5px 0; }
.td-ruler__ticks i.is-major { height: 14px; width: 1.5px; background: var(--ink); opacity: .8; }
.td-ruler__zones { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; display: grid; grid-template-columns: 33fr 33fr 32fr; gap: 3px; }
.td-ruler__zone { position: relative; border-radius: 2px; background: var(--hair-2); overflow: hidden; }
.td-ruler__ink { position: absolute; inset: 0; border-radius: inherit; background: var(--pace-mark); box-shadow: inset 0 0 0 .75px var(--mark-edge); opacity: 0; }
.td-ruler__zone[data-on] .td-ruler__ink { opacity: 1; }
.td-ruler__mark { position: absolute; left: 0; bottom: 0; width: 0; height: 26px; }
.td-ruler__mark::before { content: ""; position: absolute; left: -1.5px; bottom: -2px; width: 3px; height: 24px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2.5px var(--chalk); }
.td-ruler__n { position: absolute; bottom: 26px; left: 0; translate: -50% 0; font-size: 17px; font-weight: 780; font-stretch: 108%; letter-spacing: -.01em; line-height: 1; }
.td-ruler__scale { position: relative; height: 15px; margin: 4px 0 0; font-size: var(--t-micro); color: var(--ink-2); }
.td-ruler__scale span { position: absolute; top: 0; translate: -50% 0; }
.td-ruler__scale span:nth-child(1) { left: 0; translate: 0 0; }
.td-ruler__scale span:nth-child(2) { left: 33.67%; }
.td-ruler__scale span:nth-child(3) { left: 67.35%; }
.td-ruler__scale span:nth-child(4) { right: 0; translate: 0 0; }
.td-pace__text { font-size: 17px; font-weight: 560; margin-top: 8px; }
.td-pace__s { display: block; text-wrap: pretty; } /* one sentence per line, never a balanced split */

/* ---------------------------------------------------------------- purchases */
.td-list .group:first-of-type { margin-top: var(--s3); }
.td-total { display: flex; justify-content: space-between; gap: 12px; margin-top: var(--s2); padding: 12px 0 0; border-top: 1.5px solid var(--ink); font-size: var(--t-sub); font-weight: 650; }
.td-empty { padding-top: 14px; }

/* ---------------------------------------------------------------- loading */
.view[data-loading] .td-hero__odo, .view[data-loading] .td-tank__odo { color: transparent; background: var(--sunk); border-radius: 12px; }

/* ---------------------------------------------------------------- the falling droplet
   A drop of the liquid's colour, no text. It sits under the text layer (.td-hero and the tank
   heads are z-index 2) and lands in its tank. */
.td-drop {
  position: fixed; left: 0; top: 0; z-index: 1; width: 14px; height: 14px; pointer-events: none;
  border-radius: 50% 50% 50% 50% / 58% 58% 42% 42%;
  background: radial-gradient(circle at 36% 30%, color-mix(in srgb, rgb(var(--glass-hi)) 55%, var(--pace)) 0 18%, var(--pace) 48%, color-mix(in srgb, var(--pace) 82%, var(--ink)) 100%);
  will-change: transform;
}
