/* ==========================================================================
   TeamTrek — the client bars
   --------------------------------------------------------------------------
   The client-billing instrument, inside the shared panel frame.

   One bar per client across a month, cut once: the part that can go on an
   invoice, and the part that cannot. That single cut is what the page is
   about, so it is the only distinction the figure draws -- no activity, no
   rates, no totals in money.

   Internal work is a client row like any other, with nothing billable in
   it. Leaving it out would make the month look better than it was, and the
   page's argument is that the record does not flatter anybody.

   The frame around it lives in panel.css. Everything here is the
   instrument.
   ========================================================================== */
.bill {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  padding: .875rem .875rem .5rem;
}

/* The columns, above the bars. The name column matches the rows' own. */
.bill__head,
.bill__row {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr) 4.5rem;
  gap: .75rem;
  align-items: center;
}
.bill__head {
  margin: 0 0 .5rem;
  font-size: .625rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--neutral-500);
}
.bill__head span:last-child { text-align: right; }

/* ------------------------------------------------------------- the rows */
.bill__rows { display: grid; grid-auto-rows: minmax(0, 1fr); gap: .375rem; min-height: 0; }

.bill__who { min-width: 0; font-size: .75rem; color: var(--neutral-500); }
.bill__who b {
  display: block;
  font-size: .8125rem; font-weight: 700; color: var(--neutral-900);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* The month. Bars share one scale, so a long client reads as a long client
   rather than as a full bar like everybody else. */
.bill__bar {
  display: flex; gap: 2px;
  height: 24px;
  border-radius: var(--r-xs);
  background: var(--neutral-100);
  overflow: hidden;
}
/* Widths are a share of the longest client's month, not of the bar, so one
   row is comparable with the next. */
.bill__seg {
  flex: 0 0 auto;
  width: calc(var(--w, 0) * 1%);
  border-radius: 2px;
  transition: background-color var(--dur-ui) var(--ease-ui);
}
.bill__seg--yes { background: var(--primary-600); }
/* Not billable is drawn, not hidden: the hours happened. It is lighter and
   outlined so it reads as the same month, counted differently. */
.bill__seg--no {
  background: var(--primary-100);
  box-shadow: inset 0 0 0 1px var(--primary-200);
}
/* The client being read, from the rail. */
.bill__row.is-now .bill__seg--yes { box-shadow: inset 0 0 0 2px var(--primary-800); }

.bill__hours {
  text-align: right;
  font-size: .8125rem; font-weight: 700; color: var(--neutral-900);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- the key */
.bill__foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: .375rem 1rem;
  margin: .75rem 0 0; padding-top: .625rem;
  border-top: 1px solid var(--neutral-150);
  font-size: .625rem; color: var(--neutral-500);
}
.bill__key { display: inline-flex; align-items: center; gap: .375rem; }
.bill__key i { width: 11px; height: 11px; border-radius: 3px; background: var(--primary-600); }
.bill__key--no i {
  background: var(--primary-100);
  box-shadow: inset 0 0 0 1px var(--primary-200);
}

@media (prefers-reduced-motion: reduce) {
  .bill__seg { transition: none; }
}

/* ------------------------------------------------------------- narrower */
@media (max-width: 959px) {
  .bill { padding: .75rem .75rem .5rem; }
  .bill__head,
  .bill__row { grid-template-columns: 7.5rem minmax(0, 1fr) 4rem; }
  .bill__rows { grid-auto-rows: 40px; }
}

/* --------------------------------------------------------------- phones */
@media (max-width: 599px) {
  .bill { padding: .625rem .5rem .5rem; }
  .bill__head,
  .bill__row { grid-template-columns: 6rem minmax(0, 1fr) 3.5rem; gap: .5rem; }
  .bill__head { font-size: .75rem; letter-spacing: .04em; }
  .bill__who b { font-size: .75rem; }
  .bill__who { font-size: 0; }
  .bill__hours { font-size: .75rem; }
  .bill__foot { font-size: .75rem; gap: .25rem .75rem; }
}
