/* Charges: screen styles (owned by the builder of this screen). Use tokens only.
   Also holds the small cx-* pieces shared with Sources, Réglages and Brancher (js/ui/charges-kit.js). */

/* ================================================================ shared cx-* pieces */
.cx-notice { margin-bottom: var(--s3); }
.cx-state { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-foot); font-weight: 620; color: var(--ink-2); white-space: nowrap; }
.cx-state .ico { width: 16px; height: 16px; stroke-width: 1.9; }
.cx-state--ok .ico { color: var(--ink-2); }
.cx-state--watch { color: var(--ink); }
.cx-state--problem { height: 26px; padding: 0 10px 0 8px; border-radius: 13px; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.cx-state--problem .ico { color: var(--ink); }
.cx-state--idle { font-weight: 520; }
.cx-skel { display: grid; gap: 0; }
.cx-skel__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; border-bottom: 1px solid var(--hair); }
.cx-skel__a { height: 15px; }
.cx-skel__b { width: 64px; height: 15px; }

/* ================================================================ Charges */
.ch-notice:not(:empty) { display: grid; gap: 8px; margin-bottom: var(--s3); }
.ch-offline__sub { color: var(--ink-2); margin-top: 2px; }
.view[data-loading] .ch-top, .view[data-loading] .ch-groups { display: none; }
.ch-loading .card { display: grid; }

/* ---------------------------------------------------------------- the forecast (the one figure) */
.ch-eom { padding: 20px 20px 18px; }
.ch-eom__label { font-size: 17px; font-weight: 560; color: var(--ink-2); }
.ch-eom__fig { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.ch-eom__fig[hidden], .ch-eom__rows[hidden], .ch-eom__words[hidden], .ch-eom__unknown[hidden] { display: none; }
/* the forecast is not known: the server's sentence stands where the figure would be */
.ch-eom__unknown { margin-top: 8px; font-size: var(--t-title); font-weight: 700; font-stretch: 104%; letter-spacing: -.02em; line-height: 1.16; text-wrap: pretty; }
.ch-eom__odo { font-size: var(--t-figure); font-weight: 800; font-stretch: 114%; letter-spacing: -.035em; line-height: 1; }
.ch-eom__fig { --fit-rest: 50px; } /* .fit-line: the forecast always fits the card, AED included */
.ch-eom__unit { font-size: 14px; font-weight: 560; font-stretch: 104%; letter-spacing: .02em; color: var(--ink-2); }
.ch-eom__rows { margin-top: 18px; border-top: 1px solid var(--hair-2); }
.ch-eom__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 10px; font-size: var(--t-sub); color: var(--ink-2); }
.ch-eom__row + .ch-eom__row { padding-top: 4px; }
.ch-eom__delta { display: block; color: var(--ink); }
.ch-eom__delta[hidden] { display: none; }
.ch-eom__val { color: var(--ink); font-weight: 640; white-space: nowrap; }
.ch-eom__words { margin-top: 12px; font-size: var(--t-body); font-weight: 560; line-height: 1.35; text-wrap: pretty; }
.view[data-offline] .ch-eom__odo, .view[data-offline] .ch-eom__val, .view[data-offline] .ch-line__fig, .view[data-offline] .ch-gh__aside { color: var(--ink-2); }

/* ---------------------------------------------------------------- groups: the rule fills as lines are paid */
.ch-group { margin-top: var(--s4); }
.ch-gh { border-bottom: 0; padding-bottom: 8px; }
.ch-gh__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-gh__aside { display: inline-flex; align-items: baseline; }
.ch-gh__odo { color: var(--ink); font-weight: 650; }
.ch-rule { position: relative; height: 3px; border-radius: 2px; background: var(--hair-2); overflow: hidden; }
.ch-rule__fill { position: absolute; inset: 0; border-radius: 2px; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------------------------------------------------------------- a line: [mark] [text ... amount] */
.ch-rows > li { position: relative; }
/* separators start at the text and end on the gutter, like the figures */
.ch-rows > li + li .ch-line__main::after { content: ""; position: absolute; left: 8px; right: 0; top: 0; height: 1px; background: var(--hair); }
.ch-line { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; column-gap: 8px; min-height: 64px; }
.ch-line__main {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px;
  min-height: 64px; padding: 10px 0 10px 8px; text-align: left;
  transition: transform var(--d-snappy) var(--e-snappy);
}
/* the pressed well reaches a little past the gutter so the figures can sit exactly on it */
.ch-line__main::before { content: ""; position: absolute; z-index: -1; inset: 0 -8px 0 0; border-radius: var(--r-s); background: var(--sunk); opacity: 0; transition: opacity var(--d-smooth) var(--e-smooth); }
.ch-line__main:active::before { opacity: 1; transition-duration: var(--d-press); }
.ch-line__main:active { transform: scale(.985); transition-duration: var(--d-press); transition-timing-function: var(--e-press); }
.ch-line__text { min-width: 0; }
.ch-line__title { display: block; font-size: var(--t-body); font-weight: 580; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--d-smooth) var(--e-smooth); }
.ch-line__meta { display: block; font-size: var(--t-foot); color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-line__fig { font-size: var(--t-body); font-weight: 660; white-space: nowrap; text-align: right; transition: color var(--d-smooth) var(--e-smooth); }
.ch-line[data-paid] .ch-line__title { color: var(--ink-2); }
.ch-line[data-paid] .ch-line__fig { color: var(--ink-2); font-weight: 560; }

/* the paid mark: a 26 pt circle in a 44 pt target; when paid, an ink disc springs in and the check draws */
.ch-check { position: relative; display: grid; place-items: center; width: 44px; height: 44px; margin-left: -9px; margin-right: -7px; border-radius: 50%; touch-action: manipulation; }
.ch-check::before { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1.75px var(--ink-3); transition: box-shadow var(--d-snappy) var(--e-snappy); }
.ch-check__disc {
  position: relative; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: var(--on-ink); transform: scale(.2); opacity: 0;
  transition: transform var(--d-bouncy) var(--e-bouncy), opacity var(--d-snappy) var(--e-snappy);
}
.ch-check__disc .ico { width: 17px; height: 17px; stroke-width: 2.6; stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset var(--d-smooth) var(--e-smooth); }
.ch-check[aria-checked="true"] .ch-check__disc { transform: none; opacity: 1; }
.ch-check[aria-checked="true"] .ch-check__disc .ico { stroke-dashoffset: 0; transition-delay: 60ms; }
.ch-check[aria-checked="true"]::before { box-shadow: inset 0 0 0 1.75px transparent; }
.ch-check { transition: transform var(--d-snappy) var(--e-snappy); }
.ch-check:active { transform: scale(.86); transition-duration: var(--d-press); transition-timing-function: var(--e-press); }

/* offline: a check that cannot act says so */
.ch-check[aria-disabled]::before { box-shadow: inset 0 0 0 1.75px var(--hair-2); }
.ch-check[aria-disabled] .ch-check__disc { background: var(--ink-3); }
.ch-check[aria-disabled]:active { transform: none; }

/* a tracked line: its category disc, and one gauge running to the gutter */
.ch-line__dot { width: 28px; height: 28px; }
.ch-line__dot .ico { width: 16px; height: 16px; }
.ch-gauge { position: relative; display: block; height: 4px; border-radius: 2px; background: var(--hair-2); overflow: hidden; }
.ch-line__main .ch-gauge { grid-column: 1 / -1; grid-row: 2; margin-top: 9px; }
.ch-line__main .ch-line__fig { grid-row: 1; grid-column: 2; }
.ch-gauge__fill { position: absolute; inset: 0; border-radius: 2px; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); }
.ch-gauge--l { height: 8px; border-radius: 4px; margin-top: 0; }
.ch-gauge--l .ch-gauge__fill { border-radius: 4px; }
.ch-group[data-tracked] .ch-rule { display: none; }
.ch-group[data-tracked] .ch-gh { padding-bottom: 4px; }

/* ---------------------------------------------------------------- instalments: bars that step down */
.ch-inst__lede { color: var(--ink); font-size: 16px; font-weight: 520; }
.ch-bars { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); margin-top: var(--s4); }
.ch-bar { display: grid; min-width: 0; text-align: center; }
/* the plot: a hairline floor, a slim bar centred in a clipped slot, its value riding on top */
.ch-bar__plot { position: relative; display: block; height: 112px; margin-top: 24px; box-shadow: inset 0 -1px 0 var(--hair-2); }
.ch-bar__slot { position: absolute; top: 0; bottom: 0; left: 50%; width: 30px; margin-left: -15px; overflow: hidden; border-radius: 0 0 3px 3px; }
.ch-bar__fill { position: absolute; inset: 0; border-radius: 8px 8px 3px 3px; background: var(--ink-3); transform: translateY(100%); }
.ch-bar__rider { position: absolute; inset: 0; pointer-events: none; transform: translateY(100%); }
.ch-bar__val { position: absolute; left: 0; right: 0; bottom: 100%; padding-bottom: 6px; font-size: var(--t-foot); font-weight: 620; color: var(--ink-2); white-space: nowrap; }
.ch-bar.is-now .ch-bar__fill { background: var(--ink); }
.ch-bar.is-now .ch-bar__val { color: var(--ink); font-weight: 700; }
.ch-bar__m { font-size: var(--t-foot); color: var(--ink-2); padding-top: 8px; }
.ch-bar.is-now .ch-bar__m { color: var(--ink); font-weight: 680; }
.ch-inst .ch-group { margin-top: var(--s5); }

/* ---------------------------------------------------------------- outside budgets */
.ch-out { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: var(--s3); padding: 14px 0; border-bottom: 1px solid var(--hair-2); }
.ch-out__label { font-weight: 580; }
.ch-out__fig { font-weight: 700; white-space: nowrap; }
.ch-out__unit { font-size: var(--t-foot); color: var(--ink-2); font-weight: 560; }

/* ---------------------------------------------------------------- empty month */
.ch-empty { padding-top: 32px; }
.ch-empty .state__title { font-size: var(--t-headline); font-weight: 700; }
.ch-empty .state__text { max-width: 26em; text-wrap: pretty; }
.ch-out__group { margin-top: var(--s4); }

/* ---------------------------------------------------------------- the line sheet */
.ch-sh__ident { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; column-gap: 14px; margin-top: 2px; }
.ch-sh__idtext { min-width: 0; }
.ch-sh__group { font-size: var(--t-foot); color: var(--ink-2); margin-top: 2px; }
.ch-sh__panel { margin-top: 18px; background: var(--chalk); }
.ch-sh__panel .panel-row { min-height: 50px; padding: 10px 16px; }
.ch-sh__val { font-weight: 640; text-align: right; }
.ch-sh__panelpaid { margin-top: 10px; background: var(--chalk); }
.ch-sh__track { margin-top: 18px; }
.ch-sh__note { font-size: var(--t-sub); color: var(--ink-2); margin-top: 10px; }
.ch-sh__picker { margin-top: 22px; }
.ch-sh__plabel { margin-left: 0; }
.ch-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
/* one selection language for every option: a filled ink shape (a disc for a day, a pill for « none ») */
.ch-day {
  position: relative; isolation: isolate; display: grid; place-items: center; height: 44px;
  font-size: 16px; font-weight: 560; color: var(--ink);
  transition: transform var(--d-snappy) var(--e-snappy), color var(--d-snappy) var(--e-snappy);
}
.ch-day::before {
  content: ""; position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 50%; width: 40px; margin-left: -20px; border-radius: 20px;
  background: var(--ink); transform: scale(.6); opacity: 0;
  transition: transform var(--d-snappy) var(--e-snappy), opacity var(--d-snappy) var(--e-snappy);
}
.ch-day:active { transform: scale(.9); transition-duration: var(--d-press); transition-timing-function: var(--e-press); }
.ch-day[aria-checked="true"] { color: var(--on-ink); font-weight: 720; }
.ch-day[aria-checked="true"]::before { transform: none; opacity: 1; }
.ch-day--none { grid-column: 4 / span 4; font-size: 14.5px; font-weight: 620; }
.ch-day--none::before { left: 2px; right: 0; width: auto; margin-left: 0; }
.ch-day--none:not([aria-checked="true"])::before { transform: none; opacity: 1; background: transparent; box-shadow: inset 0 0 0 1px var(--hair-2); }
.ch-sh__paid[data-off] .switch { opacity: .45; }
.ch-day[aria-busy] { pointer-events: none; }

.ch-group[data-tracked] .ch-gh__odo { display: none; }
.ch-offline:focus { outline: none; }
