/* ===========================================================================
   Companies
   ---------------------------------------------------------------------------
   One bordered table with its controls inside it, rather than a card with a
   toolbar floating above. The pain score is a ring rather than a number in a
   pill: it is the figure the whole pipeline is ordered by, and a ring reads as
   a proportion at a glance where a number has to be compared.
   =========================================================================== */

/* Clip, not hidden: hidden makes the table a scroller of its own, and the
   column heads would pin to it rather than to the page. The container is the
   reference one (the drawer's .ovbox): a 16px radius, a faint edge, the
   softest shadow; its rows sit on the drawer type scale (Item, Label, the
   row's 15px figure). */
.table {
  background: var(--card); border: 1px solid rgba(16, 33, 31, .07); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(16, 33, 31, .04); overflow: clip }
.table__toolbar {
  display: flex; align-items: center; gap: 8px;
  /* 24 all round: the sides line up with the table's first column, and the
     top and bottom match them so the bar sits evenly in its space */
  padding: 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.table__tools { margin-left: auto; display: flex; align-items: center; gap: 8px }
.table__filters {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.table__filters .select { width: auto; min-width: 150px }
/* Was an inline style, which a phone stylesheet cannot override. */
.table__order { margin-left: auto }

/* Holds the head and the rows together so they scroll as one. It does
   nothing until a phone gives the grid a width the screen cannot hold. */
.table__scroll { min-width: 0 }
/* The column heads pin to the top of the page while the list scrolls under
   them: they are the only labels the rings, counts and values have. The page
   has 32px of padding above, so -32px pins them flush with its top. On a
   phone the head has a scroller of its own that the rows' one moves (app.js),
   so it isn't swiped by itself. */
.table__head { position: sticky; top: -32px; z-index: 2; background: var(--page) }
.table__head > .table__scroll { overflow-x: hidden }
/* Where the head rests: once it is above the top of the page, the head is pinned. */
.table__pinmark { height: 0 }

.corow {
  /* Each column grows only as far as what it holds, and whatever is left
     falls equally between the columns, so the gaps match at any width. Sized
     by fr, each column kept its own slack and the gaps came out 14px, 143px
     and 20px side by side. The minimums let a narrow window squeeze them. */
  display: grid; justify-content: space-between;
  grid-template-columns:
    minmax(112px, min(24%, 300px)) minmax(60px, 84px) minmax(56px, 76px)
    minmax(84px, 136px) minmax(64px, 112px) minmax(62px, 88px) minmax(80px, 110px);
  gap: 20px; align-items: center; padding: 24px 24px;
  border-bottom: 1px solid var(--hair); width: 100%;
  background: none; border-left: none; border-right: none; border-top: none;
  font-family: inherit; text-align: left; color: var(--text); cursor: pointer;
}
/* Below this the capped columns no longer fit beside the sidebar, so they
   share the width by what each holds, and the names keep the most. Under
   901px the phone rule gives the table a sideways scroller instead. */
@media (min-width: 901px) and (max-width: 1159px) {
  .corow { grid-template-columns: 2fr .75fr .7fr 1.05fr .8fr .75fr .9fr; gap: 12px }
}
.corow:hover { background: var(--page) }
.corow--head {
  background: var(--page); cursor: default; padding: 16px 24px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; font-weight: 500; color: var(--muted);
}
.corow--head:hover { background: var(--page) }
.corow__mark {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px;
  background: var(--coral); color: var(--on-coral);
  display: grid; place-items: center; font-size: 12px; font-weight: var(--weight-strong);
}
.corow__name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
/* A client says so in green under its name, before the domain, which gives way. */
.corow__sub { display: flex; align-items: center; gap: 8px; min-width: 0 }
.corow__sub > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis }
.corow__client {
  display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto;
  font-weight: 500; color: #1E7A4A; white-space: nowrap;
}
.corow__client .ms { font-size: 14px }
.corow__site { font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.corow__right { text-align: right; font-size: 15px; font-weight: var(--weight-strong); font-variant-numeric: tabular-nums }

/* Pain score, as a ring. The conic gradient is set inline because the angle is
   the datum. */
.wheel { width: 38px; height: 38px; flex: 0 0 38px; border-radius: var(--r-pill); display: grid; place-items: center }
.wheel__inner {
  width: 28px; height: 28px; border-radius: var(--r-pill); background: var(--card);
  display: grid; place-items: center; font-size: 11.5px; font-weight: var(--weight-strong); color: var(--text);
}
/* A company's research where its fit will be (researchCell): the fit's ring
   with the state's mark inside, the state beside it in the stage name's
   size, and under that the step or the turn. Teal while it runs, the ring
   filling a step at a time; amber where it cannot go on. */
.cofit { display: inline-flex; align-items: center; gap: 10px; min-width: 0 }
/* Fit is the one centred column: a ring is far narrower than the words a
   company being researched shows, and centring shares that difference between
   both sides. The words may spread into the column gaps, which are always
   empty, stopping 4px short of the neighbours at the narrowest gap. */
.corow__fit { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; min-width: 0 }
.corow__fit .cofit { width: max-content; max-width: calc(100% + 32px) }
@media (min-width: 901px) and (max-width: 1159px) { .corow__fit .cofit { max-width: calc(100% + 16px) } }
.cofit__ring .ms { font-size: 16px; color: var(--muted) }
.cofit__said { display: grid; gap: 2px; min-width: 0 }
.cofit__said > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.cofit__said b { font-size: 13px; font-weight: var(--weight-strong); color: var(--text) }
.cofit__said span { font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums }
.cofit.is-run .ms, .cofit.is-run b { color: color-mix(in srgb, var(--teal) 62%, var(--ink)) }
.cofit.is-warn .ms, .cofit.is-warn b { color: #8A5A00 }
/* Scheduled: the calendar mark in ink, since the date beside it is settled. */
.cofit.is-plan .ms { color: var(--text) }

/* The loading rows this table used to define for itself are now the app-wide
   skeleton system — see "Skeletons", above. They are built out of .corow and
   .corow--head, so they inherit this table's columns and its phone scroller
   rather than approximating them. */


/* Table cells: an age in its colour for the last contact. */
.recency { font-size: 12.5px; font-weight: 500; white-space: nowrap }
.recency--fresh { color: #1E7A4A }
.recency--warm { color: var(--muted) }
.recency--cold, .recency--none { color: #9A9A9A; font-weight: 500 }
.valuebar { display: block; height: 4px; margin-top: 6px; margin-left: auto; width: 100%; max-width: 110px; border-radius: var(--r-pill); background: var(--page); overflow: hidden }
/* Current deal value: a client's won deals as the figure, with the count
   under it as a label; anyone else, "Not a customer" in the label's grey. */
.coclient { display: grid; justify-items: end; gap: 2px }
.coclient__n, .coclient__none { font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap }
.valuebar i { display: block; height: 100%; margin-left: auto; border-radius: var(--r-pill); background: var(--teal) }

/* Contacts: up to three of the company's faces, overlapping, each ringed in
   the row's colour so the edges read, with the count beside them. */
.costack { gap: 8px; min-width: 0 }
.costack__faces { display: inline-flex; flex: 0 0 auto }
.costack__face {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 99px;
  display: grid; place-items: center; font-size: 9px; font-weight: var(--weight-strong);
  box-shadow: 0 0 0 2px var(--card);
}
.costack__face + .costack__face { margin-left: -8px }
.corow:hover .costack__face { box-shadow: 0 0 0 2px var(--page) }
.costack__n { font-size: 15px; font-weight: var(--weight-strong); font-variant-numeric: tabular-nums }

/* Stage: the name over a track of the open stages, filled to where the
   company is. In the stage's Pipeline hue on the way, green once won, empty and red once lost. */
.costage { display: flex; flex-direction: column; gap: 7px; min-width: 0; max-width: 150px }
.costage__name {
  display: inline-flex; align-items: center; gap: 5px; min-width: 0;
  font-size: 13px; font-weight: var(--weight-strong);
  color: color-mix(in srgb, var(--stage-hue, var(--text)) 70%, var(--text));
}
.costage__name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.costage__name .ms { font-size: 15px; color: var(--muted) }
.costage.is-won .costage__name { color: #1E7A4A }
.costage.is-lost .costage__name { color: var(--bad) }
/* Other open deals, counted in grey after the stage; the name gives way first. */
.costage__name > .costage__more { flex: 0 0 auto; overflow: visible; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums }
.costage__suggest {
  flex: 0 0 auto; width: 7px; height: 7px; margin-left: 2px; border-radius: 50%;
  background: var(--bad); box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--bad);
}
.costage__track { display: flex; gap: 2px }
.costage__track i { flex: 1 1 0; height: 5px; background: #E6E6E6 }
.costage__track i:first-child { border-radius: var(--r-pill) 0 0 var(--r-pill) }
.costage__track i:last-child  { border-radius: 0 var(--r-pill) var(--r-pill) 0 }
.costage__track i.is-on { background: var(--stage-hue, var(--teal)) }
.costage.is-won .costage__track i.is-on { background: var(--good) }

.noresults {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 48px 24px; text-align: center;
}
.noresults .ms { font-size: 28px; color: #C4C4C4 }
.noresults b { font-size: 14px; font-weight: var(--weight-strong) }
