/* Time period picker */
.report-period-picker {
  width: 34rem;
  overflow: visible !important; /* the From / To calendars open below their fields */
}

.report-period-picker:not(.has-compare) {
  width: 30rem;
}

.report-picker {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
}

.report-picker-presets {
  border-right: 1px solid hsl(var(--border));
  padding: 0.375rem;
}

.report-picker-preset-select {
  display: none;
}

.report-picker-preset {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.3125rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  cursor: pointer;
}

.report-picker-preset:hover {
  background: hsl(var(--muted));
}

.report-picker-preset:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: -2px;
}

.report-picker-preset.is-selected {
  background: hsl(var(--primary) / 0.08);
  color: hsl(var(--primary));
  font-weight: 600;
}

.report-picker-detail {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  min-width: 0;
  padding: 1rem 1.25rem;
}

.report-picker-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.report-picker-dates[hidden],
.report-picker-actions[hidden] {
  display: none;
}

.report-picker-date {
  display: flex;
  align-items: center;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  font-weight: 400;
}

.report-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: auto;
}

/* phones: a sheet from the bottom */
@media (max-width: 639px) {
  .report-period-picker,
  .report-period-picker:not(.has-compare) {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    border-radius: 1rem 1rem 0 0;
  }

  .report-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .report-picker-presets {
    border-right: 0;
    padding: 1rem 1rem 0;
  }

  .report-picker-preset-list {
    display: none;
  }

  .report-picker-preset-select {
    display: grid;
    gap: 0.25rem;
  }

  .report-picker-detail {
    padding: 1rem;
  }

  .report-picker-actions > * {
    flex: 1;
  }
}

/* opens over the Schedule email dialog, so what was picked there stays */
.report-email-preview {
  width: min(680px, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  margin: auto;
  padding: 0;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.report-email-preview::backdrop {
  background: rgb(0 0 0 / 0.5);
}

.report-email-preview iframe {
  height: min(560px, calc(100vh - 17rem));
}

.report-picker select {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 639px) {
  .report-filter-bar [data-controller~="ui--dropdown"],
  .report-filter-bar [data-controller~="custom-select"],
  .report-filter-bar [data-controller~="ui--dropdown"] > button,
  .report-filter-bar [data-controller~="custom-select"] > button {
    width: 100%;
  }

  .report-email-preview {
    width: calc(100vw - 1rem);
  }

  .report-email-preview > div {
    padding: 1rem;
  }
}
