/* Email Monitoring: the list of matched emails and an email's page (email-monitoring spec). Mobile first. */
.email-views {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.email-views__item {
  padding: 4px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text);
  text-decoration: none;
}

.email-views__item[aria-current="page"] {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-bg);
  font-weight: 600;
}

.email-count {
  margin: 0 0 8px;
}

.email-count strong {
  color: var(--color-accent);
}

/* The inbox: one row per email, a card on phones and a five-column grid from 680 pixels, each with
   its actions beneath (design.md Decision 7 of email-inbox-actions). */
.inbox {
  margin: 0 0 16px;
}

.inbox-head {
  display: none;
}

.inbox-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.inbox-row__field {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  grid-column: 1 / -1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* On a phone the date sits beside About, and an email with no children has no Child line. */
.inbox-row__about {
  grid-column: 1;
}

.inbox-row__date {
  grid-column: 2;
  grid-row: 1;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.inbox-row__field--empty {
  display: none;
}

/* The column heads name the fields on a wide screen, and the card's layout on a phone, so the
   labels are for screen readers only. */
.inbox-row__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.inbox-row__about,
.inbox-row__summary {
  flex-direction: column;
  align-items: flex-start;
}

.inbox-row__activities {
  font-weight: 600;
}

.inbox-row__sender,
.inbox-status--muted {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.inbox-row__children {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.inbox-row__subject {
  font-weight: 600;
}

/* A status like "Decide by Sat 7 Nov, 17:00" wraps within its column rather than spilling out. */
.inbox-row .email-tier {
  white-space: normal;
}

.inbox-status--overdue {
  color: var(--color-danger);
}

.inbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  margin-top: 4px;
}

.inbox-actions form {
  display: contents;
}

.inbox-next p {
  margin: 0;
}

.inbox-next p + p {
  margin-top: 4px;
}

@media (min-width: 680px) {
  .inbox-head,
  .inbox-row {
    grid-template-columns: minmax(0, 1.1fr) 6.5rem minmax(0, 0.9fr) minmax(0, 2fr) minmax(0, 1.1fr);
    column-gap: 16px;
  }

  .inbox-head {
    display: grid;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 0.875rem;
  }

  .inbox-row__field,
  .inbox-row__about,
  .inbox-row__date {
    grid-column: auto;
    grid-row: auto;
    align-content: flex-start;
  }

  .inbox-row__date {
    color: var(--color-text);
    font-size: 1rem;
  }

  .inbox-row__field--empty {
    display: flex;
  }
}

/* Yes and No, tinted green and red with their words (docs/visual-design.md). Two classes, to win over
   layout.css's .button, which loads after this file. */
.button.button--yes,
.button.button--no {
  font-weight: 600;
}

.button.button--yes {
  border-color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 22%, var(--color-surface));
}

.button.button--no {
  border-color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 22%, var(--color-surface));
}

.inbox-actions .button--primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-bg);
  font-weight: 600;
}

/* Read Full: the email in a popup that fits a laptop screen, where only the body scrolls, and fills
   the screen and scrolls as a whole below 680 pixels (design.md Decision 5 of email-inbox-actions). */
.email-reader {
  width: min(760px, calc(100vw - 2 * var(--gutter)));
  max-height: min(90dvh, 52rem);
  padding: 0;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.email-reader[open] {
  display: flex;
  flex-direction: column;
}

.email-reader::backdrop {
  background: rgb(1 4 9 / 0.7);
}

.email-reader turbo-frame {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.reader {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 16px 20px;
}

.reader__head {
  display: flex;
  flex: none;
  justify-content: space-between;
  gap: 16px;
}

.reader__subject {
  margin: 0 0 4px;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.reader__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  margin: 0;
  color: var(--color-muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.reader__body {
  flex: 1 1 auto;
  min-height: 6rem;
  overflow: auto;
}

.reader__attachments {
  flex: none;
  margin: 0;
}

.reader .inbox-actions {
  flex: none;
  margin-top: 0;
}

@media (max-width: 679px) {
  .email-reader {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .email-reader[open] {
    display: block;
    overflow: auto;
  }

  .email-reader turbo-frame,
  .reader {
    display: block;
  }

  .reader > * + * {
    margin-top: 12px;
  }

  .reader__body {
    overflow: visible;
  }
}

.email-row__activities {
  display: block;
  margin: 0;
  color: var(--color-success);
  font-size: 0.875rem;
}

.email-pager {
  display: flex;
  gap: 8px;
}

.back-link {
  margin: 0 0 8px;
}

.email-page {
  max-width: 720px;
}

.email-page h1 {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.email-page__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 0;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

.email-page__done {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.email-page .button--primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-bg);
  font-weight: 600;
}

.email-section {
  margin-top: 24px;
}

.email-section h3 {
  margin: 16px 0 8px;
  font-size: 1rem;
  color: var(--color-muted);
}

.email-nothing {
  color: var(--color-muted);
}

/* The three ducklings: all in a row, nothing to do. */
.all-clear {
  display: flex;
  align-items: center;
  gap: 12px;
}

.proposal-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.proposal {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.proposal--dismissed {
  opacity: 0.6;
}

.proposal--dismissed .proposal__title {
  text-decoration: line-through;
}

.proposal__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
}

.proposal__title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.proposal__children {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.proposal__child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
}

.proposal__child .member-badge {
  width: 1.25rem;
  height: 1.25rem;
  font-size: 0.8rem;
}

.proposal__activity {
  color: var(--color-success);
  font-size: 0.875rem;
}

.proposal__details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 8px 0;
}

.proposal__details dt {
  color: var(--color-muted);
}

.proposal__details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.proposal__items {
  margin: 0;
  padding-left: 18px;
}

.proposal__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.email-attachments {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.email-attachments li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 4px 0;
  overflow-wrap: anywhere;
}

.email-attachments__size {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.email-body {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
