/* Catégories: the tab, the category page, the triage sheet and the archive sheet.
   Tokens only. The month's figure leads; categories are rows separated by hairlines; the one
   card of the screen is « à classer ». Motion is transform and opacity (js springs). */

/* ---------------------------------------------------------------- the tab */
.ct-list { position: relative; }
.ct-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); } /* zoomed text: « Nouvelle » goes under the title */
.ct-top .large-title { margin-bottom: 0; }
.ct-newbtn { flex: none; gap: 6px; padding: 0 14px 0 10px; margin-top: 6px; }
.ct-newbtn .ico { width: 18px; height: 18px; stroke-width: 2; }

.ct-head { margin-top: 22px; }
.ct-total { display: flex; align-items: baseline; gap: 7px; }
.ct-total__odo { font-size: var(--t-figure); font-weight: 800; font-stretch: 114%; letter-spacing: -.035em; line-height: 1; }
.ct-total { --fit-rest: 50px; } /* « AED » 15 px and the gap: the figure fits the rest (.fit-line) */
/* AED whispers: smaller, lighter, on the baseline */
.ct-total__unit { font-size: 15px; font-weight: 560; font-stretch: 104%; letter-spacing: .02em; color: var(--ink-2); }
.ct-lede { font-size: var(--t-sub); color: var(--ink-2); margin-top: 8px; min-height: 1.4em; }

.ct-status:not(:empty) { margin-top: var(--s4); }

/* ---- « 2 achats à classer »: the one card of the screen, on a small pile of its own */
.ct-sortslot { position: relative; isolation: isolate; } /* the pile's edges sit under the card */
.ct-sortslot:not(:empty) { margin-top: var(--s4); padding-bottom: 8px; }
.ct-sort {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 76px; padding: 14px 12px 14px 14px; border-radius: var(--r-l); text-align: left;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair);
  transition: transform var(--d-snappy) var(--e-snappy);
}
/* more than one waits: one sheet of paper under the card, 8 pt deep, a clear hairline */
.ct-sort::before {
  content: ""; position: absolute; z-index: -1; left: 14px; right: 14px; bottom: -8px; height: 40px;
  border-radius: 0 0 20px 20px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--hair-2); opacity: 0;
}
.ct-sort[data-many]::before { opacity: 1; }
.ct-sort:active { transform: scale(.98); transition-duration: var(--d-press); transition-timing-function: var(--e-press); }
.ct-sort__dot { width: 44px; height: 44px; }
.ct-sort__text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ct-sort__title { font-size: 17px; font-weight: 700; letter-spacing: -.005em; line-height: 1.25; }
.ct-sort__sub { font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the whole card is the button: a disclosure chevron says so, the figure keeps the lead */
.ct-sort__go { display: grid; place-items: center; width: 20px; color: var(--ink-2); }
.ct-sort__go .ico { width: 20px; height: 20px; stroke-width: 2.2; }

/* ---- search */
.ct-search {
  position: relative; display: flex; align-items: center; gap: 8px; height: 44px; margin-top: var(--s4); padding: 0 4px 0 12px;
  border-radius: var(--r-s); background: var(--sunk); box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow var(--d-smooth) var(--e-smooth);
}
.ct-search:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.ct-search__ico { display: grid; place-items: center; color: var(--ink-2); flex: none; }
.ct-search__ico .ico { width: 19px; height: 19px; stroke-width: 1.9; }
.ct-search__input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--ink);
  font-size: 17px; font-weight: 500; -webkit-appearance: none; appearance: none;
}
.ct-search__input:focus { outline: none; }
.ct-search__input::placeholder { color: var(--ink-2); opacity: 1; font-weight: 440; }
.ct-search__input::-webkit-search-cancel-button, .ct-search__input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.ct-search__clear { position: relative; display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; color: var(--ink-2); }
.ct-search__clear::before { content: ""; position: absolute; inset: -4px; }
.ct-search__clear .ico { width: 18px; height: 18px; padding: 2px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 16%, transparent); color: var(--surface); stroke-width: 2.6; }
.ct-search__clear:active { transform: scale(.88); }

/* ---- the groups */
.ct-groups { position: relative; margin-top: var(--s2); }
.ct-group { margin-top: var(--s4); }
.ct-group .group-h { position: relative; }
.ct-gtot { font-weight: 600; color: var(--ink); }
.ct-row { min-height: 70px; }
.ct-row .row__meta { margin-top: 1px; }
/* the share bar: the accent at full strength (3:1 or more against the page in the sun) on a
   sunk track, so a 2 % share reads as a share of something, not a stray dot */
.ct-bar { grid-column: 2 / -1; position: relative; display: block; height: 4px; margin-top: -2px; border-radius: 2px; overflow: hidden; background: var(--sunk); }
.ct-bar__fill {
  position: absolute; inset: 0; border-radius: 2px; transform-origin: 0 50%; transform: scaleX(0);
  background: var(--acc, var(--cat-ink));
}
/* the amount sits on the name's baseline (same size, same line box, same top), like iOS lists */
.ct-row { align-items: start; row-gap: 10px; }
.ct-row .cat-dot { grid-row: 1 / 3; align-self: center; }
.ct-row .row__figure { align-self: start; line-height: inherit; }
.ct-row .row__title, .ct-row .row__figure { line-height: 1.375; }
.ct-row[data-zero] .row__figure { color: var(--ink-2); font-weight: 560; }
.ct-row[data-zero] .ct-bar { display: none; }
.ct-row[data-zero] { row-gap: 0; }
.ct-leaving { position: absolute; left: 0; right: 0; pointer-events: none; }

/* System categories with no purchase this month wait as pills under their group. */
.ct-idle { margin-top: 12px; }
.ct-group[data-empty] .ct-idle { margin-top: 10px; }
.ct-idle__label { font-size: var(--t-foot); color: var(--ink-2); margin-bottom: 8px; }
.ct-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ct-pill {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px 0 4px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 560; color: var(--ink);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair);
  transition: transform var(--d-snappy) var(--e-snappy), background-color var(--d-smooth) var(--e-smooth);
}
.ct-pill::before { content: ""; position: absolute; inset: -4px 0; } /* 44 pt to the finger */
.ct-pill:active { transform: scale(.95); background: var(--sunk); transition-duration: var(--d-press); transition-timing-function: var(--e-press); }
.ct-pill__dot { width: 28px; height: 28px; }
.ct-pill__dot .ico { width: 16px; height: 16px; }

/* « Nouvelle catégorie » at the end of the list: the dashed disc of the expense sheet's grid */
.ct-newrow { margin-top: var(--s4); }
.ct-newrow::after { display: none; }
.ct-newrow__dot { background: transparent; color: var(--ink); border: 1.5px dashed var(--ink-2); }
.ct-newrow .row__meta { display: block; }
.ct-foot { font-size: var(--t-foot); color: var(--ink-2); margin-top: var(--s4); padding-top: 14px; border-top: 1px solid var(--hair); max-width: 34em; }

/* ---- search across the month */
.view[data-searching] .ct-sortslot, .view[data-searching] .ct-groups,
.view[data-searching] .ct-newrow, .view[data-searching] .ct-foot { display: none; }
.ct-results { margin-top: var(--s3); }
.ct-rhead { display: flex; justify-content: space-between; gap: 12px; font-size: var(--t-sub); font-weight: 620; color: var(--ink-2); min-height: 22px; }
.ct-rhead span:last-child { color: var(--ink); }
.ct-results .ct-day:first-of-type, .ct-plist .ct-day:first-of-type { margin-top: var(--s2); }
.ct-results[aria-busy] .ct-day { opacity: .55; transition: opacity var(--d-smooth) var(--e-smooth); }
.ct-noresult { padding-top: 6px; }

.ct-row.is-new::before { opacity: 1; background: color-mix(in srgb, var(--acc, var(--cat-ink)) 14%, transparent); }

/* ---- day headers inside a list of purchases: a hairline (the ink rule is for budget groups) */
.ct-day .group-h { border-bottom: 1px solid var(--hair-2); font-weight: 640; }

/* ---- a purchase row inside a category: the time leads, the disc would repeat itself */
.ct-erow { grid-template-columns: 44px minmax(0, 1fr) auto; min-height: 58px; }
.ct-erow::after { left: 56px; }
.ct-erow__time { font-size: 14px; font-weight: 560; color: var(--ink-2); }

/* ---- offline: figures stay, greyed */
.view[data-offline] .ct-total__odo, .view[data-offline] .ct-gtot, .view[data-offline] .row__figure { color: var(--ink-2); }
.view[data-offline] .ct-bar__fill { background: var(--dry); }

/* ---- loading */
.view[data-loading] .ct-total__odo { display: inline-block; width: 190px; height: 40px; border-radius: 12px; background: var(--sunk); }
.view[data-loading] .ct-total__unit { visibility: hidden; }
.ct-skel__row { display: grid; grid-template-columns: 40px 1fr 64px; align-items: center; gap: 12px; min-height: 70px; }
.ct-skel__dot { width: 40px; height: 40px; border-radius: 50%; }
.ct-skel__main { display: grid; gap: 8px; }
.ct-skel__l1 { width: 58%; height: 13px; }
.ct-skel__l2 { display: inline-block; width: 34%; height: 10px; }
.ct-skel__fig { height: 14px; }
.ct-skel__aside { display: inline-block; width: 56px; height: 12px; vertical-align: middle; }

/* ---------------------------------------------------------------- the category page */
.ct-edit { margin-right: -2px; }
.ct-ph { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 14px; margin-top: 10px; }
.ct-ph__text { min-width: 0; }
.ct-ph__name { font-size: 30px; font-weight: 780; font-stretch: 106%; letter-spacing: -.025em; line-height: 1.08; overflow-wrap: break-word; text-wrap: balance; }
.ct-ph__name:focus:not(:focus-visible), .ct-ph__name[data-quiet]:focus { outline: none; }
.ct-ph__where { font-size: var(--t-sub); color: var(--ink-2); margin-top: 3px; }
.ct-total--page { margin-top: var(--s4); }
.ct-plist { margin-top: var(--s2); min-height: 120px; }
.ct-plist > .state { padding-top: 22px; }
.ct-archzone { margin-top: var(--s5); padding-top: 12px; border-top: 1px solid var(--hair); }
.ct-arch { margin-left: -12px; color: var(--ink); }
.ct-keep { font-size: var(--t-foot); color: var(--ink-2); padding: 8px 0; }

/* ---------------------------------------------------------------- the archive sheet */
.ct-arch__who { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 14px; padding: 2px 0 0; }
.ct-arch__id { min-width: 0; }
.ct-arch__name { font-size: 22px; font-weight: 760; font-stretch: 104%; letter-spacing: -.015em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-arch__where { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.ct-arch__lede { margin-top: 20px; font-size: var(--t-sub); font-weight: 650; }
.ct-arch__list { margin-top: 10px; display: grid; gap: 10px; list-style: none; }
/* plain consequences, indented under a small mark: an icon would say something else */
.ct-arch__list li { position: relative; padding-left: 20px; font-size: 15px; line-height: 1.42; }
.ct-arch__list li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.ct-arch__err:not(:empty) { margin-top: 14px; }
.ct-arch__err .notice { background: var(--chalk); }
.ct-arch__actions { display: grid; gap: 4px; margin-top: 22px; }
.ct-arch__keep { min-height: 48px; }

/* ---------------------------------------------------------------- the triage sheet */
.ct-tri { padding-top: 2px; }
.ct-tri__stack { position: relative; z-index: 3; isolation: isolate; padding-bottom: 14px; }
.ct-tri__card {
  position: relative; z-index: 2; padding: 16px 18px 16px; border-radius: var(--r-l);
  background: var(--chalk); box-shadow: inset 0 0 0 1px var(--hair-2), 0 1px 0 var(--hair);
  will-change: transform;
}
.ct-tri__card.is-leaving { position: absolute; left: 0; right: 0; top: 0; z-index: 4; pointer-events: none; }
.ct-tri__ghost {
  position: absolute; z-index: 0; left: 0; right: 0; top: 0; bottom: 14px; border-radius: var(--r-l);
  background: var(--chalk); box-shadow: inset 0 0 0 1px var(--hair-2);
  opacity: 0; transform: translateY(0) scale(1); transform-origin: 50% 100%;
  transition: opacity var(--d-smooth) var(--e-smooth), transform var(--d-snappy) var(--e-snappy);
}
.ct-tri__ghost[data-n="1"][data-on] { opacity: .8; transform: translateY(7px) scale(.955); }
.ct-tri__ghost[data-n="2"][data-on] { opacity: .5; transform: translateY(13px) scale(.91); }
.ct-tri__meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 540; color: var(--ink-2); }
.ct-tri__count { flex: none; font-weight: 650; color: var(--ink); }
.ct-tri__merchant { margin-top: 10px; font-size: 21px; font-weight: 720; letter-spacing: -.012em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-tri__amount { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.ct-tri__fig { font-size: 40px; font-weight: 800; font-stretch: 112%; letter-spacing: -.03em; line-height: 1.02; }
.ct-tri__unit { font-size: 14px; font-weight: 560; font-stretch: 104%; letter-spacing: .02em; color: var(--ink-2); }
.ct-tri__note { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.ct-tri__rule { margin-top: 6px; background: var(--chalk); }
.ct-tri__rulet { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-tri__rule .switch-row__text { min-width: 0; }
.ct-tri__grid { margin-top: 12px; }
/* the end of the pile */
.ct-done { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 32px 8px 0; }
.ct-done:focus { outline: none; }
.ct-done__mark { position: relative; display: grid; place-items: center; width: 84px; height: 84px; }
.ct-done__disc { position: relative; z-index: 1; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: var(--ink); color: var(--on-ink); }
.ct-done__disc .ico { width: 40px; height: 40px; stroke-width: 2.2; }
.ct-done__ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 2px var(--ink); opacity: 0; }
.ct-done__title { margin-top: 22px; font-size: 26px; font-weight: 760; font-stretch: 104%; letter-spacing: -.02em; }
.ct-done__text { margin-top: 6px; font-size: var(--t-sub); color: var(--ink-2); max-width: 26em; text-wrap: balance; }
.ct-done__btn { margin-top: 32px; }
.ct-done__room { display: block; height: 92px; }


/* a month with no purchase yet: one calm sentence, then the categories waiting as pills;
   no giant zero, no « 0,00 » in every header */
.ct-empty { padding: 22px 0 4px; }
.view[data-month-empty] .ct-head .ct-total__odo { font-size: 30px; color: var(--ink-2); }
.view[data-month-empty] .ct-head .ct-total__unit { font-size: 13px; }
.view[data-month-empty] .ct-group .group-h__aside { visibility: hidden; }
.view[data-month-empty] .ct-search { display: none; } /* nothing to find yet */
.view[data-month-empty] .ct-idle__label { display: none; }
.view[data-month-empty] .ct-group[data-empty] .ct-idle { margin-top: 14px; }
.view[data-searching] .ct-empty { display: none; }

/* No data at all (an error, or offline on a screen never loaded): no lone « AED » under the
   title and no search over nothing; the notice says what happened */
.view[data-error] .ct-head, .view[data-error] .ct-search { display: none; }

/* A category name is shown whole (up to 24 characters, the server's limit): it wraps to a second
   line beside a long amount or a zoomed text rather than ending on « … » (two lines at most) */
.ct-row .row__title { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; text-wrap: pretty; }
