/* PWR Lab form fills dashboard (/admin/).

   Loaded after /assets/css/site.css and built only from its tokens, so the
   site's rules hold here too: 4px controls, the 4px spacing grid, hairlines
   for depth, weights 400 and 500, sentence case.

   It is a working screen, so it stays on the ink neutrals. The loud voice
   appears once, on the three counts at the top. Red means one thing: a reply
   that is past the 24 hours the contact page promises, or an email that
   never went out. Volt is kept for the sign-in button.

   Layout follows the page grid's three edges (left margin, column 5,
   column 9): the counts sit on them, and so do each form fill's three parts,
   who it is, what they wrote and where it stands.
*/

/* ---------- Sign-in and "cannot open yet" pages ---------- */

.signin {
  padding-block: var(--s-24);
}

.signin__box {
  display: grid;
  gap: var(--s-6);
  justify-items: start;
  width: min(100%, 26rem);
}

.signin__logo {
  width: auto;
  height: var(--s-8);
}

.signin__lead {
  color: var(--fg);
}

.signin__box .form {
  width: 100%;
  gap: var(--s-4);
}

/* Buttons keep their own width, as they do on the site. */
.signin__box .btn {
  justify-self: start;
}

.signin__box code {
  font-family: var(--font-mono);
  font-size: var(--t-small);
  color: var(--fg);
  overflow-wrap: anywhere;
}

/* ---------- Page ---------- */

.board {
  padding-block: var(--s-12) var(--s-24);
}

.board:focus {
  outline: none;
}

.board__foot {
  max-width: 34rem;
  margin-top: var(--s-12);
  font-size: var(--t-small);
  color: var(--fg-3);
}

.nav__bar form {
  display: flex;
}

/* Text buttons share the link style; a button needs its own resets. */
button.link {
  text-align: left;
}

.notice {
  margin-top: var(--s-6);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-1);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
  color: var(--fg);
}

.notice--error {
  background: rgba(255, 111, 145, 0.12);
  box-shadow: none;
  color: var(--danger-text);
}

/* ---------- The three counts ---------- */

.tally {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-6) var(--g);
  margin-top: var(--s-10);
}

/* The number sits above its label; the markup keeps the label first. */
.tally__item {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: var(--s-2);
}

.tally dd {
  font-size: clamp(2.25rem, 5vw, 4rem);
  color: var(--fg);
}

.tally dt {
  max-width: 16ch;
  font-size: var(--t-small);
  line-height: 1.4;
  color: var(--fg-2);
}

.tally__item--late dd {
  color: var(--danger-text);
}

/* ---------- Tabs and filters ---------- */

.toolbar {
  display: grid;
  gap: var(--s-4);
  margin-top: var(--s-12);
}

a.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  text-decoration: none;
}

.tab[aria-current="true"] {
  background: var(--raised);
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--fg-3);
}

.tab__count {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-variant-numeric: tabular-nums;
  color: var(--fg-3);
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
  align-items: center;
}

.filters__search,
.filters__actions {
  grid-column: 1 / -1;
}

.filters__actions {
  display: flex;
  align-items: center;
  gap: var(--s-5);
}

@media (min-width: 48rem) {
  .filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr) auto;
  }

  .filters__search,
  .filters__actions {
    grid-column: auto;
  }
}

/* Tabs in columns 1 to 4, filters from column 5. */
@media (min-width: 75rem) {
  .toolbar {
    grid-template-columns: var(--span-4) minmax(0, 1fr);
    gap: var(--g);
    align-items: center;
  }
}

/* ---------- The list ---------- */

.listhead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2) var(--s-8);
  margin-top: var(--s-8);
  font-size: var(--t-small);
}

.listhead > p {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
}

.listhead__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--s-2) var(--s-6);
}

.listhead__tools > .link,
.bulk summary {
  min-height: 2.75rem;
}

.bulk summary {
  cursor: pointer;
  list-style: none;
}

.bulk summary::-webkit-details-marker {
  display: none;
}

.bulk__body {
  display: grid;
  gap: var(--s-3);
  justify-items: start;
  max-width: 26rem;
  padding-bottom: var(--s-4);
}

.leads {
  margin: var(--s-2) 0 0;
  padding: 0;
  list-style: none;
}

.leads__empty {
  margin-top: var(--s-8);
  padding-block: var(--s-12);
  box-shadow: 0 -1px 0 var(--hairline);
  color: var(--fg);
}

.lead {
  display: grid;
  gap: var(--s-4);
  padding-block: var(--s-8);
  box-shadow: 0 -1px 0 var(--hairline);
  /* Leaves room for the sticky bar when a status change jumps back to this row. */
  scroll-margin-top: var(--s-16);
}

.lead__who {
  display: grid;
  gap: var(--s-1);
  align-content: start;
  justify-items: start;
  min-width: 0;
}

.lead__who .h-item {
  overflow-wrap: anywhere;
}

/* A handled form fill steps back, so the ones still waiting stand out. */
.lead--contacted .h-item,
.lead--archived .h-item {
  color: var(--fg-2);
}

.lead__facts {
  font-size: var(--t-small);
}

/* Email and phone are what gets tapped, so each line is a full 44px target. */
.lead__contact {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.lead__contact .link::after {
  inset: calc(var(--s-3) * -1) 0;
}

/* With a mouse the two lines can sit closer, like lines of an address. */
@media (hover: hover) and (pointer: fine) {
  .lead__contact {
    min-height: var(--s-8);
  }

  .lead__contact .link::after {
    inset: calc(var(--s-1) * -1) 0;
  }
}

.lead__message {
  max-width: 60ch;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lead__state {
  display: grid;
  gap: var(--s-1);
  align-content: start;
  justify-items: start;
}

.lead__status {
  font-weight: 500;
  color: var(--fg);
}

.lead__detail {
  margin-left: var(--s-2);
  font-weight: 400;
  color: var(--fg-2);
}

.lead__detail--late,
.lead__flag {
  color: var(--danger-text);
}

.lead__time,
.lead__flag {
  font-size: var(--t-small);
}

.lead__time {
  color: var(--fg-3);
}

.lead__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-6);
  min-height: 2.75rem;
  margin-top: var(--s-3);
}

@media (min-width: 62rem) {
  .lead {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--g);
  }
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding-top: var(--s-6);
  box-shadow: 0 -1px 0 var(--hairline);
  font-size: var(--t-small);
}

.pager__links {
  display: flex;
  gap: var(--s-2);
}
