/* ===========================================================================
   Claims and insurers - a tab inside Book Movement. Class prefix cl-.

   EVERY COLOUR IS A THEME-AWARE TOKEN, so there is no dark value declared here
   to be declared a second time. Series colours: gold (chrome) for a single
   series of bars, --s2 teal and --s3 wine for the two directions of the state
   chart (the sign and the figure carry the meaning too, never the colour alone),
   --warn and --bad for the two oldest age buckets (state, with the words).

   NOTHING RESTS AT OPACITY 0. The bars grow in from the left with a keyframed
   transform and `backwards` fill, only while .cl-enter is on the root for the
   first second after a paint; an animation that never gets a frame leaves them
   full length. Reduced motion switches every one off.
   =========================================================================== */

.cl-root { display: flex; flex-direction: column; gap: var(--sp-6); min-width: 0; }
.cl-lede { margin: 0; color: var(--text-soft); font-size: var(--fs-lg); }

/* ---- the lead strip ---- */
.cl-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--sp-5); }
.cl-kpi {
  display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0;
  padding: var(--sp-5) var(--sp-6); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.cl-k-l { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-soft); }
.cl-k-v { font-size: var(--fs-3xl); font-weight: var(--fw-bold); line-height: 1.1; font-variant-numeric: tabular-nums; width: fit-content; }
.cl-k-s { font-size: var(--fs-xs); color: var(--text-soft); }

/* ---- panels ---- */
.cl-panel { min-width: 0; }
.cl-ph .hint { margin-left: 0; }
.cl-src { margin: 0; padding: var(--sp-4) 1.05rem 0; font-size: var(--fs-xs); color: var(--text-soft); line-height: 1.5; }
.cl-age.is-stale { background: var(--warn-weak); border: 1px solid var(--warn-line); color: var(--text); padding: 0 var(--sp-3); border-radius: var(--r-xs); }
.cl-body { padding: var(--sp-6) 1.05rem 1.05rem; min-width: 0; }
.cl-note { margin: var(--sp-5) 0 0; font-size: var(--fs-xs); color: var(--text-soft); line-height: 1.5; max-width: 80ch; }
.cl-empty { margin: var(--sp-5) 0; color: var(--text-soft); font-size: var(--fs-md); max-width: 70ch; }
.cl-is-grey { background: var(--surface-2); box-shadow: none; }
.cl-is-grey::before { display: none; }
.cl-greyp { display: flex; gap: var(--sp-4); align-items: flex-start; margin: 0; color: var(--text-soft); font-size: var(--fs-md); max-width: 75ch; line-height: 1.5; }
.cl-greyp > i { color: var(--text-dim); flex: 0 0 auto; margin-top: .15rem; }

.cl-pair { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
.cl-pcol { display: flex; flex-direction: column; gap: var(--sp-6); min-width: 0; }

/* ---- the grid tables ---- */
.cl-tbl { min-width: 0; }
.cl-head, .cl-row { display: grid; gap: var(--sp-5); align-items: center; padding: .5rem var(--sp-5); }
.cl-head { border-bottom: 1px solid var(--border); font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-soft); align-items: end; }
.cl-row { border-top: 1px solid var(--border-soft); font-size: var(--fs-md); min-height: 2.45rem; }
.cl-head + .cl-rows > .cl-row:first-child { border-top: 0; }
.cl-row[data-cl-act] { cursor: pointer; transition: background .14s var(--ease); }
.cl-row[data-cl-act]:hover { background: var(--accent-weak); }
.cl-other { background: var(--surface-2); border-top: 1px solid var(--border); }
.cl-c { min-width: 0; display: flex; align-items: center; gap: var(--sp-3); }
.cl-r { justify-content: flex-end; text-align: right; }
/* A figure with a labelled second line under it: the fee, and "advanced $X" (volume) beneath it. */
.cl-c.cl-two { flex-direction: column; align-items: flex-end; gap: 0; }
.cl-two > .cl-sub { line-height: 1.3; white-space: nowrap; cursor: help; }
.cl-hl { overflow-wrap: anywhere; }
.cl-sortable { cursor: pointer; user-select: none; }
.cl-sortable:hover { color: var(--text); }
.cl-sortable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
.cl-sorted { color: var(--accent-ink); }
.cl-sic { font-size: var(--fs-3xs); flex: 0 0 auto; }
.cl-v { font-variant-numeric: tabular-nums; min-width: 0; }
.cl-na { color: var(--text-dim); cursor: help; }
.cl-delta.up { color: var(--ok); font-weight: var(--fw-medium); }
.cl-delta.down { color: var(--bad); font-weight: var(--fw-medium); }
.cl-delta.flat { color: var(--text-soft); }
.cl-nmc { flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-4); }
.cl-nm, .cl-nm-plain { font-weight: var(--fw-medium); color: var(--text); overflow-wrap: anywhere; text-decoration: none; }
a.cl-nm-plain:hover { text-decoration: underline; }
.cl-nm { cursor: pointer; }
.cl-nm:hover { text-decoration: underline; text-decoration-color: var(--accent-line); }
.cl-nm:focus-visible, a.cl-nm-plain:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
.cl-rk { color: var(--text-soft); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; min-width: 1.3rem; }
.cl-sub { font-size: var(--fs-xs); color: var(--text-soft); font-weight: var(--fw-normal); }
.cl-nmc > .cl-sub { flex-basis: 100%; }
.cl-out .cl-nmc > .cl-sub, .cl-status .cl-nmc > .cl-sub, .cl-drill .cl-nmc > .cl-sub { flex-basis: auto; }
.cl-more { margin-top: var(--sp-5); }
.cl-hintline { font-size: var(--fs-xs); color: var(--text-soft); }
.cl-tools { display: flex; align-items: center; gap: var(--sp-6); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.cl-band { margin: var(--sp-5) 0 0; font-size: var(--fs-sm); color: var(--text-soft); line-height: 1.5; max-width: 90ch; }
.cl-band b { color: var(--text); font-weight: var(--fw-medium); }

/* the three tables' columns */
.cl-ins .cl-head, .cl-ins .cl-row { grid-template-columns: minmax(9.5rem, 1.5fr) minmax(8rem, 1.2fr) 6.6rem 5.4rem 4.4rem minmax(8.6rem, 1.2fr) 4.4rem 4.4rem; }
.cl-out .cl-head, .cl-out .cl-row { grid-template-columns: minmax(9rem, 1.2fr) minmax(11rem, 2fr) 5rem 5rem; }
.cl-stt .cl-head, .cl-stt .cl-row { grid-template-columns: minmax(4.6rem, 1fr) 4.8rem 4.8rem minmax(9rem, 1.7fr) 4.6rem 5.2rem; }
.cl-status .cl-head, .cl-status .cl-row { grid-template-columns: minmax(8rem, 1.5fr) 4.4rem 5.2rem 5.6rem minmax(6.5rem, 1fr); }
.cl-drill .cl-head, .cl-drill .cl-row { grid-template-columns: minmax(10rem, 2fr) 5rem 5rem 3.6rem 6.6rem; }
.cl-drill-age .cl-head, .cl-drill-age .cl-row { grid-template-columns: minmax(10rem, 2fr) 5.6rem 6.6rem 5rem 5.4rem; }

/* ---- bars ---- */
.cl-sh { gap: var(--sp-4); }
.cl-sh > .cl-v { min-width: 3.2rem; text-align: right; }
.cl-bar { position: relative; flex: 1 1 auto; min-width: 2rem; height: .5rem; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.cl-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--gold-500); border-radius: var(--r-pill); transform-origin: left; }
.cl-dy { gap: var(--sp-4); }
.cl-rng { position: relative; flex: 1 1 auto; min-width: 2.4rem; height: .5rem; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.cl-rng > i { position: absolute; top: 0; bottom: 0; transform-origin: left; }
.cl-rng-m { left: 0; background: var(--s2); }
.cl-rng-p { background: var(--s2); opacity: .38; }
.cl-dy > .cl-v { min-width: 4.6rem; text-align: right; white-space: nowrap; }
.cl-chg { gap: var(--sp-4); }
.cl-chg > .cl-v { min-width: 3.7rem; text-align: right; white-space: nowrap; }
.cl-div { position: relative; flex: 1 1 auto; min-width: 3rem; height: .5rem; background: var(--surface-3); border-radius: var(--r-xs); }
.cl-div::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; border-left: 1px solid var(--text-dim); }
.cl-div > i { position: absolute; top: 0; bottom: 0; }
.cl-div-pos { left: 50%; background: var(--s2); border-radius: 0 var(--r-xs) var(--r-xs) 0; transform-origin: left; }
.cl-div-neg { right: 50%; background: var(--s3); border-radius: var(--r-xs) 0 0 var(--r-xs); transform-origin: right; }

/* ---- the spread panel ---- */
.cl-sps { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--sp-6); margin-bottom: var(--sp-6); }
.cl-sp { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding: var(--sp-5) var(--sp-6); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.cl-sp-v { font-size: var(--fs-3xl); font-weight: var(--fw-bold); line-height: 1.1; font-variant-numeric: tabular-nums; width: fit-content; }
.cl-sp-l { font-size: var(--fs-md); font-weight: var(--fw-medium); }
.cl-sp-s { font-size: var(--fs-xs); color: var(--text-soft); line-height: 1.5; }
.cl-ask { background: var(--accent-weak); border: 1px solid var(--accent-line); border-radius: var(--r-sm); padding: var(--sp-5) var(--sp-6); margin-bottom: var(--sp-6); max-width: 100ch; }
.cl-ask-h { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-md); color: var(--accent-ink); font-weight: var(--fw-bold); }
.cl-ask p { margin: var(--sp-3) 0 0; font-size: var(--fs-md); line-height: 1.55; }
.cl-ask .cl-q { color: var(--text-soft); font-style: italic; border-left: 3px solid var(--accent-line); padding-left: var(--sp-5); }
.cl-legend { font-size: var(--fs-xs); color: var(--text-soft); margin: 0 0 var(--sp-4); line-height: 1.6; }
.cl-key { display: inline-block; width: 1.3rem; vertical-align: middle; margin: 0 var(--sp-3) 0 var(--sp-2); border-top: 2px dashed var(--text-soft); }
.cl-key.solid { border-top-style: solid; }
.cl-tk { gap: var(--sp-4); }
.cl-trk { position: relative; flex: 1 1 auto; min-width: 5rem; height: .65rem; background: var(--surface-3); border-radius: var(--r-xs); }
.cl-trk > i { position: absolute; inset: 0 auto 0 0; background: var(--gold-500); border-radius: var(--r-xs); transform-origin: left; }
.cl-ref { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 1px dashed var(--text-soft); z-index: 1; }
.cl-ref.solid { border-left-style: solid; }
.cl-tk > .cl-v { min-width: 3.2rem; text-align: right; }

/* ---- open claims by age ---- */
.cl-ages { display: flex; flex-direction: column; gap: var(--sp-3); }
.cl-arow { display: grid; grid-template-columns: 7.2rem minmax(5rem, 1fr) 6.2rem 7.4rem; gap: var(--sp-5); align-items: center; padding: var(--sp-3) 0; }
.cl-al { font-size: var(--fs-md); font-weight: var(--fw-medium); }
.cl-abar { position: relative; height: .7rem; background: var(--surface-3); border-radius: var(--r-xs); }
.cl-abar > i { position: absolute; inset: 0 auto 0 0; border-radius: var(--r-xs); background: var(--gold-500); transform-origin: left; }
.cl-abar > i.warn { background: var(--warn); }
.cl-abar > i.bad { background: var(--bad); }
.cl-av { display: flex; flex-direction: column; align-items: flex-end; font-size: var(--fs-md); }
.cl-seeb { white-space: nowrap; }

/* ---- where claims stand ---- */
.cl-meter { display: flex; align-items: center; gap: var(--sp-5); margin-bottom: var(--sp-5); font-size: var(--fs-md); }
.cl-meter-t { font-weight: var(--fw-medium); }
.cl-meter-trk { position: relative; flex: 1 1 auto; height: .6rem; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.cl-meter-trk > i { position: absolute; inset: 0 auto 0 0; background: var(--gold-500); border-radius: var(--r-pill); transform-origin: left; }

/* ---- the footer ---- */
.cl-foot { margin: 0; font-size: var(--fs-xs); color: var(--text-soft); line-height: 1.6; max-width: 120ch; }
.cl-late { background: var(--warn-weak); border: 1px solid var(--warn-line); color: var(--text); padding: 0 var(--sp-3); border-radius: var(--r-xs); font-weight: var(--fw-medium); }

/* ---- the dialog ---- */
.cl-modal .modal-body { font-size: var(--fs-md); }
.cl-dg { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--sp-5); }
.cl-d { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-5); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); min-width: 0; }
.cl-d-k { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-soft); width: fit-content; }
.cl-d-v { font-size: var(--fs-2xl); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.cl-d-n { font-size: var(--fs-xs); color: var(--text-soft); line-height: 1.45; }
.cl-dh { font-size: var(--fs-lg); font-weight: var(--fw-bold); margin: var(--sp-7) 0 var(--sp-4); }
.cl-dp { margin: var(--sp-6) 0 var(--sp-4); line-height: 1.55; max-width: 80ch; }
.cl-dfoot { margin: var(--sp-5) 0; font-size: var(--fs-sm); color: var(--text-soft); }
.cl-rg { display: grid; grid-template-columns: 10rem minmax(6rem, 1fr) minmax(12rem, auto); gap: var(--sp-5); align-items: center; padding: var(--sp-3) 0; }
.cl-rg-l { font-weight: var(--fw-medium); width: fit-content; }
.cl-rg-trk { position: relative; height: .5rem; background: var(--surface-3); border-radius: var(--r-pill); }
.cl-rg-trk > b { position: absolute; top: 50%; width: .95rem; height: .95rem; margin: -.475rem 0 0 -.475rem; background: var(--gold-500); border: 2px solid var(--surface); border-radius: var(--r-circle); box-shadow: var(--shadow); }
.cl-rg-t { font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }

/* ---- the bars arrive once, from the left ---- */
@keyframes clGrow { from { transform: scaleX(0); } }
.cl-enter .cl-bar > i, .cl-enter .cl-trk > i, .cl-enter .cl-abar > i, .cl-enter .cl-meter-trk > i,
.cl-enter .cl-rng > i, .cl-enter .cl-div > i { animation: clGrow .6s var(--ease-out) backwards; }

@media (max-width: 1100px) {
  .cl-pair { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .cl-enter .cl-bar > i, .cl-enter .cl-trk > i, .cl-enter .cl-abar > i, .cl-enter .cl-meter-trk > i,
  .cl-enter .cl-rng > i, .cl-enter .cl-div > i { animation: none; }
  .cl-row[data-cl-act] { transition: none; }
}
