/*
 * Payroll. The list reuses the Clients classes (numbers, tools, table) and the
 * Team ones (a question asked in place, the team select); these are only what
 * Payroll adds. Every colour is a variable from theme.css. Nothing has a fixed
 * height that holds words: text wraps and boxes grow.
 */

/* The days on screen: the choices, the dates, and their pay period. */
.pay-bar {
  display: grid;
  gap: 12px;
  padding: var(--gap-2) 20px;
  margin-bottom: var(--gap-2);
}

.pay-bar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px var(--gap-2);
}

.pay-bar__row .team-filter {
  margin-left: auto;
}

.pay-bar .notice {
  margin-bottom: 0;
}

.pay-custom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pay-custom .field {
  margin-bottom: 0;
  min-width: 180px;
}

.pay-bar__state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-1) 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pay-bar__range {
  font-weight: 700;
}

.pay-bar__line {
  color: var(--ink-2);
  font-weight: 500;
}

.pay-bar__state .btn {
  min-height: 36px;
  padding: 6px 12px;
}

.pay-bar__state .btn:first-of-type {
  margin-left: auto;
}

.pay-ask {
  margin-bottom: var(--gap-2);
  padding: var(--gap-2) 20px;
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: 0 0 0 2px var(--amber);
}

.pay-failed {
  display: grid;
  justify-items: start;
  gap: var(--gap-1);
  padding: 4px 0 var(--gap-2);
}

.pay-failed .notice {
  margin-bottom: 0;
}

/* Changes that touched a period she already approved: a line that opens them. */
.pay-changes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-1) 12px;
  margin-bottom: var(--gap-2);
  padding: 10px var(--gap-2);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 0 0 2px var(--amber);
  font-weight: 600;
}

.pay-changes svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.pay-changes .btn {
  margin-left: auto;
  min-height: 36px;
  padding: 6px 12px;
}

.pay-downloads {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--gap-1);
  margin-left: auto;
}

/* The table: the name column and the issues column take their room. */
.pay-table .tbl .col-who {
  min-width: 200px;
}

.pay-notfinal {
  display: inline-grid;
  justify-items: end;
  font-weight: 600;
}

.pay-notfinal .sub {
  font-weight: 500;
}

.pay-issues {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

/* The side panel ----------------------------------------------------------- */

.pay-panel {
  padding: 4px 0 20px;
}

.pay-panel > .notice,
.pay-panel > .pay-back,
.pay-panel > .pay-failed {
  margin-left: 20px;
  margin-right: 20px;
}

.pay-heading {
  margin: var(--gap-2) 20px var(--gap-1);
  font-size: var(--size-body);
  font-weight: 700;
}

.pay-now {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-1) 12px;
}

.pay-now .btn,
.pay-overlaps .btn,
.pay-panel .tbl .btn {
  min-height: 32px;
  padding: 4px 10px;
}

.pay-actions {
  padding-top: 0;
}

.pay-notpaid {
  display: inline-grid;
  justify-items: end;
}

.pay-back {
  padding-bottom: var(--gap-1);
}

.pay-back__btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.pay-overlaps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pay-problem {
  display: grid;
  gap: 4px;
  margin: 0 20px var(--gap-2);
  padding: 12px var(--gap-2);
  border-radius: var(--radius);
  background: var(--chip);
}

.pay-problem.is-fault {
  background: var(--card);
  box-shadow: 0 0 0 2px var(--red);
}

.pay-problem__head {
  font-size: var(--size-small);
  font-weight: 700;
}

.pay-form {
  padding-bottom: 4px;
}

.pay-form .facts {
  padding: 0 0 var(--gap-2);
}

.pay-check {
  margin-bottom: var(--gap-2);
}

/* A shift's history and the list of pay periods: one entry each, wrapped. */
.pay-history,
.pay-periods {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pay-history__item,
.pay-period {
  display: grid;
  gap: 4px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.pay-history__item:last-child,
.pay-period:last-child {
  border-bottom: 0;
}

.pay-history__head,
.pay-period__range {
  font-weight: 700;
}

.pay-history .sub,
.pay-period .sub {
  color: var(--ink-2);
  font-size: var(--size-small);
}

.pay-period__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-1);
}

.pay-period .team-ask__actions {
  margin-top: 6px;
}

.pay-period .team-ask__actions .btn {
  min-height: 34px;
  padding: 5px 12px;
}

.facts .pay-notfinal {
  justify-items: start;
}

/* "Not final yet" and "So far $282.80" are words in a column of numbers: they may
   wrap (D1); the amount has no space in it, so it never breaks. */
.tbl .is-num .pay-notfinal__words {
  white-space: normal;
}

.pay-panel .tbl .pay-day {
  min-width: 110px;
}
