/* ==========================================================================
   TeamTrek — the pay period
   --------------------------------------------------------------------------
   The payroll instrument, inside the shared panel frame.

   A roster says what a month was meant to be. The record says what it was.
   So the bar is a person's pay period cut three ways -- hours tracked
   against a task, hours past the target, and hours entered by hand -- with
   the target drawn across every row as one line.

   The target is a line rather than a bar because it is not work. It is the
   thing the work is being compared with, and a reader can see at a glance
   which rows stop short of it and which run past.

   Idle time is not drawn at all. It is never paid, so putting it on a
   payroll figure would invite somebody to think it might be.

   The frame around it lives in panel.css. Everything here is the
   instrument.
   ========================================================================== */
.pay {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  padding: .875rem .875rem .5rem;
}

.pay__head,
.pay__row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) 5rem 4.5rem;
  gap: .75rem;
  align-items: center;
}
.pay__head {
  margin: 0 0 .5rem;
  font-size: .625rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--neutral-500);
}
.pay__head span:nth-child(n+3) { text-align: right; }

/* ------------------------------------------------------------- the rows */
.pay__rows { display: grid; grid-auto-rows: minmax(0, 1fr); gap: .375rem; min-height: 0; }

.pay__who { min-width: 0; font-size: .75rem; color: var(--neutral-500); }
.pay__who b {
  display: block;
  font-size: .8125rem; font-weight: 700; color: var(--neutral-900);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* The period. Bars share one scale, and the longest of them is whichever
   person ran furthest past the target. */
.pay__bar {
  position: relative;
  display: flex; gap: 2px;
  height: 24px;
  border-radius: var(--r-xs);
  background: var(--neutral-100);
  overflow: hidden;
}
.pay__seg {
  flex: 0 0 auto;
  width: calc(var(--w, 0) * 1%);
  border-radius: 2px;
  transition: background-color var(--dur-ui) var(--ease-ui);
}
.pay__seg--reg { background: var(--primary-600); }
.pay__seg--ot  { background: var(--primary-400); }
/* Entered by hand, so it is drawn as an outline rather than a solid: the
   hours are real, and the record knows they were typed rather than timed. */
.pay__seg--man {
  background: var(--primary-100);
  box-shadow: inset 0 0 0 1.5px var(--primary-400);
}

/* The period target, across every row at the same place. */
.pay__target {
  position: absolute; top: -2px; bottom: -2px;
  left: calc(var(--t, 100) * 1%);
  width: 0;
  border-left: 2px dashed var(--neutral-400);
  pointer-events: none;
}

/* The person being read, from the rail. */
.pay__row.is-now .pay__seg--reg { box-shadow: inset 0 0 0 2px var(--primary-800); }

.pay__hours {
  text-align: right;
  font-size: .8125rem; font-weight: 700; color: var(--neutral-900);
  font-variant-numeric: tabular-nums;
}
/* Above or below the target. A difference, not a verdict: no colour says
   somebody worked too little. */
.pay__gap {
  text-align: right;
  font-size: .8125rem; font-weight: 700; color: var(--primary-700);
  font-variant-numeric: tabular-nums;
}
.pay__gap--under { color: var(--neutral-600); }

/* --------------------------------------------------------------- the key */
.pay__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);
}
.pay__key { display: inline-flex; align-items: center; gap: .375rem; }
.pay__key i { width: 11px; height: 11px; border-radius: 3px; background: var(--primary-600); }
.pay__key--ot i  { background: var(--primary-400); }
.pay__key--man i {
  background: var(--primary-100);
  box-shadow: inset 0 0 0 1.5px var(--primary-400);
}
.pay__key--target i {
  width: 0; height: 13px; border-radius: 0; background: none;
  border-left: 2px dashed var(--neutral-400);
}

@media (prefers-reduced-motion: reduce) {
  .pay__seg { transition: none; }
}

/* ------------------------------------------------------------- narrower */
@media (max-width: 959px) {
  .pay { padding: .75rem .75rem .5rem; }
  .pay__head,
  .pay__row { grid-template-columns: 7rem minmax(0, 1fr) 4.5rem 4rem; }
  .pay__rows { grid-auto-rows: 40px; }
}

/* --------------------------------------------------------------- phones */
@media (max-width: 599px) {
  .pay { padding: .625rem .5rem .5rem; }
  .pay__head,
  .pay__row { grid-template-columns: 5.5rem minmax(0, 1fr) 4rem 3.5rem; gap: .5rem; }
  .pay__head { font-size: .75rem; letter-spacing: .04em; }
  .pay__who b { font-size: .75rem; }
  .pay__who { font-size: 0; }
  .pay__hours,
  .pay__gap { font-size: .75rem; }
  .pay__foot { font-size: .75rem; gap: .25rem .75rem; }
}
