/* ==========================================================================
   TeamTrek — clients, their projects, and what is billable inside them
   --------------------------------------------------------------------------
   The hero figure on the client project tracking page: three clients, the
   projects under them, and the month they add up to.

   A roll-up rather than a record. The other three pages in this group draw
   what is happening -- a timer, a task, a team's week; this page is about
   what those hours become when somebody has to answer a client, and that is
   an addition. So the panel is built as an addition: the projects are
   indented under the client whose total they make, and the month at the
   head is made of the three clients.

   1056 by 482, like every other hero figure on the site.
   ========================================================================== */

.ledger {
  width: 100%; max-width: 66rem; margin-inline: auto;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--neutral-200); border-radius: var(--r-xl);
  background: #fff;
  /* Heavier than the shared shadow: the panel straddles the dark band and
     the dome, and a light shadow over the dark half disappears. */
  box-shadow: 0 30px 80px rgba(8, 40, 36, .28);
  text-align: left;
  display: flex; flex-direction: column;
}

/* ------------------------------------------------------------- the head */
.ledger__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding-bottom: .875rem;
  border-bottom: 1px solid var(--neutral-200);
}
.ledger__state {
  display: flex; align-items: center; gap: .5rem;
  font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--primary-700);
}
.ledger__what { font-size: .9375rem; font-weight: 700; color: var(--neutral-900); }
.ledger__who { font-size: .8125rem; color: var(--neutral-500); }
.ledger__month {
  margin-left: auto;
  font-size: .8125rem; color: var(--neutral-500); font-variant-numeric: tabular-nums;
}
.ledger__month b { font-weight: 800; color: var(--neutral-900); }

/* ------------------------------------------------------------- the rows */
.ledger__rows {
  flex: 1; min-height: 0;
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; justify-content: center; gap: .125rem;
}

/* A client: the name, the share of the month, and the total its projects
   make. */
.ledger__client {
  display: grid; grid-template-columns: 12rem minmax(0, 1fr) 7rem;
  align-items: center; gap: 1rem;
  padding: .625rem 0 .5rem;
}
.ledger__client + .ledger__client { margin-top: .25rem; }

.ledger__name { font-size: .9375rem; font-weight: 700; color: var(--neutral-900); }
.ledger__name span { display: block; font-size: .75rem; font-weight: 400; color: var(--neutral-500); }

.ledger__bar {
  display: block; height: 1.25rem;
  border-radius: var(--r-sm); background: var(--neutral-50);
  box-shadow: inset 0 0 0 1px var(--neutral-150);
  overflow: hidden;
}
.ledger__bar i {
  display: block; height: 100%; width: var(--w, 0%);
  border-radius: inherit; background: var(--primary-400);
  transition: width var(--dur-slow, 700ms) var(--ease-brand);
}

.ledger__sum {
  text-align: right;
  font-size: 1rem; font-weight: 800; color: var(--neutral-900);
  font-variant-numeric: tabular-nums;
}

/* A project under it. Indented and lighter, because it is an operand and
   the client above it is the sum. */
.ledger__project {
  display: grid; grid-template-columns: 12rem minmax(0, 1fr) 7rem;
  align-items: center; gap: 1rem;
  padding: .3125rem 0;
}
.ledger__leaf {
  position: relative;
  padding-left: 1.25rem;
  font-size: .8125rem; color: var(--neutral-600);
}
/* The elbow that says this line belongs to the one above it. */
.ledger__leaf::before {
  content: ""; position: absolute;
  left: .375rem; top: -.5rem; bottom: .5rem; width: .5rem;
  border-left: 1px solid var(--neutral-200);
  border-bottom: 1px solid var(--neutral-200);
  border-bottom-left-radius: 4px;
}
.ledger__hours {
  grid-column: 3;
  text-align: right;
  font-size: .8125rem; color: var(--neutral-600); font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------- the foot */
.ledger__foot {
  flex: none;
  margin: 0; padding-top: .875rem;
  border-top: 1px solid var(--neutral-200);
}
.ledger__note {
  display: flex; align-items: center; gap: .5rem;
  font-size: .75rem; color: var(--neutral-500);
}
.ledger__note .icon { flex: none; color: var(--neutral-400); }

/* ------------------------------------------------------------------ sizes */
@media (min-width: 860px) {
  /* The figure every other hero on the site carries. */
  .ledger { height: 482px; }
}

@media (max-width: 859px) {
  .ledger { padding: 1.125rem 1.25rem; }
  .ledger__client,
  .ledger__project { grid-template-columns: 9rem minmax(0, 1fr) 6rem; gap: .75rem; }
}

@media (max-width: 599px) {
  .ledger { padding: 1rem; }
  /* The names and the figures. A 90px bar reads as a smudge, and the
     client totals beside it say the same thing exactly. */
  .ledger__client,
  .ledger__project { grid-template-columns: minmax(0, 1fr) 6rem; }
  .ledger__bar { display: none; }
  .ledger__hours { grid-column: 2; }
}

/* --------------------------------------------------------------------------
   One client's month, and what is billable in it
   --------------------------------------------------------------------------
   Section 04's figure: the view a client conversation actually happens in.
   Two projects, and inside each bar the share of its hours that go on the
   invoice.

   The billable hours are drawn inside the project rather than beside it,
   because they are part of the same figure: "how much of it" is a question
   about the hours already on the page, not a second measurement.
   -------------------------------------------------------------------------- */
.bill {
  margin-top: 2.5rem; padding: 1.5rem;
  border: 1px solid var(--neutral-200); border-radius: var(--r-lg);
  background: #fff;
}

.bill__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--neutral-150);
}
.bill__who { font-size: .9375rem; font-weight: 700; color: var(--neutral-900); }
.bill__who span { display: block; font-size: .75rem; font-weight: 400; color: var(--neutral-500); }
.bill__when { font-size: .8125rem; color: var(--neutral-500); }
.bill__total {
  margin-left: auto;
  font-size: .8125rem; color: var(--neutral-500); font-variant-numeric: tabular-nums;
}
.bill__total b { font-weight: 700; color: var(--neutral-900); }

.bill__rows { margin: .5rem 0 0; padding: 0; list-style: none; }
.bill__row {
  display: grid; grid-template-columns: 12rem minmax(0, 1fr) 11rem;
  align-items: center; gap: 1rem;
  padding: 1rem 0;
}
.bill__row + .bill__row { border-top: 1px solid var(--neutral-150); }

.bill__name { font-size: .875rem; font-weight: 700; color: var(--neutral-900); }
.bill__name span { display: block; font-size: .75rem; font-weight: 400; color: var(--neutral-500); }

/* The whole bar is the project's tracked hours; the filled part is the
   billable share of them. */
.bill__track {
  position: relative; display: block; height: 2.25rem;
  border-radius: var(--r-sm);
  background: var(--neutral-100);
  box-shadow: inset 0 0 0 1px var(--neutral-150);
  overflow: hidden;
}
.bill__billable {
  display: block; height: 100%; width: var(--w, 0%);
  background: var(--primary-500);
}

.bill__out { text-align: right; }
.bill__out b {
  display: block;
  font-size: .9375rem; font-weight: 800; color: var(--neutral-900);
  font-variant-numeric: tabular-nums;
}
.bill__out span { display: block; font-size: .75rem; color: var(--primary-700); font-variant-numeric: tabular-nums; }

/* The three figures the two bars add up to. */
.bill__sums {
  margin-top: 1.25rem; padding-top: 1.25rem;
  border-top: 1px solid var(--neutral-200);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.bill__sum { margin: 0; }
.bill__sum b {
  display: block;
  font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em;
  color: var(--neutral-900); font-variant-numeric: tabular-nums;
}
.bill__sum span { display: block; margin-top: .125rem; font-size: .8125rem; color: var(--neutral-500); }
.bill__sum--key b { color: var(--primary-700); }

@media (max-width: 859px) {
  .bill { padding: 1.25rem; }
  .bill__row { grid-template-columns: 9rem minmax(0, 1fr) 9rem; gap: .75rem; }
  .bill__sums { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .875rem 1rem; }
  .bill__sum b { font-size: 1.125rem; }
}

@media (max-width: 599px) {
  .bill { padding: 1rem; }
  /* The name and the two figures. The bar's share is stated in the row. */
  .bill__row { grid-template-columns: minmax(0, 1fr) 8rem; }
  .bill__track { display: none; }
}
