/* The dashboard's four cards (dashboard spec; design.md Decisions 4 and 5 of redesign-dashboard).
   Every card is the same size: one column on a phone, two by two from 56rem. The frame is neutral and
   the heading icon carries the card's colour, which never means a person (docs/visual-design.md). */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 56rem) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* The Weather card arrives in a lazy Turbo frame. The frame is the grid item and the card fills it: the
   frame keeps a box of its own because lazy loading waits for that box to be on screen. */
.dashboard-grid > turbo-frame {
  display: flex;
  min-width: 0;
}

.dashboard-grid > turbo-frame > .dashboard-card {
  flex: 1;
}

.dashboard-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 16rem;
  padding: 16px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}

.dashboard-card__heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 12px;
  font-size: 1.25rem;
}

.dashboard-card__icon {
  font-size: 1.375rem;
}

.dashboard-card--today .dashboard-card__icon,
.dashboard-card--tomorrow .dashboard-card__icon { color: var(--duckling-1); }
.dashboard-card--email .dashboard-card__icon { color: var(--duckling-2); }
.dashboard-card--ahead .dashboard-card__icon { color: var(--duckling-3); }
.dashboard-card--weather .dashboard-card__icon { color: var(--card-icon-sun); }

.dashboard-card__detail {
  color: var(--color-muted);
  font-size: 0.9375rem;
  font-weight: 400;
}

.dashboard-card__body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.dashboard-card__empty {
  margin: 0;
  color: var(--color-muted);
}

/* "+N more": a link to the Live Calendar's week, at the foot of a full card. */
.dashboard-card__more {
  margin: 8px 0 0;
  font-size: 0.875rem;
}

/* A day card's member groups and the lines under them. */
.dashboard-day__member + .dashboard-day__member {
  margin-top: 8px;
}

.dashboard-day__who {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-size: 1rem;
}

.dashboard-day__who .member-badge {
  width: 1.5rem;
  height: 1.5rem;
  font-size: 1.125rem;
}

.dashboard-lines {
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
}

.dashboard-lines--checklists {
  margin-top: 8px;
}

.dashboard-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 8px;
  min-height: 1.75rem;
  padding-left: 1.75rem;
}

.dashboard-lines--checklists .dashboard-line,
.dashboard-lines--ahead .dashboard-line {
  padding-left: 0;
}

.dashboard-line--attached {
  padding-left: 5.5rem;
}

.dashboard-line__name {
  font-weight: 600;
}

.dashboard-line__day {
  min-width: 5rem;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.dashboard-line__time {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.dashboard-line__state {
  padding: 0 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
}

.dashboard-line--cancelled .dashboard-line__name,
.dashboard-line--cancelled .dashboard-line__time {
  color: var(--color-muted);
  text-decoration: line-through;
}

.dashboard-line__who,
.dashboard-line__runs {
  display: inline-flex;
  gap: 2px;
}

.dashboard-line__who .member-badge {
  width: 1.25rem;
  height: 1.25rem;
  font-size: 1rem;
}

/* A drop-off or pick-up icon, shaped like the Normal Week's caps: the arrangement's look comes from journeys.css. */
.dashboard-run {
  width: 1.5rem;
  height: 1.375rem;
  border-radius: 4px;
  font-size: 0.875rem;
}

/* The legend: who each icon is. */
.dashboard-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 12px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--color-border);
  list-style: none;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.dashboard-legend li {
  display: inline-flex;
  align-items: center;
}

.dashboard-legend .member-badge {
  width: 1.25rem;
  height: 1.25rem;
  font-size: 1rem;
}

/* A checklist line, which opens its popup. */
.dashboard-checklist {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

button.dashboard-checklist__open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--color-accent);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.dashboard-checklist__open:hover .dashboard-checklist__summary {
  text-decoration: underline;
}

.dashboard-checklist__children .member-badge {
  width: 1.25rem;
  height: 1.25rem;
  font-size: 1rem;
}

.checklist-popup {
  width: min(560px, calc(100vw - 2 * var(--gutter)));
  max-height: min(90dvh, 44rem);
  padding: 16px 20px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

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

.checklist-popup__actions {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 0;
}

/* Email catch up's counts. */
.dashboard-counts {
  display: grid;
  gap: 10px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.dashboard-count {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--color-text);
  font-size: 1.125rem;
  text-decoration: none;
}

.dashboard-count:hover {
  text-decoration: underline;
}

.dashboard-count__number {
  min-width: 2ch;
  font-size: 1.75rem;
  font-weight: 700;
  text-align: right;
}

.dashboard-count--overdue {
  color: var(--color-danger);
}
